Skip to content

Commit fd9da70

Browse files
wip
1 parent 01e4c8a commit fd9da70

29 files changed

+81
-5890
lines changed

.github/workflows/end2end.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,11 +517,24 @@ jobs:
517517
ZENKO_NAME: "${{ env.ZENKO_NAME }}-pra"
518518
SETUP_IMAGE: ${{ needs.build-setup-image.outputs.image }}
519519
GIT_ACCESS_TOKEN: ${{ steps.app-token.outputs.token }}
520-
run: ./setup-tests.sh --kubeconfig ~/.kube/config -- all --no-kafka-topics --no-rbac --no-dns --no-mocks --no-metadata
520+
run: ./setup-tests.sh --kubeconfig ~/.kube/config -- setup --locations --accounts --workflows --notifications
521521
working-directory: ./tests/@setup
522522
- name: Configure hosts file
523523
run: bash configure-hosts.sh
524524
working-directory: ./.github/scripts/end2end
525+
- name: Dump setup state for PRIMARY instance
526+
run: bash dump-setup-state.sh default end2end > /tmp/v2-primary-dump.txt 2>&1
527+
working-directory: ./.github/scripts/end2end
528+
continue-on-error: true
529+
- name: Dump setup state for PRA instance
530+
run: bash dump-setup-state.sh default end2end-pra > /tmp/v2-pra-dump.txt 2>&1
531+
working-directory: ./.github/scripts/end2end
532+
continue-on-error: true
533+
- name: Show diagnostic dumps
534+
run: |
535+
echo "=== PRIMARY INSTANCE DUMP ===" && cat /tmp/v2-primary-dump.txt
536+
echo "=== PRA INSTANCE DUMP ===" && cat /tmp/v2-pra-dump.txt
537+
continue-on-error: true
525538
- name: Run CTST end to end tests
526539
env:
527540
E2E_CTST_IMAGE: ${{ env.E2E_CTST_IMAGE_NAME }}:${{ env.E2E_IMAGE_TAG }}
@@ -727,6 +740,13 @@ jobs:
727740
- name: Configure hosts file
728741
run: bash configure-hosts.sh
729742
working-directory: ./.github/scripts/end2end
743+
- name: Dump setup state before tests
744+
run: bash dump-setup-state.sh default end2end > /tmp/v2-ctst-sharded-dump.txt 2>&1
745+
working-directory: ./.github/scripts/end2end
746+
continue-on-error: true
747+
- name: Show diagnostic dump
748+
run: cat /tmp/v2-ctst-sharded-dump.txt
749+
continue-on-error: true
730750
- name: Run CTST end to end tests
731751
env:
732752
E2E_CTST_IMAGE: ${{ env.E2E_CTST_IMAGE_NAME }}:${{ env.E2E_IMAGE_TAG }}

tests/@setup/src/cli.ts

Lines changed: 10 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,25 @@ program
4040

4141
program
4242
.command('all')
43-
.description('Run complete setup (all tasks, use --no-<task> to exclude specific tasks)')
43+
.description('Run complete setup (all tasks)')
4444
.option('--config <path>', 'Path to setup configuration file')
4545
.option('--workflows-config <path>', 'Path to workflows configuration file')
4646
.option('--locations-config <path>', 'Path to locations configuration file')
4747
.option('--git-access-token <token>', 'Git access token for metadata repository')
4848
.option('--metadata-namespace <namespace>', 'Metadata service namespace', 'metadata')
49-
.option('--no-rbac', 'Skip RBAC setup')
50-
.option('--no-dns', 'Skip DNS setup')
51-
.option('--no-mocks', 'Skip mock services setup')
52-
.option('--no-locations', 'Skip storage locations setup')
53-
.option('--no-accounts', 'Skip accounts setup')
54-
.option('--no-workflows', 'Skip workflows setup')
55-
.option('--no-metadata', 'Skip Metadata service setup')
56-
.option('--no-kafka-topics', 'Skip Kafka topics setup')
57-
.option('--no-notifications', 'Skip notifications setup')
5849
.action(async (options) => {
5950
const globalOptions = program.opts();
6051
await runSetup({
6152
...globalOptions,
62-
rbac: !options.noRbac,
63-
dns: !options.noDns,
64-
mocks: !options.noMocks,
65-
locations: !options.noLocations,
66-
accounts: !options.noAccounts,
67-
workflows: !options.noWorkflows,
68-
metadata: !options.noMetadata,
69-
kafkaTopics: !options.noKafkaTopics,
70-
notifications: !options.noNotifications,
71-
ctstLocal: !options.noCtstLocal,
53+
rbac: true,
54+
dns: true,
55+
mocks: true,
56+
locations: true,
57+
accounts: true,
58+
workflows: true,
59+
metadata: true,
60+
kafkaTopics: true,
61+
notifications: true,
7262
configFile: options.config,
7363
workflowsConfig: options.workflowsConfig,
7464
locationsConfig: options.locationsConfig,
@@ -331,9 +321,6 @@ async function runSetup(options: any) {
331321
if (options.accounts) {
332322
tasks.push({
333323
name: 'Accounts', fn: async () => {
334-
if (!setupFlags.dns) {
335-
throw new Error('DNS setup is required before accounts setup');
336-
}
337324
await setupAccounts({
338325
namespace: options.namespace,
339326
accounts: options.accounts === true ? undefined : options.accounts, // Allow array of account names
@@ -346,12 +333,6 @@ async function runSetup(options: any) {
346333
if (options.locations) {
347334
tasks.push({
348335
name: 'Storage Locations', fn: async () => {
349-
if (!setupFlags.dns) {
350-
throw new Error('DNS setup is required before locations setup');
351-
}
352-
if (!setupFlags.accounts) {
353-
throw new Error('Accounts setup is required before locations setup');
354-
}
355336
await setupLocations({
356337
namespace: options.namespace,
357338
subdomain: options.subdomain,
@@ -370,9 +351,6 @@ async function runSetup(options: any) {
370351
}
371352
tasks.push({
372353
name: 'Workflows', fn: async () => {
373-
if (!setupFlags.locations) {
374-
throw new Error('Locations setup is required before workflows setup');
375-
}
376354
await setupWorkflows({
377355
namespace: options.namespace,
378356
configFile: options.workflowsConfig,
@@ -390,9 +368,6 @@ async function runSetup(options: any) {
390368
}
391369
tasks.push({
392370
name: 'Kafka Topics', fn: async () => {
393-
if (!setupFlags.locations) {
394-
throw new Error('Locations setup is required before Kafka topics setup');
395-
}
396371
await setupKafkaTopics({
397372
namespace: options.namespace,
398373
zenkoName: options.zenkoName,
@@ -408,9 +383,6 @@ async function runSetup(options: any) {
408383
}
409384
tasks.push({
410385
name: 'Notifications', fn: async () => {
411-
if (!setupFlags.locations) {
412-
throw new Error('Locations setup is required before notifications setup');
413-
}
414386
await setupNotifications({
415387
namespace: options.namespace,
416388
configFile: options.notificationsConfig,

tests/@setup/src/mocks.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,26 @@ function replaceTemplateVariables(content: string, substitutions: Record<string,
7979
return result;
8080
}
8181

82+
/**
83+
* Check if a pod already exists
84+
* @param podName - Name of the pod
85+
* @param namespace - Namespace of the pod
86+
* @returns true if pod exists, false otherwise
87+
*/
88+
async function podExists(podName: string, namespace: string): Promise<boolean> {
89+
const core = KubernetesHelper.getClientCore();
90+
if (!core) {
91+
throw new Error('KubernetesHelper not initialized');
92+
}
93+
94+
try {
95+
await core.readNamespacedPod({ name: podName, namespace });
96+
return true;
97+
} catch (error: any) {
98+
return false;
99+
}
100+
}
101+
82102
/**
83103
* Load and apply a multi-document YAML manifest with template substitution
84104
* @param yamlPath - Path to the YAML file (can contain multiple documents separated by ---)
@@ -113,7 +133,11 @@ async function applyYamlManifests(yamlPath: string, substitutions: Record<string
113133
await KubernetesHelper.applyService(manifest, namespace);
114134
break;
115135
case 'Pod':
116-
await KubernetesHelper.applyPod(manifest, namespace);
136+
if (await podExists(name, namespace)) {
137+
logger.warn(`Pod ${name} already exists, skipping creation`);
138+
} else {
139+
await KubernetesHelper.applyPod(manifest, namespace);
140+
}
117141
break;
118142
case 'Ingress':
119143
await KubernetesHelper.applyIngress(manifest, namespace);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@Diagnostics
2+
Feature: Diagnostic dumps for debugging setup issues
3+
4+
@2.6.0
5+
@PreMerge
6+
@DiagnosticDump
7+
Scenario: Dump complete CTST world state
8+
Given DIAGNOSTIC: dump complete world state
9+

tests/ctst/features/CountItems/CountItems.feature

Lines changed: 0 additions & 13 deletions
This file was deleted.

tests/ctst/features/README.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)