Skip to content

Commit

Permalink
Add e2e helm test
Browse files Browse the repository at this point in the history
  • Loading branch information
willie-yao committed Jun 6, 2024
1 parent 450c0c0 commit ad064f1
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/e2e/helm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,19 @@ var _ = Describe("Create a proper set of manifests when using helm charts", func
Expect(err).ToNot(HaveOccurred())
Expect(manifests).To(Equal(string(expectedManifests)))
})

It("should deploy core and infra with additional deployment customizations", func() {
manifests, err := helmChart.Run(map[string]string{
"configSecret.name": "test-secret-name",
"configSecret.namespace": "test-secret-namespace",
"infrastructure": "azure",
"additionalDeployments.fake-controller-manager.manager.crdPattern": ".*",
"additionalDeployments.fake-controller-manager.deployment.replicas": "2",
})
Expect(err).ToNot(HaveOccurred())
Expect(manifests).ToNot(BeEmpty())
expectedManifests, err := os.ReadFile(filepath.Join(customManifestsFolder, "only-infra.yaml"))
Expect(err).ToNot(HaveOccurred())
Expect(manifests).To(MatchYAML(string(expectedManifests)))
})
})
104 changes: 104 additions & 0 deletions test/e2e/resources/only-infra-with-additional-deployments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
# Source: cluster-api-operator/templates/core-conditions.yaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
name: capi-system
---
# Source: cluster-api-operator/templates/infra-conditions.yaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
"argocd.argoproj.io/sync-wave": "1"
name: capi-kubeadm-bootstrap-system
---
# Source: cluster-api-operator/templates/infra-conditions.yaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
"argocd.argoproj.io/sync-wave": "1"
name: capi-kubeadm-control-plane-system
---
# Source: cluster-api-operator/templates/infra.yaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "1"
"argocd.argoproj.io/sync-wave": "1"
name: docker-infrastructure-system
---
# Source: cluster-api-operator/templates/infra-conditions.yaml
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: BootstrapProvider
metadata:
name: kubeadm
namespace: capi-kubeadm-bootstrap-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
"argocd.argoproj.io/sync-wave": "2"
spec:
configSecret:
name: test-secret-name
namespace: test-secret-namespace
---
# Source: cluster-api-operator/templates/infra-conditions.yaml
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: ControlPlaneProvider
metadata:
name: kubeadm
namespace: capi-kubeadm-control-plane-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
"argocd.argoproj.io/sync-wave": "2"
spec:
configSecret:
name: test-secret-name
namespace: test-secret-namespace
---
# Source: cluster-api-operator/templates/core-conditions.yaml
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: CoreProvider
metadata:
name: cluster-api
namespace: capi-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
spec:
configSecret:
name: test-secret-name
namespace: test-secret-namespace
---
# Source: cluster-api-operator/templates/infra.yaml
apiVersion: operator.cluster.x-k8s.io/v1alpha2
kind: InfrastructureProvider
metadata:
name: azure
namespace: azure-infrastructure-system
annotations:
"helm.sh/hook": "post-install"
"helm.sh/hook-weight": "2"
"argocd.argoproj.io/sync-wave": "2"
spec:
configSecret:
name: test-secret-name
namespace: test-secret-namespace
additionalDeployments:
fake-controller-manager:
manager:
crdPattern: ".*"
deployment:
replicas: 2

0 comments on commit ad064f1

Please sign in to comment.