-
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.
runtime,cli,engine: support @next tag (#716)
* runtime: ensure we ALWAYS lookup the latest version with @latest or @next * tests: test @latest and @next * runtime: fix an issue were the wrong version is sent to the version lookup * changeset * runtime: install maps version numbers and returns * changeset * cli: adjust tests autoinstall without a version is handled a bit differnetly now, so I'm adding versions to ensure the tests use the repo * engine: migrate to new autoinstall api * typings * engine: map @latest and @next properly * formatting * engine: ensure that job.linker gets set properly * engine: update test * tests: update * tests: add worker @next autoinstall tests * changesets * test-tmp: testing * tests: update for latest test adaptor versions * fix test again * tests: reduce specifity
- Loading branch information
1 parent
587d117
commit e8fc192
Showing
14 changed files
with
439 additions
and
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@openfn/runtime': patch | ||
--- | ||
|
||
Add support for @next and @latest tags |
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,5 @@ | ||
--- | ||
'@openfn/engine-multi': patch | ||
--- | ||
|
||
Adjust to new autoinstall api |
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,5 @@ | ||
--- | ||
'@openfn/runtime': minor | ||
--- | ||
|
||
autoinstall returns mapped specifiers to the caller |
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,6 @@ | ||
--- | ||
'@openfn/cli': minor | ||
'@openfn/ws-worker': minor | ||
--- | ||
|
||
Add support for @next and @latest tags in adaptor versions |
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,135 @@ | ||
import test from 'ava'; | ||
import { rm, mkdir } from 'node:fs/promises'; | ||
import path from 'node:path'; | ||
import run from '../src/run'; | ||
|
||
const jobsPath = path.resolve('test/fixtures'); | ||
const repoDir = `--repo-dir=${path.resolve('tmp/openfn/repo-autoinstall')}`; | ||
const log = `--log=debug`; | ||
|
||
const TEST_LATEST = '1.0.'; | ||
const TEST_NEXT = '2.0.0-next.'; | ||
|
||
// Note that these tests are STATEFUL | ||
// Ensure the repo is clean and clear before these tests run | ||
test.before(async () => { | ||
await mkdir('tmp', { recursive: true }); | ||
await run(`openfn repo clean -f --log none ${repoDir}`); | ||
}); | ||
|
||
// using jobs rather than workflows for autoinstall tests | ||
// because it's easier to manage | ||
|
||
// autoinstall a specific version | ||
test.serial( | ||
`openfn ${jobsPath}/simple.js -a [email protected] ${repoDir} ${log}`, | ||
async (t) => { | ||
const { stdout, stderr } = await run(t.title); | ||
t.falsy(stderr); | ||
|
||
t.regex(stdout, /Auto-installing language adaptors/); | ||
t.regex(stdout, /Installing packages.../); | ||
t.regex(stdout, /Will install @openfn\/language-common version/); | ||
t.regex(stdout, /Installed @openfn\/[email protected]/); | ||
} | ||
); | ||
|
||
// always lookup the latest version if @latest is passed | ||
test.serial( | ||
`openfn ${jobsPath}/simple.js -a common@latest ${repoDir} ${log}`, | ||
async (t) => { | ||
const { stdout, err } = await run(t.title); | ||
// t.falsy(err); // TODO all these are failing in test? Seem to be ok locally... | ||
|
||
t.regex(stdout, /Auto-installing language adaptors/); | ||
t.regex( | ||
stdout, | ||
/Looked up latest version of @openfn\/language-common@latest/ | ||
); | ||
t.regex(stdout, /Installing packages.../); | ||
t.regex(stdout, /Will install @openfn\/language-common version/); | ||
t.regex(stdout, /Installed @openfn\/language-common@/); | ||
} | ||
); | ||
|
||
// just to be sure, run it again! | ||
test.serial( | ||
`openfn ${jobsPath}/simple.js -a common@latest ${repoDir} --log=info`, | ||
async (t) => { | ||
const { stdout, stderr } = await run(t.title); | ||
|
||
t.falsy(stderr); | ||
|
||
t.regex( | ||
stdout, | ||
/Looked up latest version of @openfn\/language-common@latest/ | ||
); | ||
t.regex( | ||
stdout, | ||
/Skipping @openfn\/language-common@(.+) as already installed/ | ||
); | ||
} | ||
); | ||
|
||
// Ignore the @next version if present but we asked for latest | ||
test.serial( | ||
`openfn ${jobsPath}/simple.js -a testing@latest ${repoDir} ${log}`, | ||
async (t) => { | ||
const { stdout, err } = await run(t.title); | ||
|
||
// t.falsy(err); // TODO I think this is a broken adaptor build? | ||
|
||
t.regex(stdout, /Auto-installing language adaptors/); | ||
t.regex(stdout, /Looked up latest version of @openfn\/language-testing/); | ||
t.regex(stdout, /Installing packages.../); | ||
t.regex( | ||
stdout, | ||
new RegExp( | ||
`Will install @openfn\/language-testing version ${TEST_LATEST}` | ||
) | ||
); | ||
t.regex( | ||
stdout, | ||
new RegExp(`Installed @openfn\/language-testing@${TEST_LATEST}`) | ||
); | ||
} | ||
); | ||
|
||
// Ignore @next if present but we asked for no version | ||
test.serial( | ||
`openfn ${jobsPath}/simple.js -a testing ${repoDir} ${log}`, | ||
async (t) => { | ||
const { stdout, err } = await run(t.title); | ||
|
||
//t.falsy(err); | ||
|
||
t.regex(stdout, /Looked up latest version of @openfn\/language-testing/); | ||
t.regex( | ||
stdout, | ||
/Skipping @openfn\/language-testing@(.+) as already installed/ | ||
); | ||
} | ||
); | ||
|
||
// TODO we need to fix the version of testing | ||
// maybe after release we can push next onto 2.0 and leave latest on 1.0 | ||
test.serial( | ||
`openfn ${jobsPath}/simple.js -a testing@next ${repoDir} ${log}`, | ||
async (t) => { | ||
const { stdout, stderr } = await run(t.title); | ||
|
||
t.falsy(stderr); | ||
|
||
t.regex(stdout, /Auto-installing language adaptors/); | ||
t.regex( | ||
stdout, | ||
/Looked up latest version of @openfn\/language-testing@next/ | ||
); | ||
t.regex(stdout, /Installing packages.../); | ||
t.regex(stdout, /Will install @openfn\/language-testing version/); | ||
t.regex( | ||
stdout, | ||
new RegExp(`Installed @openfn\/language-testing@${TEST_NEXT}`) | ||
); | ||
} | ||
); |
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.