|
4 | 4 | "context" |
5 | 5 | "fmt" |
6 | 6 | "os" |
| 7 | + "slices" |
7 | 8 | "testing" |
8 | 9 | "time" |
9 | 10 |
|
@@ -197,7 +198,8 @@ func TestClusterExtensionInstallRegistryMultipleBundles(t *testing.T) { |
197 | 198 | t.Log("When a cluster extension is installed from a catalog") |
198 | 199 |
|
199 | 200 | clusterExtension, extensionCatalog, sa, ns := TestInit(t) |
200 | | - extraCatalog, err := CreateTestCatalog(context.Background(), "extra-test-catalog", os.Getenv(testCatalogRefEnvVar)) |
| 201 | + extraCatalogName := fmt.Sprintf("extra-test-catalog-%s", rand.String(8)) |
| 202 | + extraCatalog, err := CreateTestCatalog(context.Background(), extraCatalogName, os.Getenv(testCatalogRefEnvVar)) |
201 | 203 | require.NoError(t, err) |
202 | 204 |
|
203 | 205 | defer TestCleanup(t, extensionCatalog, clusterExtension, sa, ns) |
@@ -238,7 +240,11 @@ func TestClusterExtensionInstallRegistryMultipleBundles(t *testing.T) { |
238 | 240 | require.NotNil(ct, cond) |
239 | 241 | require.Equal(ct, metav1.ConditionTrue, cond.Status) |
240 | 242 | require.Equal(ct, ocv1.ReasonRetrying, cond.Reason) |
241 | | - require.Contains(ct, cond.Message, "in multiple catalogs with the same priority [extra-test-catalog test-catalog]") |
| 243 | + // Catalog names are sorted alphabetically in the error message |
| 244 | + catalogs := []string{extensionCatalog.Name, extraCatalog.Name} |
| 245 | + slices.Sort(catalogs) |
| 246 | + expectedMessage := fmt.Sprintf("in multiple catalogs with the same priority %v", catalogs) |
| 247 | + require.Contains(ct, cond.Message, expectedMessage) |
242 | 248 | }, pollDuration, pollInterval) |
243 | 249 | } |
244 | 250 |
|
@@ -441,7 +447,7 @@ func TestClusterExtensionInstallReResolvesWhenCatalogIsPatched(t *testing.T) { |
441 | 447 | // patch imageRef tag on test-catalog image with v2 image |
442 | 448 | t.Log("By patching the catalog ImageRef to point to the v2 catalog") |
443 | 449 | updatedCatalogImage := fmt.Sprintf("%s/e2e/test-catalog:v2", os.Getenv("CLUSTER_REGISTRY_HOST")) |
444 | | - err := patchTestCatalog(context.Background(), testCatalogName, updatedCatalogImage) |
| 450 | + err := patchTestCatalog(context.Background(), extensionCatalog.Name, updatedCatalogImage) |
445 | 451 | require.NoError(t, err) |
446 | 452 | require.EventuallyWithT(t, func(ct *assert.CollectT) { |
447 | 453 | require.NoError(ct, c.Get(context.Background(), types.NamespacedName{Name: extensionCatalog.Name}, extensionCatalog)) |
@@ -474,8 +480,9 @@ func TestClusterExtensionInstallReResolvesWhenNewCatalog(t *testing.T) { |
474 | 480 | require.NoError(t, err) |
475 | 481 |
|
476 | 482 | // create a test-catalog with latest image tag |
| 483 | + catalogName := fmt.Sprintf("test-catalog-%s", rand.String(8)) |
477 | 484 | latestCatalogImage := fmt.Sprintf("%s/e2e/test-catalog:latest", os.Getenv("CLUSTER_REGISTRY_HOST")) |
478 | | - extensionCatalog, err := CreateTestCatalog(context.Background(), testCatalogName, latestCatalogImage) |
| 485 | + extensionCatalog, err := CreateTestCatalog(context.Background(), catalogName, latestCatalogImage) |
479 | 486 | require.NoError(t, err) |
480 | 487 | clusterExtensionName := fmt.Sprintf("clusterextension-%s", rand.String(8)) |
481 | 488 | clusterExtension := &ocv1.ClusterExtension{ |
|
0 commit comments