Skip to content

Commit 5343b4c

Browse files
committed
pass crr location details to tests
Issue: ZENKO-5069
1 parent 1635479 commit 5343b4c

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

.github/scripts/end2end/run-e2e-test.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ ADMIN_SECRET_ACCESS_KEY=$(kubectl get secret end2end-management-vault-admin-cred
3737
ZENKO_ACCESS_KEY=$(kubectl get secret end2end-account-zenko -o jsonpath='{.data.AccessKeyId}' | base64 -d)
3838
ZENKO_SECRET_KEY=$(kubectl get secret end2end-account-zenko -o jsonpath='{.data.SecretAccessKey}' | base64 -d)
3939
ZENKO_SESSION_TOKEN=$(kubectl get secret end2end-account-zenko -o jsonpath='{.data.SessionToken}' | base64 -d)
40+
SOURCE_ACCESS_KEY=$(kubectl get secret "end2end-account-${CRR_SOURCE_ACCOUNT_NAME}" -o jsonpath='{.data.AccessKeyId}' | base64 -d)
41+
SOURCE_SECRET_KEY=$(kubectl get secret "end2end-account-${CRR_SOURCE_ACCOUNT_NAME}" -o jsonpath='{.data.SecretAccessKey}' | base64 -d)
42+
SOURCE_SESSION_TOKEN=$(kubectl get secret "end2end-account-${CRR_SOURCE_ACCOUNT_NAME}" -o jsonpath='{.data.SessionToken}' | base64 -d)
43+
SOURCE_ACCOUNT_ID=$(kubectl get secret "end2end-account-${CRR_SOURCE_ACCOUNT_NAME}" -o jsonpath='{.data.AccountId}' | base64 -d)
44+
CRR_SOURCE_INFO="{\"AccessKeyId\":\"${SOURCE_ACCESS_KEY}\",\"SecretAccessKey\":\"${SOURCE_SECRET_KEY}\",\"SessionToken\":\"${SOURCE_SESSION_TOKEN}\",\"AccountId\":\"${SOURCE_ACCOUNT_ID}\"}"
45+
DESTINATION_ACCESS_KEY=$(kubectl get secret "end2end-account-${CRR_DESTINATION_ACCOUNT_NAME}" -o jsonpath='{.data.AccessKeyId}' | base64 -d)
46+
DESTINATION_SECRET_KEY=$(kubectl get secret "end2end-account-${CRR_DESTINATION_ACCOUNT_NAME}" -o jsonpath='{.data.SecretAccessKey}' | base64 -d)
47+
DESTINATION_SESSION_TOKEN=$(kubectl get secret "end2end-account-${CRR_DESTINATION_ACCOUNT_NAME}" -o jsonpath='{.data.SessionToken}' | base64 -d)
48+
DESTINATION_ACCOUNT_ID=$(kubectl get secret "end2end-account-${CRR_DESTINATION_ACCOUNT_NAME}" -o jsonpath='{.data.AccountId}' | base64 -d)
49+
CRR_DESTINATION_INFO="{\"AccessKeyId\":\"${DESTINATION_ACCESS_KEY}\",\"SecretAccessKey\":\"${DESTINATION_SECRET_KEY}\",\"SessionToken\":\"${DESTINATION_SESSION_TOKEN}\",\"AccountId\":\"${DESTINATION_ACCOUNT_ID}\"}"
4050
OIDC_FULLNAME="${OIDC_FIRST_NAME} ${OIDC_LAST_NAME}"
4151
KEYCLOAK_TEST_USER="${OIDC_USERNAME}-norights"
4252
KEYCLOAK_TEST_PASSWORD=${OIDC_PASSWORD}
@@ -125,6 +135,11 @@ run_e2e_test() {
125135
--env=MONGO_WRITE_CONCERN=${MONGO_WRITE_CONCERN} \
126136
--env=MONGO_AUTH_USERNAME=${MONGO_AUTH_USERNAME} \
127137
--env=MONGO_AUTH_PASSWORD=${MONGO_AUTH_PASSWORD} \
138+
--env=CRR_SOURCE_LOCATION_NAME=${CRR_SOURCE_LOCATION_NAME} \
139+
--env=CRR_SOURCE_INFO=${CRR_SOURCE_INFO} \
140+
--env=CRR_DESTINATION_LOCATION_NAME=${CRR_DESTINATION_LOCATION_NAME} \
141+
--env=CRR_DESTINATION_INFO=${CRR_DESTINATION_INFO} \
142+
--env=CRR_ROLE_NAME=${CRR_ROLE_NAME} \
128143
--env=MOCHA_FILE=${MOCHA_FILE} \
129144
--override-type strategic \
130145
--overrides='

tests/zenko_tests/e2e_config/accounts.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ def get_credentials(token, account_id):
3131
return res
3232

3333

34-
def create_account_secret(name, credentials, namespace="default"):
34+
def create_account_secret(name, credentials, account_id, namespace="default"):
3535
"""
3636
Create a k8s secret resource for account
3737
3838
:param name: secret name
3939
:param credentials: sts assume role credentials
40+
:param account_id: account id
4041
:param namespace: k8s namespace
4142
"""
4243
_log.info("creating account secret")
@@ -50,7 +51,12 @@ def create_account_secret(name, credentials, namespace="default"):
5051
"type": "end2end",
5152
},
5253
),
53-
string_data=credentials,
54+
string_data={
55+
"AccessKeyId": credentials["AccessKeyId"],
56+
"SecretAccessKey": credentials["SecretAccessKey"],
57+
"SessionToken": credentials["SessionToken"],
58+
"AccountId": account_id,
59+
},
5460
)
5561

5662
try:
@@ -88,6 +94,7 @@ def create_account(client, token, uuid, account_name, namespace="default"):
8894
creds = get_credentials(token, res.id)
8995
create_account_secret(name="end2end-account-%s" % (res.userName),
9096
credentials=creds["Credentials"],
97+
account_id=res.id,
9198
namespace=namespace)
9299

93100
_log.info("created account")

0 commit comments

Comments
 (0)