Skip to content

Commit 6af64d7

Browse files
authored
CLOUDP-284179: test/e2e/atlas: filter global kinds for certain e2e tests (#3404)
1 parent b35fb30 commit 6af64d7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/e2e/atlas/kubernetes_config_generate_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ const targetNamespace = "importer-namespace"
5454
const credSuffixTest = "-credentials"
5555
const activeStatus = "ACTIVE"
5656

57+
// These kinds represent global types in AKO which are independent of any Atlas Project.
58+
// They can be filtered in concurrent e2e tests if they are not relevant for assertion.
59+
var globalKinds = []string{"AtlasFederatedAuth"}
60+
5761
var federationSettingsID string
5862
var identityProviderStatus string
5963
var samlIdentityProviderID string
@@ -209,13 +213,30 @@ func TestExportIndependentOrNot(t *testing.T) {
209213
require.NoError(t, err, string(resp))
210214
var objects []runtime.Object
211215
objects, err = getK8SEntities(resp)
216+
// We want to filter spurious federated auth resources from other tests
217+
// as these are global resources across all projects.
218+
objects = filtered(objects).byKind(globalKinds...)
212219
require.NoError(t, err, "should not fail on decode but got:\n"+string(resp))
213220
require.NotEmpty(t, objects)
214221
require.Equal(t, tc.expected, objects)
215222
})
216223
}
217224
}
218225

226+
type filtered []runtime.Object
227+
228+
func (f filtered) byKind(kinds ...string) []runtime.Object {
229+
result := f[:0]
230+
for _, obj := range f {
231+
for _, kind := range kinds {
232+
if obj.GetObjectKind().GroupVersionKind().Kind != kind {
233+
result = append(result, obj)
234+
}
235+
}
236+
}
237+
return result
238+
}
239+
219240
func defaultTestProject(name, namespace string, labels map[string]string, alertConfigs bool) *akov2.AtlasProject {
220241
project := &akov2.AtlasProject{
221242
TypeMeta: metav1.TypeMeta{

0 commit comments

Comments
 (0)