-
Notifications
You must be signed in to change notification settings - Fork 12
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 #494 from OpenFn/release/next
Release: worker 0.2.8 & CLI 0.4.9
- Loading branch information
Showing
58 changed files
with
2,737 additions
and
975 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
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.17", | ||
"version": "1.0.20", | ||
"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
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// stress test for autoinstall | ||
// this could evolve into stress testing, benchmarking or artillery generally? | ||
// Also I may skip this in CI after the issue is fixed | ||
|
||
import test from 'ava'; | ||
import path from 'node:path'; | ||
|
||
import { initLightning, initWorker } from '../src/init'; | ||
import { createAttempt, createJob } from '../src/factories'; | ||
|
||
const generate = (adaptor, version) => { | ||
const specifier = `@openfn/language-${adaptor}@${version}`; | ||
const job = createJob({ | ||
body: `fn(() => ({ data: "${adaptor}" }))`, | ||
adaptor: specifier, | ||
}); | ||
return createAttempt([], [job], []); | ||
}; | ||
|
||
let lightning; | ||
let worker; | ||
|
||
const run = async (attempt) => { | ||
return new Promise<any>(async (done, reject) => { | ||
lightning.on('attempt:complete', (evt) => { | ||
if (attempt.id === evt.attemptId) { | ||
done(lightning.getResult(attempt.id)); | ||
} | ||
}); | ||
|
||
lightning.enqueueAttempt(attempt); | ||
}); | ||
}; | ||
|
||
test.before(async () => { | ||
const lightningPort = 4321; | ||
|
||
lightning = initLightning(lightningPort); | ||
|
||
({ worker } = await initWorker(lightningPort, { | ||
repoDir: path.resolve('tmp/repo/autoinstall'), | ||
})); | ||
}); | ||
|
||
test.after(async () => { | ||
lightning.destroy(); | ||
await worker.destroy(); | ||
}); | ||
|
||
test('autoinstall three things at once', async (t) => { | ||
const a = generate('common', '1.11.1'); | ||
const b = generate('http', '5.0.0'); | ||
const c = generate('googlesheets', '2.2.2'); | ||
|
||
const [ra, rb, rc] = await Promise.all([run(a), run(b), run(c)]); | ||
|
||
t.is(ra.data, 'common'); | ||
t.is(rb.data, 'http'); | ||
t.is(rc.data, 'googlesheets'); | ||
}); |
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.