Skip to content

Commit

Permalink
CLOUDP-284179: test/e2e/atlas: filter global kinds for certain e2e te…
Browse files Browse the repository at this point in the history
…sts (#3404)
  • Loading branch information
s-urbaniak authored Nov 22, 2024
1 parent b35fb30 commit 6af64d7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/e2e/atlas/kubernetes_config_generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -209,13 +213,30 @@ 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)
})
}
}

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{
Expand Down

0 comments on commit 6af64d7

Please sign in to comment.