From 40b2ccffeacd31ab46f2ae3180f7d5c8550ebd98 Mon Sep 17 00:00:00 2001 From: Klaudiusz Dembler Date: Mon, 16 Mar 2020 13:40:43 +0100 Subject: [PATCH] add integration test for compute with a rawcode algo --- test/integration/ocean/Compute.test.ts | 31 ++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/test/integration/ocean/Compute.test.ts b/test/integration/ocean/Compute.test.ts index 893129e..baf79c9 100644 --- a/test/integration/ocean/Compute.test.ts +++ b/test/integration/ocean/Compute.test.ts @@ -1,7 +1,15 @@ import { assert } from 'chai' import { config } from '../config' -import { Ocean, Account, DDO, MetaData, ComputeJobStatus, Config } from '../../../src' +import { + Ocean, + Account, + DDO, + MetaData, + ComputeJobStatus, + Config, + MetaDataAlgorithm +} from '../../../src' import { getMetadata, createComputeService } from '../utils' import { ServiceCompute } from '../../../src/ddo/Service' @@ -88,9 +96,28 @@ describe('Compute', () => { } catch {} }) - it('should start a compute job', async () => { + it('should start a compute job with a published algo', async () => { const response = await ocean.compute.start(account, agreementId, algorithm.id) assert.equal(response.status, ComputeJobStatus.Started) }) + + it('should start a compute job with a rawcode algo', async () => { + const algoMeta: MetaDataAlgorithm = { + rawcode: `console.log('Hello world!')`, + container: { + entrypoint: 'node $ALGO', + image: 'node', + tag: '10' + } + } + const response = await ocean.compute.start( + account, + agreementId, + undefined, + algoMeta + ) + + assert.equal(response.status, ComputeJobStatus.Started) + }) })