From cfedcc7319865c149f7e6cd954b2b3e8d9bee03c Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Tue, 22 Nov 2022 18:56:27 +0200 Subject: [PATCH] add more sa primary util tests --- .../utils_primary_serviceAccount_test.yaml | 61 +++++++++++++++++-- 1 file changed, 56 insertions(+), 5 deletions(-) diff --git a/library/common-test/tests/utils/utils_primary_serviceAccount_test.yaml b/library/common-test/tests/utils/utils_primary_serviceAccount_test.yaml index 8fbebaa2fd..fe027b7e57 100644 --- a/library/common-test/tests/utils/utils_primary_serviceAccount_test.yaml +++ b/library/common-test/tests/utils/utils_primary_serviceAccount_test.yaml @@ -4,13 +4,11 @@ templates: - common.yaml tests: - it: should pass with default values - documentIndex: &serviceAccountDoc 0 asserts: - hasDocuments: count: 1 - it: should fail with more than 1 primary serviceAccounts - documentIndex: *serviceAccountDoc set: serviceAccount: main: @@ -24,17 +22,22 @@ tests: errorMessage: More than one serviceAccounts are set as primary. This is not supported. - it: should pass with no serviceAccount set as primary - documentIndex: *serviceAccountDoc + documentIndex: &serviceAccountDoc 0 set: serviceAccount: main: enabled: true primary: false asserts: + - hasDocuments: + count: 2 - isKind: of: ServiceAccount + - equal: + path: metadata.name + value: RELEASE-NAME-common-test - - it: should pass with main serviceAccount set as primary and other not + - it: should pass with main serviceAccount set as primary and other not (check name on main) documentIndex: *serviceAccountDoc set: serviceAccount: @@ -45,10 +48,34 @@ tests: enabled: true primary: false asserts: + - hasDocuments: + count: 3 - isKind: of: ServiceAccount + - equal: + path: metadata.name + value: RELEASE-NAME-common-test - - it: should pass with different serviceAccount set as primary + - it: should pass with main serviceAccount set as primary and other not (check name on other) + documentIndex: &otherServiceAccountDoc 1 + set: + serviceAccount: + main: + enabled: true + primary: true + other: + enabled: true + primary: false + asserts: + - hasDocuments: + count: 3 + - isKind: + of: ServiceAccount + - equal: + path: metadata.name + value: RELEASE-NAME-common-test-other + + - it: should pass with different serviceAccount set as primary (check name on main) documentIndex: *serviceAccountDoc set: serviceAccount: @@ -59,5 +86,29 @@ tests: enabled: true primary: true asserts: + - hasDocuments: + count: 3 - isKind: of: ServiceAccount + - equal: + path: metadata.name + value: RELEASE-NAME-common-test-main + + - it: should pass with different serviceAccount set as primary (check name on other) + documentIndex: *otherServiceAccountDoc + set: + serviceAccount: + main: + enabled: true + primary: false + other: + enabled: true + primary: true + asserts: + - hasDocuments: + count: 3 + - isKind: + of: ServiceAccount + - equal: + path: metadata.name + value: RELEASE-NAME-common-test