Skip to content

Commit

Permalink
feat: reload merge from fb
Browse files Browse the repository at this point in the history
  • Loading branch information
keren-finkelstein-payu-gpo committed Oct 1, 2023
1 parent 3161c6b commit 494cca1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/jobs/models/jobManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports.reloadCronJobs = async () => {
const configData = await configHandler.getConfig();
try {
const jobs = await databaseConnector.getJobs(contextId);
jobs.forEach(function (job) {
jobs.forEach(async function (job) {
if (job.cron_expression !== null) {
addCron(job, job.cron_expression, configData);
}
Expand Down
9 changes: 4 additions & 5 deletions tests/unit-tests/jobs/models/jobManager-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,18 +175,17 @@ describe('Manager jobs', function () {

describe('Reload job experiments', function () {
it('found future experiments to reload', async () => {
const timestamp = 7200000;
const timestamp = 500;
const jobExperiment = { start_time: timestamp, job_id: '1234', experiment_id: '4321', id: '2468' };
const chaosExperiment = { kubeObject: { hello: 1 }, experiment_id: '4321' };
getFutureJobExperimentsStub.resolves([jobExperiment]);
getChaosExperimentByIdStub.resolves(chaosExperiment);
runChaosExperimentStub.returns();

const clock = sinon.useFakeTimers();
const promise = manager.reloadChaosExperiments();
clock.tick(3600000);
await promise;
clock.tick(3600010);
clock.tick(1000);
await manager.reloadChaosExperiments();
clock.tick(3000);
sinon.assert.calledOnce(runChaosExperimentStub);
sinon.assert.calledWith(runChaosExperimentStub, chaosExperiment.kubeObject);
clock.restore();
Expand Down

0 comments on commit 494cca1

Please sign in to comment.