Skip to content

Commit

Permalink
fix: functional tests on stages timeout error (#3126)
Browse files Browse the repository at this point in the history
  • Loading branch information
VonnyJap authored May 29, 2024
1 parent 257175a commit 320ed40
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 0 additions & 1 deletion features/stages.feature
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ Feature: Stage
And the "b" build succeeded
And the "c" job is triggered
And the "c" build succeeded
Then the "stage@teardown_fail" stageBuild status is "SUCCESS"
And the "stage@teardown_fail:teardown" job is triggered
And the "stage@teardown_fail:teardown" build failed
And the "stage@teardown_fail" stageBuild status is "FAILURE"
Expand Down
16 changes: 11 additions & 5 deletions features/step_definitions/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,19 @@ Then(
config.desiredSha = this.sha;
}

return sdapi.searchForBuild(config).then(build => {
this.eventId = build.eventId;
const job = this.jobs.find(j => j.name === jobName);
const sleepTime = jobName.endsWith('teardown') ? 1000 : 0;

Assert.equal(build.jobId, job.id);
return new Promise(resolve => {
setTimeout(resolve, sleepTime);
}).then(() => {
return sdapi.searchForBuild(config).then(build => {
this.eventId = build.eventId;
const job = this.jobs.find(j => j.name === jobName);

Assert.equal(build.jobId, job.id);

this.buildId = build.id;
this.buildId = build.id;
});
});
}
);
Expand Down

0 comments on commit 320ed40

Please sign in to comment.