Skip to content

Commit

Permalink
update e2e test to take opm version as a parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Per Goncalves da Silva <[email protected]>
  • Loading branch information
Per Goncalves da Silva committed Jun 27, 2024
1 parent a9d0dce commit 73f61f9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
11 changes: 6 additions & 5 deletions test/e2e/catalog_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
c operatorclient.ClientInterface
crc versioned.Interface
packageserverClient *packageserverclientset.Clientset
testCatalogImage string
)

BeforeEach(func() {
Expand All @@ -67,6 +68,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
c = ctx.Ctx().KubeClient()
crc = ctx.Ctx().OperatorClient()
packageserverClient = packageserverclientset.NewForConfigOrDie(ctx.Ctx().RESTConfig())
testCatalogImage = fmt.Sprintf("%s/test-catalog:e2e", testClusterRegistry)
})

AfterEach(func() {
Expand Down Expand Up @@ -704,7 +706,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
},
Spec: v1alpha1.CatalogSourceSpec{
SourceType: v1alpha1.SourceTypeGrpc,
Image: communityOperatorsImage,
Image: testCatalogImage,
GrpcPodConfig: &v1alpha1.GrpcPodConfig{
SecurityContextConfig: v1alpha1.Restricted,
},
Expand Down Expand Up @@ -764,7 +766,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
},
Spec: v1alpha1.CatalogSourceSpec{
SourceType: v1alpha1.SourceTypeGrpc,
Image: communityOperatorsImage,
Image: testCatalogImage,
GrpcPodConfig: &v1alpha1.GrpcPodConfig{
SecurityContextConfig: v1alpha1.Restricted,
ExtractContent: &v1alpha1.ExtractContentConfig{
Expand Down Expand Up @@ -1075,7 +1077,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
},
Spec: v1alpha1.CatalogSourceSpec{
SourceType: v1alpha1.SourceTypeGrpc,
Image: catSrcImage + ":1.0.0-with-ListBundles-method",
Image: fmt.Sprintf("%s:1.0.0-with-ListBundles-method", catSrcImage),
GrpcPodConfig: &v1alpha1.GrpcPodConfig{
SecurityContextConfig: v1alpha1.Restricted,
},
Expand Down Expand Up @@ -1126,8 +1128,7 @@ var _ = Describe("Starting CatalogSource e2e tests", func() {
if err != nil {
return err
}
existingSource.Spec.Image = catSrcImage + ":2.0.0-with-ListBundles-method"

existingSource.Spec.Image = fmt.Sprintf("%s:2.0.0-with-ListBundles-method", catSrcImage)
source, err = crc.OperatorsV1alpha1().CatalogSources(source.GetNamespace()).Update(context.Background(), existingSource, metav1.UpdateOptions{})
return err
}).Should(Succeed())
Expand Down
24 changes: 12 additions & 12 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ var (
catalogNamespace = flag.String(
"catalogNamespace", "", "namespace where the global catalog content is stored")

communityOperators = flag.String(
"communityOperators",
"quay.io/operatorhubio/catalog:latest",
"reference to upstream-community-operators image",
)

dummyImage = flag.String(
"dummyImage",
"bitnami/nginx:latest",
Expand All @@ -62,6 +56,12 @@ var (
"configures where to find the testdata directory",
)

clusterRegistry = flag.String(
"cluster-registry",
"localhost:5001",
"set cluster registry url (default: localhost:5001)",
)

kubeconfigRootDir = flag.String(
"kubeconfig-root",
"",
Expand All @@ -71,11 +71,11 @@ var (
"Note that this flag will override the kubeconfig flag.",
)

testdataDir = ""
testNamespace = ""
operatorNamespace = ""
communityOperatorsImage = ""
globalCatalogNamespace = ""
testdataDir = ""
testNamespace = ""
operatorNamespace = ""
globalCatalogNamespace = ""
testClusterRegistry = ""
)

func TestEndToEnd(t *testing.T) {
Expand Down Expand Up @@ -104,9 +104,9 @@ var _ = BeforeSuite(func() {

testNamespace = *namespace
operatorNamespace = *olmNamespace
communityOperatorsImage = *communityOperators
globalCatalogNamespace = *catalogNamespace
testdataDir = *testdataPath
testClusterRegistry = *clusterRegistry
deprovision = ctx.MustProvision(ctx.Ctx())
ctx.MustInstall(ctx.Ctx())

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,12 +359,12 @@ func catalogSourceRegistryPodSynced() func(catalog *operatorsv1alpha1.CatalogSou
state = connState.LastObservedState
}
if state != lastState {
fmt.Printf("waiting %s for catalog pod %s/%s to be available (for sync) - %s\n", time.Since(lastTime), catalog.GetNamespace(), catalog.GetName(), state)
ctx.Ctx().Logf("waiting %s for catalog pod %s/%s to be available (for sync) - %s\n", time.Since(lastTime), catalog.GetNamespace(), catalog.GetName(), state)
lastState = state
lastTime = time.Now()
}
if registry != nil && connState != nil && !connState.LastConnectTime.IsZero() && connState.LastObservedState == "READY" {
fmt.Printf("probing catalog %s pod with address %s\n", catalog.GetName(), registry.Address())
ctx.Ctx().Logf("probing catalog %s pod with address %s\n", catalog.GetName(), registry.Address())
return registryPodHealthy(registry.Address())
}
return false
Expand Down

0 comments on commit 73f61f9

Please sign in to comment.