joku muutos
This commit is contained in:
@@ -21,14 +21,6 @@ function bash(cmd) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function envBlock() {
|
|
||||||
return [
|
|
||||||
'export GITEA_API_URL="http://localhost:18080"',
|
|
||||||
'export GITEA_TOKEN="test-token-abc123"',
|
|
||||||
'export DISPATCH_POLL_INTERVAL="0.1"',
|
|
||||||
].join('; ');
|
|
||||||
}
|
|
||||||
|
|
||||||
function setupMock(seqJson) {
|
function setupMock(seqJson) {
|
||||||
execSync('lsof -ti :18080 2>/dev/null | xargs -r kill -9 2>/dev/null || true', { stdio: 'ignore' });
|
execSync('lsof -ti :18080 2>/dev/null | xargs -r kill -9 2>/dev/null || true', { stdio: 'ignore' });
|
||||||
execSync('sleep 0.4', { stdio: 'ignore' });
|
execSync('sleep 0.4', { stdio: 'ignore' });
|
||||||
@@ -62,7 +54,7 @@ function setupMock(seqJson) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function runDispatch(args) {
|
function runDispatch(args) {
|
||||||
return bash(`${envBlock()}; bash "${DISPATCH_SCRIPT}" ${args}`);
|
return bash(`export DISPATCH_POLL_INTERVAL="0.1"; bash "${DISPATCH_SCRIPT}" ${args}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
Given('a deployment has completed in the target environment', function () {
|
Given('a deployment has completed in the target environment', function () {
|
||||||
@@ -77,7 +69,7 @@ When('a test workflow is dispatched to a test project', function () {
|
|||||||
{ code: 200, body: { workflow_runs: [{ id: 1, status: 'running' }] } },
|
{ code: 200, body: { workflow_runs: [{ id: 1, status: 'running' }] } },
|
||||||
{ code: 200, body: { id: 1, status: 'completed', conclusion: 'success' } },
|
{ code: 200, body: { id: 1, status: 'completed', conclusion: 'success' } },
|
||||||
]));
|
]));
|
||||||
const r = runDispatch('"test-owner/test-repo" "test.yml" "main" \'{"version":"1.2.3"}\'');
|
const r = runDispatch('"test-owner/test-repo" "test.yml" "main" \'{"version":"1.2.3"}\' "http://localhost:18080" "test-token-abc123"');
|
||||||
this.dispatchResult = r.status;
|
this.dispatchResult = r.status;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -95,7 +87,7 @@ When('a test workflow is dispatched and the tests fail', function () {
|
|||||||
{ code: 200, body: { workflow_runs: [{ id: 1, status: 'running' }] } },
|
{ code: 200, body: { workflow_runs: [{ id: 1, status: 'running' }] } },
|
||||||
{ code: 200, body: { id: 1, status: 'completed', conclusion: 'failure' } },
|
{ code: 200, body: { id: 1, status: 'completed', conclusion: 'failure' } },
|
||||||
]));
|
]));
|
||||||
const r = runDispatch('"test-owner/test-repo" "test.yml" "main" \'{"version":"1.2.3"}\'');
|
const r = runDispatch('"test-owner/test-repo" "test.yml" "main" \'{"version":"1.2.3"}\' "http://localhost:18080" "test-token-abc123"');
|
||||||
this.dispatchResult = r.status;
|
this.dispatchResult = r.status;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -111,7 +103,7 @@ When('a test workflow is dispatched but does not finish within the allowed time'
|
|||||||
{ code: 200, body: { 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' } },
|
||||||
]));
|
]));
|
||||||
const r = runDispatch('"test-owner/test-repo" "test.yml" "main" \'{"version":"1.2.3"}\' "0.001"');
|
const r = runDispatch('"test-owner/test-repo" "test.yml" "main" \'{"version":"1.2.3"}\' "http://localhost:18080" "test-token-abc123" "0.001"');
|
||||||
this.dispatchResult = r.status;
|
this.dispatchResult = r.status;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user