Skip to content

Commit ac4df36

Browse files
Perform full chart install in e2e test
Signed-off-by: Danil-Grigorev <[email protected]>
1 parent d03c162 commit ac4df36

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

test/e2e/e2e_suite_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ var (
116116

117117
// helmChart is the helm chart helper to be used for the e2e tests.
118118
helmChart *HelmChart
119+
120+
// fullHelmChart is the helm chart wrapper to install operator in e2e tests.
121+
fullHelmChart *HelmChart
119122
)
120123

121124
func init() {
@@ -366,6 +369,15 @@ func initHelmChart() {
366369
DryRun: true,
367370
Output: Hooks,
368371
}
372+
373+
fullHelmChart = &HelmChart{
374+
BinaryPath: helmBinaryPath,
375+
Path: chartPath,
376+
Name: "capi-operator",
377+
Kubeconfig: helmClusterProxy.GetKubeconfigPath(),
378+
Wait: true,
379+
Output: Full,
380+
}
369381
}
370382

371383
// Using a SynchronizedAfterSuite for controlling how to delete resources shared across ParallelNodes (~ginkgo threads).

test/e2e/helm_test.go

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,76 @@ import (
2525

2626
. "github.com/onsi/ginkgo/v2"
2727
. "github.com/onsi/gomega"
28+
appsv1 "k8s.io/api/apps/v1"
29+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
30+
"k8s.io/utils/ptr"
31+
operatorv1 "sigs.k8s.io/cluster-api-operator/api/v1alpha2"
2832
. "sigs.k8s.io/cluster-api-operator/test/framework"
33+
"sigs.k8s.io/cluster-api/test/framework"
2934
)
3035

3136
var _ = Describe("Create a proper set of manifests when using helm charts", func() {
37+
It("should deploy a quick-start cluster-api-operator chart", func() {
38+
_, err := fullHelmChart.Run(nil)
39+
Expect(err).ToNot(HaveOccurred())
40+
41+
clusterProxy := helmClusterProxy.GetClient()
42+
coreProvider := &operatorv1.CoreProvider{
43+
ObjectMeta: metav1.ObjectMeta{
44+
Name: coreProviderName,
45+
},
46+
}
47+
Expect(clusterProxy.Create(ctx, coreProvider)).To(Succeed())
48+
49+
By("Waiting for the core provider deployment to be ready")
50+
framework.WaitForDeploymentsAvailable(ctx, framework.WaitForDeploymentsAvailableInput{
51+
Getter: clusterProxy,
52+
Deployment: &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{Name: coreProviderDeploymentName}},
53+
}, e2eConfig.GetIntervals(helmClusterProxy.GetName(), "wait-controllers")...)
54+
55+
By("Waiting for core provider to be ready")
56+
WaitFor(ctx, For(coreProvider).In(clusterProxy).ToSatisfy(
57+
HaveStatusCondition(&coreProvider.Status.Conditions, operatorv1.ProviderInstalledCondition),
58+
), e2eConfig.GetIntervals(helmClusterProxy.GetName(), "wait-controllers")...)
59+
60+
By("Waiting for status.IntalledVersion to be set")
61+
WaitFor(ctx, For(coreProvider).In(clusterProxy).ToSatisfy(func() bool {
62+
return ptr.Equal(coreProvider.Status.InstalledVersion, ptr.To(coreProvider.Spec.Version))
63+
}), e2eConfig.GetIntervals(helmClusterProxy.GetName(), "wait-controllers")...)
64+
65+
bootstrapProvider := &operatorv1.BootstrapProvider{ObjectMeta: metav1.ObjectMeta{
66+
Name: bootstrapProviderName,
67+
}}
68+
deployment := &appsv1.Deployment{ObjectMeta: metav1.ObjectMeta{
69+
Name: bootstrapProviderDeploymentName,
70+
}}
71+
72+
Expect(clusterProxy.Create(ctx, bootstrapProvider)).To(Succeed())
73+
74+
By("Waiting for the bootstrap provider deployment to be ready")
75+
framework.WaitForDeploymentsAvailable(ctx, framework.WaitForDeploymentsAvailableInput{
76+
Getter: clusterProxy,
77+
Deployment: deployment,
78+
}, e2eConfig.GetIntervals(helmClusterProxy.GetName(), "wait-controllers")...)
79+
80+
By("Waiting for bootstrap provider to be ready")
81+
WaitFor(ctx, For(bootstrapProvider).In(clusterProxy).ToSatisfy(
82+
HaveStatusCondition(&bootstrapProvider.Status.Conditions, operatorv1.ProviderInstalledCondition)),
83+
e2eConfig.GetIntervals(helmClusterProxy.GetName(), "wait-controllers")...)
84+
85+
By("Waiting for status.IntalledVersion to be set")
86+
WaitFor(ctx, For(bootstrapProvider).In(clusterProxy).ToSatisfy(func() bool {
87+
return ptr.Equal(bootstrapProvider.Status.InstalledVersion, &bootstrapProvider.Spec.Version)
88+
}), e2eConfig.GetIntervals(helmClusterProxy.GetName(), "wait-controllers")...)
89+
Expect(clusterProxy.Delete(ctx, bootstrapProvider)).To(Succeed())
90+
91+
By("Waiting for the bootstrap provider deployment to be deleted")
92+
WaitForDelete(ctx, For(deployment).In(clusterProxy),
93+
e2eConfig.GetIntervals(helmClusterProxy.GetName(), "wait-controllers")...)
94+
95+
Expect(clusterProxy.Delete(ctx, coreProvider)).To(Succeed())
96+
})
97+
3298
It("should deploy default manifest set for quick-start process", func() {
3399
fullRun := &HelmChart{
34100
BinaryPath: helmChart.BinaryPath,

0 commit comments

Comments
 (0)