Feature/gitops #37

Merged
niko merged 23 commits from feature/gitops into main 2026-06-22 10:37:15 +03:00
2 changed files with 12 additions and 7 deletions
Showing only changes of commit db9d6daebb - Show all commits
@@ -74,7 +74,8 @@ function requestCount() {
}
function gitCalls() {
const out = bash(`cat "${GIT_CALLS_FILE || '/dev/null'}" 2>/dev/null || echo ""`).stdout;
const callsFile = process.env.GIT_CALLS_FILE || '/dev/null';
const out = bash(`cat "${callsFile}" 2>/dev/null || echo ""`).stdout;
return out.split('\n').filter(l => l.length > 0);
}
@@ -15,7 +15,7 @@ function bash(cmd) {
encoding: 'utf-8',
stdio: ['pipe', 'pipe', 'pipe'],
});
return { status: 0, stdout: out };
return { status: 0, stdout: out, stderr: '' };
} catch (e) {
return { status: e.status, stdout: e.stdout || '', stderr: e.stderr || '' };
}
@@ -98,15 +98,19 @@ Then('the calling pipeline reports failure', function () {
When('a test workflow is dispatched but does not finish within the allowed time', function () {
setupMock(JSON.stringify([
{ code: 201 },
{ code: 200, body: { workflow_runs: [{ id: 1, status: 'running' }] } },
{ code: 200, body: { id: 1, status: 'running' } },
{ code: 200, body: { id: 1, status: 'running' } },
{ code: 200, body: { id: 1, status: 'running' } },
{ code: 200, body: { workflow_runs: [] } },
{ code: 200, body: { workflow_runs: [] } },
{ code: 200, body: { workflow_runs: [] } },
{ code: 200, body: { workflow_runs: [] } },
{ code: 200, body: { workflow_runs: [] } },
]));
const r = runDispatch('"test-owner/test-repo" "test.yml" "main" \'{"version":"1.2.3"}\' "http://localhost:18080" "test-token-abc123" "0.05"');
this.dispatchResult = r.status;
this.dispatchStderr = r.stderr;
});
Then('the calling pipeline reports a timeout error', function () {
if (this.dispatchResult !== 124) throw new Error(`Expected timeout exit 124, got ${this.dispatchResult}`);
if (this.dispatchResult !== 124) {
throw new Error(`Expected timeout exit 124, got ${this.dispatchResult}. stderr: ${(this.dispatchStderr || '').substring(0,300)}`);
}
});