From cfe5a318bc3962e1c0debad24c4d342373d7c391 Mon Sep 17 00:00:00 2001 From: DavidGOrtega Date: Mon, 30 May 2022 15:18:31 +0200 Subject: [PATCH] fix tests --- src/cml.test.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/cml.test.js b/src/cml.test.js index 6a2bc7fd5..e8254c918 100644 --- a/src/cml.test.js +++ b/src/cml.test.js @@ -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); }); @@ -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');