Feature/gitops #37
@@ -74,7 +74,8 @@ function requestCount() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function gitCalls() {
|
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);
|
return out.split('\n').filter(l => l.length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ function bash(cmd) {
|
|||||||
encoding: 'utf-8',
|
encoding: 'utf-8',
|
||||||
stdio: ['pipe', 'pipe', 'pipe'],
|
stdio: ['pipe', 'pipe', 'pipe'],
|
||||||
});
|
});
|
||||||
return { status: 0, stdout: out };
|
return { status: 0, stdout: out, stderr: '' };
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return { status: e.status, stdout: e.stdout || '', stderr: e.stderr || '' };
|
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 () {
|
When('a test workflow is dispatched but does not finish within the allowed time', function () {
|
||||||
setupMock(JSON.stringify([
|
setupMock(JSON.stringify([
|
||||||
{ code: 201 },
|
{ code: 201 },
|
||||||
{ code: 200, body: { workflow_runs: [{ id: 1, status: 'running' }] } },
|
{ code: 200, body: { workflow_runs: [] } },
|
||||||
{ code: 200, body: { id: 1, status: 'running' } },
|
{ code: 200, body: { workflow_runs: [] } },
|
||||||
{ code: 200, body: { id: 1, status: 'running' } },
|
{ code: 200, body: { workflow_runs: [] } },
|
||||||
{ code: 200, body: { id: 1, status: 'running' } },
|
{ 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"');
|
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.dispatchResult = r.status;
|
||||||
|
this.dispatchStderr = r.stderr;
|
||||||
});
|
});
|
||||||
|
|
||||||
Then('the calling pipeline reports a timeout error', function () {
|
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)}`);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user