Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ spec:
},
"owner": "obs",
"product": "ocp",
"timeout": "1h30m0s",
"timeout": "3h0m0s",
"version": "4.22"
}
runAfter:
Expand Down
4 changes: 2 additions & 2 deletions tests/support/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ data: {"event": "end", "data": {"referenced_documents": [], "truncated": false}}

type Attachment = { attachment_type: string; content_type: string };

export const oc = (args: string[]): string =>
export const oc = (args: string[], timeout = 180_000): string =>
execFileSync('oc', [...args, '--kubeconfig', process.env.KUBECONFIG_PATH!], {
encoding: 'utf-8',
timeout: 180_000,
timeout,
});

const ARTIFACTS_DIR = './gui_test_screenshots/artifacts';
Expand Down
20 changes: 20 additions & 0 deletions tests/support/global-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,26 @@ const globalSetup = async (config: FullConfig) => {

fs.mkdirSync(AUTH_DIR, { recursive: true });

// Wait for the cluster API to become reachable before proceeding
const MAX_RETRIES = 360;
const RETRY_DELAY_S = 10;
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
try {
oc(['version'], 10_000);
break;
} catch (err: unknown) {
if (attempt === MAX_RETRIES) {
console.error('Cluster API not reachable after retries');
throw err;
}
console.warn(
`Cluster not reachable (attempt ${attempt}/${MAX_RETRIES}), ` +
`retrying in ${RETRY_DELAY_S}s`,
);
execSync(`sleep ${RETRY_DELAY_S}`);
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

oc(['adm', 'policy', 'add-cluster-role-to-user', 'cluster-admin', username]);
oc(['adm', 'policy', 'add-cluster-role-to-user', 'lightspeed-operator-query-access', username]);

Expand Down