Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidGOrtega committed May 30, 2022
1 parent 8e6b2d6 commit cfe5a31
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/cml.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,21 +79,23 @@ describe('Github tests', () => {
test('Runner logs', async () => {
const cml = new CML();
cml.driver = 'github';
let log = cml.parseRunnerLog({ data: 'Listening for Jobs' });
let log = await cml.parseRunnerLog({ data: 'Listening for Jobs' });
expect(log.status).toBe('ready');

log = cml.parseRunnerLog({ data: 'Running job' });
log = await cml.parseRunnerLog({ data: 'Running job' });
expect(log.status).toBe('job_started');

log = cml.parseRunnerLog({ data: 'completed with result: Succeeded' });
log = await cml.parseRunnerLog({
data: 'completed with result: Succeeded'
});
expect(log.status).toBe('job_ended');
expect(log.success).toBe(true);

log = cml.parseRunnerLog({ data: 'completed with result: Failed' });
log = await cml.parseRunnerLog({ data: 'completed with result: Failed' });
expect(log.status).toBe('job_ended');
expect(log.success).toBe(false);

log = cml.parseRunnerLog({ data: 'completed with result: Canceled' });
log = await cml.parseRunnerLog({ data: 'completed with result: Canceled' });
expect(log.status).toBe('job_ended');
expect(log.success).toBe(false);
});
Expand Down Expand Up @@ -227,18 +229,18 @@ describe('Gitlab tests', () => {
});
expect(log.status).toBe('ready');

log = cml.parseRunnerLog({
log = await cml.parseRunnerLog({
data: '{"job":1396213069,"level":"info","msg":"Checking for jobs... received","repo_url":"https://gitlab.com/iterative.ai/fashion_mnist.git","runner":"2SGFrnGt","time":"2021-07-02T16:45:47Z"}'
});
expect(log.status).toBe('job_started');

log = cml.parseRunnerLog({
log = await cml.parseRunnerLog({
data: '{"duration_s":7.706165838,"job":2177867438,"level":"info","msg":"Job succeeded","project":27939020,"runner":"fe36krFK","time":"2022-03-08T18:12:57+01:00"}'
});
expect(log.status).toBe('job_ended');
expect(log.success).toBe(true);

log = cml.parseRunnerLog({
log = await cml.parseRunnerLog({
data: '{"duration_s":120.0120526,"job":1396213069,"level":"warning","msg":"Job failed: execution took longer than 2m0s seconds","project":27856642,"runner":"2SGFrnGt","time":"2021-07-02T16:47:47Z"}'
});
expect(log.status).toBe('job_ended');
Expand Down

1 comment on commit cfe5a31

@github-actions

This comment was marked as outdated.

Please sign in to comment.