diff --git a/test/e2e/atlas/kubernetes_config_generate_test.go b/test/e2e/atlas/kubernetes_config_generate_test.go index 3d7d5a0e9d..788e7ed232 100644 --- a/test/e2e/atlas/kubernetes_config_generate_test.go +++ b/test/e2e/atlas/kubernetes_config_generate_test.go @@ -54,6 +54,10 @@ const targetNamespace = "importer-namespace" const credSuffixTest = "-credentials" const activeStatus = "ACTIVE" +// These kinds represent global types in AKO which are independent of any Atlas Project. +// They can be filtered in concurrent e2e tests if they are not relevant for assertion. +var globalKinds = []string{"AtlasFederatedAuth"} + var federationSettingsID string var identityProviderStatus string var samlIdentityProviderID string @@ -209,6 +213,9 @@ func TestExportIndependentOrNot(t *testing.T) { require.NoError(t, err, string(resp)) var objects []runtime.Object objects, err = getK8SEntities(resp) + // We want to filter spurious federated auth resources from other tests + // as these are global resources across all projects. + objects = filtered(objects).byKind(globalKinds...) require.NoError(t, err, "should not fail on decode but got:\n"+string(resp)) require.NotEmpty(t, objects) require.Equal(t, tc.expected, objects) @@ -216,6 +223,20 @@ func TestExportIndependentOrNot(t *testing.T) { } } +type filtered []runtime.Object + +func (f filtered) byKind(kinds ...string) []runtime.Object { + result := f[:0] + for _, obj := range f { + for _, kind := range kinds { + if obj.GetObjectKind().GroupVersionKind().Kind != kind { + result = append(result, obj) + } + } + } + return result +} + func defaultTestProject(name, namespace string, labels map[string]string, alertConfigs bool) *akov2.AtlasProject { project := &akov2.AtlasProject{ TypeMeta: metav1.TypeMeta{