From 2bc78c39a46a0652acaa6945223523aaed92295b Mon Sep 17 00:00:00 2001 From: paladin-devops <83741749+paladin-devops@users.noreply.github.com> Date: Mon, 18 Nov 2024 14:57:38 -0500 Subject: [PATCH] wip --- registry_module_integration_test.go | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/registry_module_integration_test.go b/registry_module_integration_test.go index a2f92cfdc..6cb440343 100644 --- a/registry_module_integration_test.go +++ b/registry_module_integration_test.go @@ -31,10 +31,6 @@ func TestRegistryModulesList(t *testing.T) { registryModuleTest2, registryModuleTest2Cleanup := createRegistryModule(t, client, orgTest, PrivateRegistry) defer registryModuleTest2Cleanup() - newSubscriptionUpdater(orgTest).WithPlusEntitlementPlan().Update(t) - _, noCodeModuleCleanup := createNoCodeRegistryModule(t, client, orgTest.Name, registryModuleTest2, nil) - defer noCodeModuleCleanup() - t.Run("with no list options", func(t *testing.T) { modl, err := client.RegistryModules.List(ctx, orgTest.Name, &RegistryModuleListOptions{}) require.NoError(t, err) @@ -68,15 +64,28 @@ func TestRegistryModulesList(t *testing.T) { }) t.Run("include no-code modules", func(t *testing.T) { + registryModuleTest3, registryModuleTest3Cleanup := createRegistryModule(t, client, orgTest, PrivateRegistry) + defer registryModuleTest3Cleanup() + + newSubscriptionUpdater(orgTest).WithPlusEntitlementPlan().Update(t) + _, noCodeModuleCleanup := createNoCodeRegistryModule(t, client, orgTest.Name, registryModuleTest3, nil) + defer noCodeModuleCleanup() + modl, err := client.RegistryModules.List(ctx, orgTest.Name, &RegistryModuleListOptions{ Include: []RegistryModuleListIncludeOpt{ IncludeNoCodeModules, }, }) require.NoError(t, err) - assert.Len(t, modl.Items, 2) - assert.True(t, modl.Items[1].NoCode) - assert.Len(t, modl.Items[1].RegistryNoCodeModule, 1) + assert.Len(t, modl.Items, 3) + // only module 3 is no-code, so iterate through the results before + // the test assertion + for _, m := range modl.Items { + if m.ID == registryModuleTest2.ID { + assert.True(t, modl.Items[2].NoCode) + assert.Len(t, modl.Items[2].RegistryNoCodeModule, 1) + } + } }) }