Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review the /tests_common folder first, at the end of this pr

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"features": {
"ghcr.io/devcontainers/features/docker-in-docker": {},
"ghcr.io/devcontainers/features/github-cli:1": {},
"ghcr.io/devcontainers/features/node:1": { "version": "22" },
"ghcr.io/devcontainers/features/node:1": { "version": "24" },
"ghcr.io/devcontainers/features/python:1": {},
"ghcr.io/devcontainers/features/sshd:1": {},
"ghcr.io/devcontainers-extra/features/kind:1": {},
Expand Down
17 changes: 0 additions & 17 deletions .github/scripts/end2end/configure-e2e-endpoints.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,21 +131,4 @@ if ! grep -q "backbeat-api.zenko.local" /etc/hosts 2>/dev/null; then
echo "127.0.0.1 ${ZENKO_HOSTS}" | sudo tee -a /etc/hosts
fi

# --- Export endpoint variables ---
# These use the ingress hostnames, reachable from outside the cluster.

export CLOUDSERVER_HOST="s3.zenko.local"
export CLOUDSERVER_ENDPOINT="http://s3.zenko.local"
export BACKBEAT_API_ENDPOINT="http://backbeat-api.zenko.local"
export VAULT_ENDPOINT="http://iam.zenko.local"
export VAULT_STS_ENDPOINT="http://sts.zenko.local"
export VAULT_AUTH_HOST="vault-auth.zenko.local"
export KAFKA_CONNECT_URL="http://kafka-connect.zenko.local/connectors"

echo "=== Endpoints configured for out-of-cluster access ==="
echo " S3: ${CLOUDSERVER_ENDPOINT}"
echo " Backbeat API: ${BACKBEAT_API_ENDPOINT}"
echo " Vault IAM: ${VAULT_ENDPOINT}"
echo " Vault STS: ${VAULT_STS_ENDPOINT}"
echo " Vault Auth: http://${VAULT_AUTH_HOST}"
echo " Kafka Connect: ${KAFKA_CONNECT_URL}"
99 changes: 2 additions & 97 deletions .github/scripts/end2end/setup-e2e-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ export MONGO_REPLICA_SET_HOSTS="localhost:${MONGO_PORT}"
# --- 5. Credentials from K8s secrets ---
export ADMIN_ACCESS_KEY_ID=$(kubectl get secret ${ZENKO_NAME}-management-vault-admin-creds.v1 -o jsonpath='{.data.accessKey}' | base64 -d)
export ADMIN_SECRET_ACCESS_KEY=$(kubectl get secret ${ZENKO_NAME}-management-vault-admin-creds.v1 -o jsonpath='{.data.secretKey}' | base64 -d)
export ZENKO_ACCESS_KEY=$(kubectl get secret ${ZENKO_NAME}-account-zenko -o jsonpath='{.data.AccessKeyId}' | base64 -d)
export ZENKO_SECRET_KEY=$(kubectl get secret ${ZENKO_NAME}-account-zenko -o jsonpath='{.data.SecretAccessKey}' | base64 -d)
export ZENKO_SESSION_TOKEN=$(kubectl get secret ${ZENKO_NAME}-account-zenko -o jsonpath='{.data.SessionToken}' | base64 -d)

# CRR account credentials
_src_secret="${ZENKO_NAME}-account-${CRR_SOURCE_ACCOUNT_NAME:-crr-source-account}"
Expand All @@ -72,11 +69,8 @@ export CRR_DESTINATION_INFO="{\"AccessKeyId\":\"${DESTINATION_ACCESS_KEY}\",\"Se
export KEYCLOAK_TEST_USER="${OIDC_USERNAME}-norights"
export KEYCLOAK_TEST_PASSWORD=${OIDC_PASSWORD}
export KEYCLOAK_TEST_HOST=${OIDC_ENDPOINT}
export KEYCLOAK_TEST_PORT="80"
export KEYCLOAK_TEST_REALM_NAME=${OIDC_REALM}
export KEYCLOAK_REALM=${OIDC_REALM} # cli-testing KeycloakSetup hook reads KEYCLOAK_REALM from env
export KEYCLOAK_TEST_CLIENT_ID=${OIDC_CLIENT_ID}
export KEYCLOAK_TEST_GRANT_TYPE="password"

# --- 7. Test backend env vars ---
export AWS_BACKEND_SOURCE_LOCATION AWS_BACKEND_DESTINATION_LOCATION
Expand Down Expand Up @@ -131,40 +125,8 @@ export TARGET_VERSION=$(sed -n 's/^VERSION="\([^"]*\)"/\1/p' "${ZENKO_ROOT}/VERS
if [ "${SKIP_CTST:-}" = "1" ]; then
echo "SKIP_CTST=1 set, skipping CTST-specific setup"
else
# CTST account & user names
export ZENKO_ACCOUNT_NAME="zenko-ctst"
export STORAGE_MANAGER_USER_NAME="storage_manager"
export STORAGE_ACCOUNT_OWNER_USER_NAME="storage_account_owner"
export DATA_CONSUMER_USER_NAME="data_consumer"
export DATA_ACCESSOR_USER_NAME="data_accessor"
# env vars used by cli-testing's Keycloak.ts seeder
export ACCOUNT="${ZENKO_ACCOUNT_NAME}"
export STORAGE_MANAGER="${STORAGE_MANAGER_USER_NAME}"
export STORAGE_ACCOUNT_OWNER="${STORAGE_ACCOUNT_OWNER_USER_NAME}"
export DATA_CONSUMER="${DATA_CONSUMER_USER_NAME}"
export DATA_ACCESSOR="${DATA_ACCESSOR_USER_NAME}"
export ACCOUNT="zenko-ctst"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some stuffs like this needs to stay here, they are used by cli-testing, or are coupled with other script/logic and can't be migrated easily without some other preliminary work

export SEED_KEYCLOAK_DEFAULT_ROLES=true
export ZENKO_PORT="80"

# PRA admin credentials (may not exist for non-PRA runs; ignore errors)
export ADMIN_PRA_ACCESS_KEY_ID=$(kubectl get secret ${ZENKO_NAME}-pra-management-vault-admin-creds.v1 -o jsonpath='{.data.accessKey}' 2>/dev/null | base64 -d 2>/dev/null || echo "")
export ADMIN_PRA_SECRET_ACCESS_KEY=$(kubectl get secret ${ZENKO_NAME}-pra-management-vault-admin-creds.v1 -o jsonpath='{.data.secretKey}' 2>/dev/null | base64 -d 2>/dev/null || echo "")

# --- 11. Service user credentials ---
BACKBEAT_LCBP_1_CREDS=$(kubectl get secret -l app.kubernetes.io/name=backbeat-lcbp-user-creds,app.kubernetes.io/instance=${ZENKO_NAME} -o jsonpath='{.items[0].data.backbeat-lifecycle-bp-1\.json}' | base64 -d)
BACKBEAT_LCC_1_CREDS=$(kubectl get secret -l app.kubernetes.io/name=backbeat-lcc-user-creds,app.kubernetes.io/instance=${ZENKO_NAME} -o jsonpath='{.items[0].data.backbeat-lifecycle-conductor-1\.json}' | base64 -d)
BACKBEAT_LCOP_1_CREDS=$(kubectl get secret -l app.kubernetes.io/name=backbeat-lcop-user-creds,app.kubernetes.io/instance=${ZENKO_NAME} -o jsonpath='{.items[0].data.backbeat-lifecycle-op-1\.json}' | base64 -d)
BACKBEAT_QP_1_CREDS=$(kubectl get secret -l app.kubernetes.io/name=backbeat-qp-user-creds,app.kubernetes.io/instance=${ZENKO_NAME} -o jsonpath='{.items[0].data.backbeat-qp-1\.json}' | base64 -d)
SORBET_FWD_2_ACCESSKEY=$(kubectl get secret -l app.kubernetes.io/name=sorbet-fwd-creds,app.kubernetes.io/instance=${ZENKO_NAME} -o jsonpath='{.items[0].data.accessKey}' | base64 -d)
SORBET_FWD_2_SECRETKEY=$(kubectl get secret -l app.kubernetes.io/name=sorbet-fwd-creds,app.kubernetes.io/instance=${ZENKO_NAME} -o jsonpath='{.items[0].data.secretKey}' | base64 -d)
export SERVICE_USERS_CREDENTIALS=$(echo '{"backbeat-lifecycle-bp-1":'"${BACKBEAT_LCBP_1_CREDS}"',"backbeat-lifecycle-conductor-1":'"${BACKBEAT_LCC_1_CREDS}"',"backbeat-lifecycle-op-1":'"${BACKBEAT_LCOP_1_CREDS}"',"backbeat-qp-1":'"${BACKBEAT_QP_1_CREDS}"',"sorbet-fwd-2":{"accessKey":"'"${SORBET_FWD_2_ACCESSKEY}"'","secretKey":"'"${SORBET_FWD_2_SECRETKEY}"'"}}' | jq -R)

# --- 12. Kafka topics for sorbet ---
SORBET_CONFIG=$(kubectl get secret -l app.kubernetes.io/name=cold-sorbet-config-e2e-azure-archive,app.kubernetes.io/instance=${ZENKO_NAME} \
-o jsonpath='{.items[0].data.config\.json}' | base64 -di)
export KAFKA_DEAD_LETTER_TOPIC=$(echo "${SORBET_CONFIG}" | jq -r '."kafka-dead-letter-topic"')
export KAFKA_OBJECT_TASK_TOPIC=$(echo "${SORBET_CONFIG}" | jq -r '."kafka-object-task-topic"')
export KAFKA_GC_REQUEST_TOPIC=$(echo "${SORBET_CONFIG}" | jq -r '."kafka-gc-request-topic"')

# --- 13. Kafka host from backbeat config + port-forward ---
KAFKA_HOST_PORT_ORIG=$(kubectl get secret -l app.kubernetes.io/name=backbeat-config,app.kubernetes.io/instance=${ZENKO_NAME} \
Expand Down Expand Up @@ -235,23 +197,7 @@ else
fi
export PROMETHEUS_SERVICE="${PROMETHEUS_SVC}.${NAMESPACE}.svc.cluster.local"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be dynamically retrieved as well?
there is most likely a single prometheus service in the cluster: we could find it by labels ("managed by prometheus operator") or checking the prometheus CR...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are multiple values we can load that I didn't add yet
My problem is, for PROMETHEUS_SERVICE for example, its built from PROMETHEUS_SVC, but PROMETHEUS_SVC is used right before that to do the port forward. So If I move PROMETHEUS_SERVICE to the ts code, I still need to have it defined in the sh script and then we have the same variable defined in 2 places. Best is to keep it here for now, as you said later we should be able to do the port forward from the node code so we can do it here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please create followup ticket


# --- 14. Zenko CR metadata ---
export TIME_PROGRESSION_FACTOR=$(kubectl get zenko ${ZENKO_NAME} -o jsonpath="{.metadata.annotations.zenko\.io/time-progression-factor}")
export INSTANCE_ID=$(kubectl get zenko ${ZENKO_NAME} -o jsonpath='{.status.instanceID}')
export KAFKA_CLEANER_INTERVAL=$(kubectl get zenko ${ZENKO_NAME} -o jsonpath='{.spec.kafkaCleaner.interval}')
export SORBETD_RESTORE_TIMEOUT=$(kubectl get zenko ${ZENKO_NAME} -o jsonpath='{.spec.sorbet.server.azure.restoreTimeout}')

# Backbeat API (use ingress — already exported as BACKBEAT_API_ENDPOINT)
export BACKBEAT_API_HOST="backbeat-api.zenko.local"
export BACKBEAT_API_PORT="80"

# Utilization service
export UTILIZATION_SERVICE_HOST=$(kubectl get zenko ${ZENKO_NAME} -o jsonpath='{.spec.scuba.api.ingress.hostname}')
export UTILIZATION_SERVICE_PORT="80"

# Azure archive settings
export AZURE_ARCHIVE_ACCESS_TIER="Hot"
export AZURE_ARCHIVE_MANIFEST_ACCESS_TIER="Hot"
export AZURE_BLOB_URL="${AZURE_BACKEND_ENDPOINT}"
export AZURE_QUEUE_URL="${AZURE_BACKEND_QUEUE_ENDPOINT}"

Expand Down Expand Up @@ -286,11 +232,7 @@ else
"subdomain":"${SUBDOMAIN}",
"DRSubdomain":"${DR_SUBDOMAIN:-}",
"ssl":false,
"port":"${ZENKO_PORT}",
"AccountName":"${ZENKO_ACCOUNT_NAME}",
"AdminAccessKey":"${ADMIN_ACCESS_KEY_ID}",
"AdminSecretKey":"${ADMIN_SECRET_ACCESS_KEY}",
"VaultAuthHost":"${VAULT_AUTH_HOST}",
"port":"80",
"NotificationDestination":"${NOTIF_DEST_NAME}",
"NotificationDestinationTopic":"${NOTIF_DEST_TOPIC}",
"NotificationDestinationAlt":"${NOTIF_ALT_DEST_NAME}",
Expand All @@ -304,40 +246,16 @@ else
"PrometheusEndpoint":"http://localhost:${PROMETHEUS_PORT}",
"KafkaHosts":"${KAFKA_HOST_PORT}",
"KafkaAuthHosts":"${KAFKA_AUTH_HOST_PORT}",
"KafkaConnectUrl":"${KAFKA_CONNECT_URL}",
"KeycloakUsername":"${OIDC_USERNAME}",
"KeycloakPassword":"${OIDC_PASSWORD}",
"KeycloakTestPassword":"${KEYCLOAK_TEST_PASSWORD}",
"KeycloakHost":"${OIDC_HOST}",
"KeycloakPort":"${KEYCLOAK_TEST_PORT}",
"KeycloakRealm":"${KEYCLOAK_TEST_REALM_NAME}",
"KeycloakClientId":"${KEYCLOAK_TEST_CLIENT_ID}",
"KeycloakGrantType":"${KEYCLOAK_TEST_GRANT_TYPE}",
"StorageManagerUsername":"${STORAGE_MANAGER_USER_NAME}",
"StorageAccountOwnerUsername":"${STORAGE_ACCOUNT_OWNER_USER_NAME}",
"DataConsumerUsername":"${DATA_CONSUMER_USER_NAME}",
"DataAccessorUsername":"${DATA_ACCESSOR_USER_NAME}",
"ServiceUsersCredentials":${SERVICE_USERS_CREDENTIALS},
"AzureAccountName":"${AZURE_ACCOUNT_NAME}",
"AzureAccountKey":"${AZURE_SECRET_KEY}",
"AzureArchiveContainer":"${AZURE_ARCHIVE_BUCKET_NAME}",
"AzureArchiveContainer2":"${AZURE_ARCHIVE_BUCKET_NAME_2:-}",
"AzureArchiveAccessTier":"${AZURE_ARCHIVE_ACCESS_TIER}",
"AzureArchiveManifestTier":"${AZURE_ARCHIVE_MANIFEST_ACCESS_TIER}",
"AzureArchiveQueue":"${AZURE_ARCHIVE_QUEUE_NAME:-}",
"TimeProgressionFactor":"${TIME_PROGRESSION_FACTOR}",
"KafkaObjectTaskTopic":"${KAFKA_OBJECT_TASK_TOPIC}",
"KafkaGCRequestTopic":"${KAFKA_GC_REQUEST_TOPIC}",
"KafkaDeadLetterQueueTopic":"${KAFKA_DEAD_LETTER_TOPIC}",
"InstanceID":"${INSTANCE_ID}",
"BackbeatApiHost":"${BACKBEAT_API_HOST}",
"BackbeatApiPort":"${BACKBEAT_API_PORT}",
"KafkaCleanerInterval":"${KAFKA_CLEANER_INTERVAL}",
"SorbetdRestoreTimeout":"${SORBETD_RESTORE_TIMEOUT}",
"DRAdminAccessKey":"${ADMIN_PRA_ACCESS_KEY_ID}",
"DRAdminSecretKey":"${ADMIN_PRA_SECRET_ACCESS_KEY}",
"UtilizationServiceHost":"${UTILIZATION_SERVICE_HOST}",
"UtilizationServicePort":"${UTILIZATION_SERVICE_PORT}",
"KubeconfigPath":"${KUBECONFIG:-${HOME}/.kube/config}"
}
EOF
Expand All @@ -358,24 +276,11 @@ if [ -n "${GITHUB_ENV:-}" ]; then # Don't do it for Codespace
echo "MONGO_AUTH_PASSWORD=$MONGO_AUTH_PASSWORD" >> "$GITHUB_ENV"
echo "ADMIN_ACCESS_KEY_ID=$ADMIN_ACCESS_KEY_ID" >> "$GITHUB_ENV"
echo "ADMIN_SECRET_ACCESS_KEY=$ADMIN_SECRET_ACCESS_KEY" >> "$GITHUB_ENV"
echo "ZENKO_ACCESS_KEY=$ZENKO_ACCESS_KEY" >> "$GITHUB_ENV"
echo "ZENKO_SECRET_KEY=$ZENKO_SECRET_KEY" >> "$GITHUB_ENV"
echo "ZENKO_SESSION_TOKEN=$ZENKO_SESSION_TOKEN" >> "$GITHUB_ENV"
echo "KEYCLOAK_TEST_USER=$KEYCLOAK_TEST_USER" >> "$GITHUB_ENV"
echo "KEYCLOAK_TEST_PASSWORD=$KEYCLOAK_TEST_PASSWORD" >> "$GITHUB_ENV"
echo "KEYCLOAK_TEST_HOST=$KEYCLOAK_TEST_HOST" >> "$GITHUB_ENV"
echo "KEYCLOAK_TEST_PORT=$KEYCLOAK_TEST_PORT" >> "$GITHUB_ENV"
echo "KEYCLOAK_TEST_REALM_NAME=$KEYCLOAK_TEST_REALM_NAME" >> "$GITHUB_ENV"
echo "KEYCLOAK_REALM=$KEYCLOAK_REALM" >> "$GITHUB_ENV"
echo "KEYCLOAK_TEST_CLIENT_ID=$KEYCLOAK_TEST_CLIENT_ID" >> "$GITHUB_ENV"
echo "KEYCLOAK_TEST_GRANT_TYPE=$KEYCLOAK_TEST_GRANT_TYPE" >> "$GITHUB_ENV"
echo "CLOUDSERVER_HOST=$CLOUDSERVER_HOST" >> "$GITHUB_ENV"
echo "CLOUDSERVER_ENDPOINT=$CLOUDSERVER_ENDPOINT" >> "$GITHUB_ENV"
echo "BACKBEAT_API_ENDPOINT=$BACKBEAT_API_ENDPOINT" >> "$GITHUB_ENV"
echo "VAULT_ENDPOINT=$VAULT_ENDPOINT" >> "$GITHUB_ENV"
echo "VAULT_STS_ENDPOINT=$VAULT_STS_ENDPOINT" >> "$GITHUB_ENV"
echo "VAULT_AUTH_HOST=$VAULT_AUTH_HOST" >> "$GITHUB_ENV"
echo "KAFKA_CONNECT_URL=$KAFKA_CONNECT_URL" >> "$GITHUB_ENV"
echo "NODE_EXTRA_CA_CERTS=$NODE_EXTRA_CA_CERTS" >> "$GITHUB_ENV"
echo "MOCHA_FILE=$MOCHA_FILE" >> "$GITHUB_ENV"
echo "VERIFY_CERTIFICATES=$VERIFY_CERTIFICATES" >> "$GITHUB_ENV"
Expand Down
12 changes: 6 additions & 6 deletions tests/functional/ctst/common/common.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ListObjectVersionsOutput } from '@aws-sdk/client-s3';
import { Given, setDefaultTimeout, Then, When } from '@cucumber/cucumber';
import { CacheHelper, Constants, Identity, IdentityEnum, S3, Utils } from 'cli-testing';
import { config, ZENKO_ACCOUNT_NAME } from 'tests_common/configuration';
import Zenko from 'world/Zenko';
import { parseGoDuration, safeJsonParse } from './utils';
import assert from 'assert';
Expand Down Expand Up @@ -39,8 +40,7 @@ export async function cleanS3Bucket(
// Do not try to clean a bucket with compliance retention
return;
}
Identity.useIdentity(IdentityEnum.ACCOUNT, world.getSaved<string>('accountName') ||
world.parameters.AccountName);
Identity.useIdentity(IdentityEnum.ACCOUNT, world.getSaved<string>('accountName') || ZENKO_ACCOUNT_NAME);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you'll see a lot of similar changes like this in the pr :
I'm removing ambiguity as much as possible when it is not used and not useful

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of updating code all over the place, should we not initialize the world (why drop support for world.parameters) once on startup?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current world parameters is currently automatically loaded from the --world-parameters json value.
The new type I added loads value with a kubernete client

Do you mean that you would prefer all the parameters staying in the ZenkoWorldParameters ? I think it's possible but may introduce some other complexities (the world is recreated before each scenario in a Before hook, with Zenko.init), + I want the new TestParameters to be usable with any tests suite, and I don't like the --world-parameters so much (only strings allowed, need to define values in bash script) so i want to avoid ultimately have everything in the new TestParameters interface

@francoisferrand francoisferrand May 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean parameters should be a World -i.e. Zenko-, as it is the standard way to define the environment for cucumber tests.

We may keep parameters in ZenkoWorldParameters, or possibly remove/tweak some; and use the new "config" lib to initialize the Zenko world instance. But IMHO there should not be coupling between tests and the config lib: should be handled through the world.

world.resetCommand();
world.addCommandParameter({ bucket: bucketName });
const createdObjects = world.getCreatedObjects();
Expand Down Expand Up @@ -143,14 +143,14 @@ async function createBucket(world: Zenko, versioning: string, bucketName: string

Given('a {string} bucket with dot', async function (this: Zenko, versioning: string) {
const preName = this.getSaved<string>('accountName') ||
this.parameters.AccountName || Constants.ACCOUNT_NAME;
ZENKO_ACCOUNT_NAME;
await createBucket(this, versioning,
`${preName}.${Constants.BUCKET_NAME_TEST}${Utils.randomString()}`.toLocaleLowerCase());
});

Given('a {string} bucket', async function (this: Zenko, versioning: string) {
const preName = this.getSaved<string>('accountName') ||
this.parameters.AccountName || Constants.ACCOUNT_NAME;
ZENKO_ACCOUNT_NAME;
await createBucket(this, versioning,
`${preName}${Constants.BUCKET_NAME_TEST}${Utils.randomString()}`.toLocaleLowerCase());
});
Expand Down Expand Up @@ -310,7 +310,7 @@ Then('i {string} be able to add user metadata to object {string}',

Then('kafka consumed messages should not take too much place on disk', { timeout: -1 },
async function (this: Zenko) {
const kfkcIntervalSeconds = parseGoDuration(this.parameters.KafkaCleanerInterval);
const kfkcIntervalSeconds = parseGoDuration(config.ZenkoCR.KafkaCleanerInterval);
const checkInterval = kfkcIntervalSeconds * 1000;
const deadline = Date.now() + checkInterval * 3;

Expand All @@ -321,7 +321,7 @@ Then('kafka consumed messages should not take too much place on disk', { timeout

try {
const excludedTopics = ['dead-letter', 'backbeat-metrics'];
const prefix = `${this.parameters.InstanceID}.`;
const prefix = `${config.ZenkoCR.InstanceID}.`;
const allTopics = await kafkaAdmin.listTopics();
const topics: string[] = allTopics
.filter(t => t.startsWith(prefix) &&
Expand Down
9 changes: 8 additions & 1 deletion tests/functional/ctst/common/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
} from '@cucumber/cucumber';
import Zenko from '../world/Zenko';
import { CacheHelper, Identity, WorkCoordination } from 'cli-testing';
import { config, initConfig } from 'tests_common/configuration';
import { prepareQuotaScenarios, teardownQuotaScenarios } from 'steps/quotas/quotas';
import { prepareUtilizationScenarios } from 'steps/utilization/utilizationAPI';
import { prepareMetricsScenarios } from './utils';
Expand All @@ -21,6 +22,12 @@
import { createKubeCustomObjectClient, waitForZenkoToStabilize } from 'steps/utils/kubernetes';
import { startDLQConsumer, stopDLQConsumer } from 'steps/utils/kafka';

BeforeAll(async function () {

Check warning on line 25 in tests/functional/ctst/common/hooks.ts

View workflow job for this annotation

GitHub Actions / lint-functional-tests

Unexpected function expression
// Some hooks are defined in cli-testing and use the configuration,
// we need to have this run before anything else
await initConfig();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we need to init config anyway : best initialize the world, which is the CTST (or even cucumber?) concept to hold such configuration

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I explored a bit the best strategy to deal with this config initialization, but I think here is the best place to do it.
The World class is created for each scenario, the constructor of the world can't be asynchronous, so its a bit tricky to do this initialization in the world constructor or as a static config.
BeforeAll is run once per worker, before the world creation, and before pretty much everything since its the first beforeAll, so the config is loaded once and available everywhere

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so World constructor will be called after config is init, and can used the config directly?

});

import 'cli-testing/hooks/KeycloakSetup';
import 'cli-testing/hooks/Logger';
import 'cli-testing/hooks/versionTags';
Expand All @@ -43,15 +50,15 @@

setParallelCanAssign(noParallelRun);

BeforeAll(async function () {

Check warning on line 53 in tests/functional/ctst/common/hooks.ts

View workflow job for this annotation

GitHub Actions / lint-functional-tests

Unexpected function expression
const kafkaHosts = process.env['KAFKA_HOST_PORT'];
const dlqTopic = process.env['KAFKA_DEAD_LETTER_TOPIC'];
const dlqTopic = config.KafkaTopics.DeadLetterQueue;
if (kafkaHosts && dlqTopic) {
await startDLQConsumer(kafkaHosts, dlqTopic, Zenko.addToDLQBuffer);
}
});

AfterAll(async function () {

Check warning on line 61 in tests/functional/ctst/common/hooks.ts

View workflow job for this annotation

GitHub Actions / lint-functional-tests

Unexpected function expression
await stopDLQConsumer();
});

Expand Down
Loading
Loading