Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update test case
Signed-off-by: Daniel Fan <[email protected]>
  • Loading branch information
Daniel-Fan committed Jun 6, 2024
commit cc569311ddc9560a1ced848bc68ff15e3ce37336
4 changes: 2 additions & 2 deletions controllers/operandconfig/operandconfig_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ var _ = Describe("OperandConfig controller", func() {
}, timeout, interval).Should(Succeed())

By("Creating and Setting status of the ClusterServiceVersions")
jaegerCSV := testutil.ClusterServiceVersion("jaeger-csv.v0.0.1", operatorNamespaceName, testutil.JaegerExample)
jaegerCSV := testutil.ClusterServiceVersion("jaeger-csv.v0.0.1", "jaeger", operatorNamespaceName, testutil.JaegerExample)
Expect(k8sClient.Create(ctx, jaegerCSV)).Should(Succeed())
Eventually(func() error {
k8sClient.Get(ctx, types.NamespacedName{Name: "jaeger-csv.v0.0.1", Namespace: operatorNamespaceName}, jaegerCSV)
jaegerCSV.Status = testutil.ClusterServiceVersionStatus()
return k8sClient.Status().Update(ctx, jaegerCSV)
}, timeout, interval).Should(Succeed())

mongodbCSV := testutil.ClusterServiceVersion("mongodb-atlas-kubernetes-csv.v0.0.1", operatorNamespaceName, testutil.MongodbExample)
mongodbCSV := testutil.ClusterServiceVersion("mongodb-atlas-kubernetes-csv.v0.0.1", "mongodb-atlas-kubernetes", operatorNamespaceName, testutil.MongodbExample)
Expect(k8sClient.Create(ctx, mongodbCSV)).Should(Succeed())
Eventually(func() error {
k8sClient.Get(ctx, types.NamespacedName{Name: "mongodb-atlas-kubernetes-csv.v0.0.1", Namespace: operatorNamespaceName}, mongodbCSV)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ var _ = Describe("OperandRegistry controller", func() {
}, timeout, interval).Should(Succeed())

By("Creating and Setting status of the ClusterServiceVersions")
jaegerCSV := testutil.ClusterServiceVersion("jaeger-csv.v0.0.1", operatorNamespaceName, testutil.JaegerExample)
jaegerCSV := testutil.ClusterServiceVersion("jaeger-csv.v0.0.1", "jaeger", operatorNamespaceName, testutil.JaegerExample)
Expect(k8sClient.Create(ctx, jaegerCSV)).Should(Succeed())
Eventually(func() error {
k8sClient.Get(ctx, types.NamespacedName{Name: "jaeger-csv.v0.0.1", Namespace: operatorNamespaceName}, jaegerCSV)
jaegerCSV.Status = testutil.ClusterServiceVersionStatus()
return k8sClient.Status().Update(ctx, jaegerCSV)
}, timeout, interval).Should(Succeed())

mongodbCSV := testutil.ClusterServiceVersion("mongodb-atlas-kubernetes-csv.v0.0.1", operatorNamespaceName, testutil.MongodbExample)
mongodbCSV := testutil.ClusterServiceVersion("mongodb-atlas-kubernetes-csv.v0.0.1", "mongodb-atlas-kubernetes", operatorNamespaceName, testutil.MongodbExample)
Expect(k8sClient.Create(ctx, mongodbCSV)).Should(Succeed())
Eventually(func() error {
k8sClient.Get(ctx, types.NamespacedName{Name: "mongodb-atlas-kubernetes-csv.v0.0.1", Namespace: operatorNamespaceName}, mongodbCSV)
Expand Down
12 changes: 6 additions & 6 deletions controllers/operandrequest/operandrequest_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ var _ = Describe("OperandRequest controller", func() {
}, testutil.Timeout, testutil.Interval).Should(Succeed())

By("Creating and Setting status of the ClusterServiceVersions")
jaegerCSV := testutil.ClusterServiceVersion("jaeger-csv.v0.0.1", operatorNamespaceName, testutil.JaegerExample)
jaegerCSV := testutil.ClusterServiceVersion("jaeger-csv.v0.0.1", "jaeger", operatorNamespaceName, testutil.JaegerExample)
Expect(k8sClient.Create(ctx, jaegerCSV)).Should(Succeed())
Eventually(func() error {
k8sClient.Get(ctx, types.NamespacedName{Name: "jaeger-csv.v0.0.1", Namespace: operatorNamespaceName}, jaegerCSV)
jaegerCSV.Status = testutil.ClusterServiceVersionStatus()
return k8sClient.Status().Update(ctx, jaegerCSV)
}, testutil.Timeout, testutil.Interval).Should(Succeed())

mongodbCSV := testutil.ClusterServiceVersion("mongodb-atlas-kubernetes-csv.v0.0.1", operatorNamespaceName, testutil.MongodbExample)
mongodbCSV := testutil.ClusterServiceVersion("mongodb-atlas-kubernetes-csv.v0.0.1", "mongodb-atlas-kubernetes", operatorNamespaceName, testutil.MongodbExample)
Expect(k8sClient.Create(ctx, mongodbCSV)).Should(Succeed())
Eventually(func() error {
k8sClient.Get(ctx, types.NamespacedName{Name: "mongodb-atlas-kubernetes-csv.v0.0.1", Namespace: operatorNamespaceName}, mongodbCSV)
Expand Down Expand Up @@ -272,15 +272,15 @@ var _ = Describe("OperandRequest controller", func() {
}, testutil.Timeout, testutil.Interval).Should(Succeed())

By("Creating and Setting status of the ClusterServiceVersions")
jaegerCSV := testutil.ClusterServiceVersion("jaeger-csv.v0.0.1", operatorNamespaceName, testutil.JaegerExample)
jaegerCSV := testutil.ClusterServiceVersion("jaeger-csv.v0.0.1", "jaeger", operatorNamespaceName, testutil.JaegerExample)
Expect(k8sClient.Create(ctx, jaegerCSV)).Should(Succeed())
Eventually(func() error {
k8sClient.Get(ctx, types.NamespacedName{Name: "jaeger-csv.v0.0.1", Namespace: operatorNamespaceName}, jaegerCSV)
jaegerCSV.Status = testutil.ClusterServiceVersionStatus()
return k8sClient.Status().Update(ctx, jaegerCSV)
}, testutil.Timeout, testutil.Interval).Should(Succeed())

mongodbCSV := testutil.ClusterServiceVersion("mongodb-atlas-kubernetes-csv.v0.0.1", operatorNamespaceName, testutil.MongodbExample)
mongodbCSV := testutil.ClusterServiceVersion("mongodb-atlas-kubernetes-csv.v0.0.1", "mongodb-atlas-kubernetes", operatorNamespaceName, testutil.MongodbExample)
Expect(k8sClient.Create(ctx, mongodbCSV)).Should(Succeed())
Eventually(func() error {
k8sClient.Get(ctx, types.NamespacedName{Name: "mongodb-atlas-kubernetes-csv.v0.0.1", Namespace: operatorNamespaceName}, mongodbCSV)
Expand Down Expand Up @@ -433,15 +433,15 @@ var _ = Describe("OperandRequest controller", func() {
}, testutil.Timeout, testutil.Interval).Should(Succeed())

By("Creating and Setting status of the ClusterServiceVersions")
jaegerCSV := testutil.ClusterServiceVersion("jaeger-csv.v0.0.1", operatorNamespaceName, testutil.JaegerExample)
jaegerCSV := testutil.ClusterServiceVersion("jaeger-csv.v0.0.1", "jaeger", operatorNamespaceName, testutil.JaegerExample)
Expect(k8sClient.Create(ctx, jaegerCSV)).Should(Succeed())
Eventually(func() error {
k8sClient.Get(ctx, types.NamespacedName{Name: "jaeger-csv.v0.0.1", Namespace: operatorNamespaceName}, jaegerCSV)
jaegerCSV.Status = testutil.ClusterServiceVersionStatus()
return k8sClient.Status().Update(ctx, jaegerCSV)
}, testutil.Timeout, testutil.Interval).Should(Succeed())

mongodbCSV := testutil.ClusterServiceVersion("mongodb-atlas-kubernetes-csv.v0.0.1", operatorNamespaceName, testutil.MongodbExample)
mongodbCSV := testutil.ClusterServiceVersion("mongodb-atlas-kubernetes-csv.v0.0.1", "mongodb-atlas-kubernetes", operatorNamespaceName, testutil.MongodbExample)
Expect(k8sClient.Create(ctx, mongodbCSV)).Should(Succeed())
Eventually(func() error {
k8sClient.Get(ctx, types.NamespacedName{Name: "mongodb-atlas-kubernetes-csv.v0.0.1", Namespace: operatorNamespaceName}, mongodbCSV)
Expand Down
5 changes: 4 additions & 1 deletion controllers/testutil/test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,14 +495,17 @@ func SubscriptionStatus(name, namespace, csvVersion string) olmv1alpha1.Subscrip
}
}

func ClusterServiceVersion(name, namespace, example string) *olmv1alpha1.ClusterServiceVersion {
func ClusterServiceVersion(name, packageName, namespace, example string) *olmv1alpha1.ClusterServiceVersion {
return &olmv1alpha1.ClusterServiceVersion{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
Annotations: map[string]string{
"alm-examples": example,
},
Labels: map[string]string{
"operators.coreos.com/" + packageName + "." + namespace: "",
},
},
Spec: olmv1alpha1.ClusterServiceVersionSpec{
InstallStrategy: olmv1alpha1.NamedInstallStrategy{
Expand Down