Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOP-4177: Replacing job.useWithBenchmark with job.payload.isNextGen #953

Merged
merged 14 commits into from
Dec 18, 2023
2 changes: 1 addition & 1 deletion src/job/jobHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export abstract class JobHandler {
if (this.currJob.buildCommands && this.currJob.buildCommands.length > 0) {
await this._logger.save(this.currJob._id, `${'(BUILD)'.padEnd(15)}Running Build`);
await this._logger.save(this.currJob._id, `${'(BUILD)'.padEnd(15)}running worker.sh`);
if (this.currJob.useWithBenchmark) {
if (this.currJob.payload.isNextGen) {
await this.exeBuildModified();
} else {
await this.exeBuild();
Expand Down
3 changes: 0 additions & 3 deletions src/job/jobManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ export class JobManager {
try {
this._jobHandler = null;
if (job?.payload) {
const excludeRepoFromBenchmarks = ['mms-docs', 'docs-k8s-operator'].includes(job.payload.repoName);
// Can easily rollback with commenting out this flag.
job.useWithBenchmark = !excludeRepoFromBenchmarks;
await this.createHandlerAndExecute(job);
} else {
this._logger.info('JobManager', `No Jobs Found: ${new Date()}`);
Expand Down
21 changes: 0 additions & 21 deletions tests/unit/job/productionJobHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,34 +328,13 @@ describe('ProductionJobHandler Tests', () => {
}
);

test('Execute Build succeeded deploy failed updates status properly', async () => {
jobHandlerTestHelper.setStageForDeployFailure('Bad work', 'Not Good');
await jobHandlerTestHelper.jobHandler.execute();
jobHandlerTestHelper.verifyNextGenSuccess();
expect(jobHandlerTestHelper.jobRepo.insertNotificationMessages).toBeCalledWith(
jobHandlerTestHelper.job._id,
'Bad work'
);
expect(jobHandlerTestHelper.jobRepo.updateWithErrorStatus).toBeCalledWith(jobHandlerTestHelper.job._id, 'Not Good');
});

test('Execute Build succeeded deploy failed updates status properly on nullish case', async () => {
jobHandlerTestHelper.setStageForDeployFailure(null, 'Not Good');
await jobHandlerTestHelper.jobHandler.execute();
jobHandlerTestHelper.verifyNextGenSuccess();
expect(jobHandlerTestHelper.jobRepo.updateWithErrorStatus).toBeCalledWith(jobHandlerTestHelper.job._id, 'Not Good');
});

test('Execute Build succeeded deploy failed with an ERROR updates status properly', async () => {
jobHandlerTestHelper.setStageForDeployFailure(null, 'ERROR:BAD ONE');
await jobHandlerTestHelper.jobHandler.execute();
jobHandlerTestHelper.verifyNextGenSuccess();
expect(jobHandlerTestHelper.jobRepo.updateWithErrorStatus).toBeCalledWith(
jobHandlerTestHelper.job._id,
'Failed pushing to Production: ERROR:BAD ONE'
);
});

test('Execute legacy build successfully purges only updated urls', async () => {
const purgedUrls = jobHandlerTestHelper.setStageForDeploySuccess(false);
await jobHandlerTestHelper.jobHandler.execute();
Expand Down
Loading