-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #613 from OpenFn/release/next
Next Release
- Loading branch information
Showing
45 changed files
with
851 additions
and
360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "@openfn/integration-tests-worker", | ||
"private": true, | ||
"version": "1.0.35", | ||
"version": "1.0.36", | ||
"description": "Lightning WOrker integration tests", | ||
"author": "Open Function Group <[email protected]>", | ||
"license": "ISC", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,8 @@ const humanMb = (sizeInBytes: number) => Math.round(sizeInBytes / 1024 / 1024); | |
const run = async (t, attempt) => { | ||
return new Promise<any>(async (done, reject) => { | ||
lightning.on('step:complete', ({ payload }) => { | ||
t.is(payload.reason, 'success'); | ||
|
||
// TODO friendlier job names for this would be nice (rather than run ids) | ||
t.log( | ||
`run ${payload.step_id} done in ${payload.duration / 1000}s [${humanMb( | ||
|
@@ -192,7 +194,7 @@ test.serial('run parallel jobs', async (t) => { | |
// }); | ||
}); | ||
|
||
test('run a http adaptor job', async (t) => { | ||
test.serial('run a http adaptor job', async (t) => { | ||
const job = createJob({ | ||
adaptor: '@openfn/[email protected]', | ||
body: `get("https://jsonplaceholder.typicode.com/todos/1"); | ||
|
@@ -212,3 +214,37 @@ test('run a http adaptor job', async (t) => { | |
completed: false, | ||
}); | ||
}); | ||
|
||
test.serial('use different versions of the same adaptor', async (t) => { | ||
// http@5 exported an axios global - so run this job and validate that the global is there | ||
const job1 = createJob({ | ||
body: `import { axios } from "@openfn/language-http"; | ||
fn((s) => { | ||
if (!axios) { | ||
throw new Error('AXIOS NOT FOUND') | ||
} | ||
return s; | ||
})`, | ||
adaptor: '@openfn/[email protected]', | ||
}); | ||
|
||
// http@6 no longer exports axios - so throw an error if we see it | ||
const job2 = createJob({ | ||
body: `import { axios } from "@openfn/language-http"; | ||
fn((s) => { | ||
if (axios) { | ||
throw new Error('AXIOS FOUND') | ||
} | ||
return s; | ||
})`, | ||
adaptor: '@openfn/[email protected]', | ||
}); | ||
|
||
// Just for fun, run each job a couple of times to make sure that there's no wierd caching or ordering anything | ||
const steps = [job1, job2, job1, job2]; | ||
const attempt = createRun([], steps, []); | ||
|
||
const result = await run(t, attempt); | ||
t.log(result); | ||
t.falsy(result.errors); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.