Skip to content

Commit 5d94936

Browse files
authored
Merge pull request #1198 from OpenFn/release/next
Next CLI Release 1.21.0
2 parents 8ad490f + 3372199 commit 5d94936

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+2856
-985
lines changed

integration-tests/cli/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# @openfn/integration-tests-cli
22

3+
## 1.0.7
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [4cc799b]
8+
- Updated dependencies [4cc799b]
9+
- Updated dependencies [3e63c08]
10+
- Updated dependencies [4cc799b]
11+
- Updated dependencies [6689ad0]
12+
- @openfn/lightning-mock@2.4.0
13+
- @openfn/project@0.10.0
14+
315
## 1.0.6
416

517
### Patch Changes

integration-tests/cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@openfn/integration-tests-cli",
33
"private": true,
4-
"version": "1.0.6",
4+
"version": "1.0.7",
55
"description": "CLI integration tests",
66
"author": "Open Function Group <[email protected]>",
77
"license": "ISC",
@@ -16,6 +16,7 @@
1616
},
1717
"dependencies": {
1818
"@openfn/lightning-mock": "workspace:^",
19+
"@openfn/project": "workspace:*",
1920
"@types/node": "^18.19.127",
2021
"ava": "5.3.1",
2122
"date-fns": "^2.30.0",

integration-tests/cli/test/deploy.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import test from 'ava';
22
import run from '../src/run';
3-
import createLightningServer from '@openfn/lightning-mock';
3+
import createLightningServer, {
4+
DEFAULT_PROJECT_ID,
5+
} from '@openfn/lightning-mock';
46
import { extractLogs, assertLog } from '../src/util';
57
import { rimraf } from 'rimraf';
68

@@ -18,7 +20,7 @@ test.before(async () => {
1820

1921
// This should fail against the built CLI right now
2022
test.serial(
21-
`OPENFN_ENDPOINT=${endpoint} openfn pull 123 --log-json`,
23+
`OPENFN_ENDPOINT=${endpoint} openfn pull ${DEFAULT_PROJECT_ID} --log-json`,
2224
async (t) => {
2325
const { stdout, stderr } = await run(t.title);
2426
t.falsy(stderr);

integration-tests/cli/test/execute-workflow.test.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
import test from 'ava';
22
import { rm, mkdir } from 'node:fs/promises';
33
import path from 'node:path';
4+
5+
import createLightningServer from '@openfn/lightning-mock';
6+
47
import run from '../src/run';
58
import { getJSON } from '../src/util';
69

10+
// set up a lightning mock
11+
let server: any;
12+
13+
const port = 8968;
14+
15+
test.before(async () => {
16+
server = await createLightningServer({ port });
17+
server.collections.createCollection('stuff');
18+
// Important: the collection value MUST be as string
19+
server.collections.upsert('stuff', 'x', JSON.stringify({ id: 'x' }));
20+
});
21+
722
const jobsPath = path.resolve('test/fixtures');
823

924
// Note that these tests are STATEFUL
@@ -147,6 +162,17 @@ test.serial(
147162
}
148163
);
149164

165+
test.serial(
166+
`openfn ${jobsPath}/wf-creds.json --credentials ${jobsPath}/creds.json`,
167+
async (t) => {
168+
const { err, stdout, stderr } = await run(t.title);
169+
t.falsy(err);
170+
171+
const out = getJSON();
172+
t.is(out.value, 'admin:admin');
173+
}
174+
);
175+
150176
test.serial(
151177
`openfn ${jobsPath}/wf-errors.json -S "{ \\"data\\": { \\"number\\": 2 } }"`,
152178
async (t) => {
@@ -273,3 +299,16 @@ test.serial(
273299
});
274300
}
275301
);
302+
303+
// collections basic test
304+
test.serial(
305+
`openfn ${jobsPath}/collections.json --endpoint http://localhost:${port} --api-key xyz`,
306+
async (t) => {
307+
const { err } = await run(t.title);
308+
t.falsy(err);
309+
310+
const out = getJSON();
311+
312+
t.deepEqual(out.data, { id: 'x' });
313+
}
314+
);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"workflow": {
3+
"steps": [
4+
{
5+
"adaptor": "common",
6+
"expression": "collections.get('stuff', 'x')"
7+
}
8+
]
9+
}
10+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fn((s) => {
2+
s.value = `${s.configuration.user}:${s.configuration.password}`;
3+
return s;
4+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"08089249-0890-4a73-8799-e2ec2b9e5d77": {
3+
"user": "admin",
4+
"password": "admin"
5+
}
6+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"workflow": {
3+
"steps": [
4+
{
5+
"adaptor": "common",
6+
"configuration": "08089249-0890-4a73-8799-e2ec2b9e5d77",
7+
"expression": "creds.js"
8+
}
9+
]
10+
}
11+
}

0 commit comments

Comments
 (0)