Skip to content

Commit 4f2ecea

Browse files
committed
test
1 parent dc0ceed commit 4f2ecea

2 files changed

Lines changed: 48 additions & 2 deletions

File tree

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

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,52 @@ test.serial('redirect to v2 protocol if openfn.yaml is present', async (t) => {
269269
);
270270
});
271271

272+
test.serial('deploy a v2 spec file', async (t) => {
273+
const testProjectV2 = `
274+
name: test-project
275+
schema_version: '4.0'
276+
workflows:
277+
- id: my-workflow
278+
name: My Workflow
279+
start: webhook
280+
steps:
281+
- id: webhook
282+
type: webhook
283+
enabled: true
284+
next:
285+
my-job: {}
286+
- id: my-job
287+
name: My Job
288+
expression: 'fn(s => s)'
289+
adaptor: '@openfn/language-common@latest'
290+
`.trim();
291+
292+
await fs.writeFile(path.join(tmpDir, 'project.yaml'), testProjectV2);
293+
294+
t.is(Object.keys(server.state.projects).length, 0);
295+
296+
const { stdout, stderr } = await run(
297+
`openfn deploy \
298+
--project-path ${tmpDir}/project.yaml \
299+
--state-path ${tmpDir}/.state.json \
300+
--no-confirm \
301+
--log-json \
302+
-l debug`
303+
);
304+
305+
t.falsy(stderr);
306+
307+
const logs = extractLogs(stdout);
308+
assertLog(t, logs, /v2 spec/i);
309+
assertLog(t, logs, /Deployed/);
310+
311+
t.is(Object.keys(server.state.projects).length, 1);
312+
const [project] = Object.values(server.state.projects) as any[];
313+
t.is(project.name, 'test-project');
314+
const [workflow] = Object.values(project.workflows) as any[];
315+
t.is(workflow.name, 'My Workflow');
316+
});
317+
272318
test.serial('deploy then pull, changes one workflow, deploy', async (t) => {
273319
t.is(Object.keys(server.state.projects).length, 0);
274320

packages/cli/src/deploy/handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ async function deployHandler(
6565
const rawSpec = await fs.readFile(config.specPath, 'utf-8');
6666
const convertedSpec = await maybeConvertV2spec(rawSpec);
6767
if (convertedSpec !== rawSpec) {
68-
logger.debug(
69-
'Detected v2 spec file! This will be converted into the legacy format and validation will be skipped.'
68+
logger.info(
69+
'Detected v2 spec file - converting to legacy format; validation will be skipped.'
7070
);
7171
config.spec = convertedSpec;
7272
}

0 commit comments

Comments
 (0)