-
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 #524 from OpenFn/release/next
Next release
- Loading branch information
Showing
35 changed files
with
593 additions
and
215 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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.22", | ||
"version": "1.0.23", | ||
"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 |
---|---|---|
|
@@ -100,3 +100,23 @@ test('kill: oom', async (t) => { | |
t.is(error_type, 'OOMError'); | ||
t.is(error_message, 'Run exceeded maximum memory usage'); | ||
}); | ||
|
||
test('crash: process.exit() triggered by postgres', async (t) => { | ||
const attempt = { | ||
id: crypto.randomUUID(), | ||
jobs: [ | ||
{ | ||
adaptor: '@openfn/[email protected]', // version number is important | ||
body: "sql('select * from food_hygiene_interview');", | ||
}, | ||
], | ||
}; | ||
|
||
const result = await run(attempt); | ||
|
||
const { reason, error_type, error_message } = result; | ||
|
||
t.is(reason, 'crash'); | ||
t.is(error_type, 'ExitError'); | ||
t.regex(error_message, /Process exited with code: 1/i); | ||
}); |
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
9 changes: 9 additions & 0 deletions
9
packages/engine-multi/test/__repo__/node_modules/helper_1.0.0/index.cjs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
packages/engine-multi/test/__repo__/node_modules/helper_1.0.0/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,8 @@ | ||
{ | ||
"name": "test-repo", | ||
"private": true, | ||
"version": "1.0.0", | ||
"dependencies": { | ||
"helper_1.0.0": "@npm:[email protected]" | ||
} | ||
} |
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,9 @@ | ||
import test from 'ava'; | ||
import path from 'node:path'; | ||
|
||
import createEngine, { EngineOptions } from '../src/engine'; | ||
import { createMockLogger } from '@openfn/logger'; | ||
import { WORKFLOW_ERROR } from '../src/events'; | ||
import { WORKFLOW_COMPLETE, WORKFLOW_ERROR } from '../src/events'; | ||
|
||
let engine; | ||
|
||
|
@@ -10,7 +12,7 @@ test.before(async () => { | |
|
||
const options: EngineOptions = { | ||
logger, | ||
repoDir: '.', | ||
repoDir: path.resolve('./test/__repo__'), | ||
autoinstall: { | ||
// disable autoinstall | ||
handleIsInstalled: async () => true, | ||
|
@@ -102,11 +104,12 @@ test.serial('execution error from async code', (t) => { | |
id: 'a', | ||
jobs: [ | ||
{ | ||
// this error will throw within the promise, and so before the job completes | ||
// But REALLY naughty code could throw after the job has finished | ||
// In which case it'll be ignored | ||
// Also note that the wrapping promise will never resolve | ||
expression: `export default [(s) => new Promise((r) => { | ||
// this error will throw within the promise, and so before the job completes | ||
// But REALLY naughty code could throw after the job has finished | ||
// In which case it'll be ignored | ||
setTimeout(() => { throw new Error(\"e\");r () }, 1) | ||
setTimeout(() => { throw new Error(\"e1324\"); r() }, 10) | ||
})]`, | ||
}, | ||
], | ||
|
@@ -115,6 +118,28 @@ test.serial('execution error from async code', (t) => { | |
engine.execute(plan).on(WORKFLOW_ERROR, (evt) => { | ||
t.is(evt.type, 'ExecutionError'); | ||
t.is(evt.severity, 'crash'); | ||
|
||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
test.serial('emit a crash error on process.exit()', (t) => { | ||
return new Promise((done) => { | ||
const plan = { | ||
id: 'z', | ||
jobs: [ | ||
{ | ||
adaptor: '[email protected]', | ||
expression: `export default [exit()]`, | ||
}, | ||
], | ||
}; | ||
|
||
engine.execute(plan).on(WORKFLOW_ERROR, (evt) => { | ||
t.is(evt.type, 'ExitError'); | ||
t.is(evt.severity, 'crash'); | ||
t.is(evt.message, 'Process exited with code: 42'); | ||
done(); | ||
}); | ||
}); | ||
|
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.