Skip to content

Commit ae8dc87

Browse files
committed
Run MySQL integration through recipe lifecycle
1 parent 40d8586 commit ae8dc87

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

packages/cli/src/commands/recipe-run.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export async function runRecipeValidateCommand(args: string[]): Promise<number>
9696
return output.success ? 0 : 1
9797
}
9898

99-
async function runRecipe(options: RecipeRunOptions, interruption?: RecipeInterruptionController): Promise<RecipeRunOutput> {
99+
export async function runRecipe(options: RecipeRunOptions, interruption?: RecipeInterruptionController): Promise<RecipeRunOutput> {
100100
const mountConflictFailure = await recipeArtifactsMountConflictFailure(options)
101101
if (mountConflictFailure) {
102102
return mountConflictFailure

tests/disposable-mysql-mysqli.integration.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { mkdtemp, rm, writeFile } from "node:fs/promises"
44
import { tmpdir } from "node:os"
55
import { join } from "node:path"
66
import { promisify } from "node:util"
7+
import { runRecipe } from "../packages/cli/src/commands/recipe-run.ts"
78

89
const execFileAsync = promisify(execFile)
910

@@ -30,8 +31,16 @@ if (!await dockerAvailable()) {
3031
},
3132
workflow: { steps: [{ command: "wordpress.run-php", args: [`code=${code}`] }] },
3233
}))
33-
const { stdout } = await execFileAsync(process.execPath, ["packages/cli/dist/index.js", "recipe-run", "--recipe", recipePath, "--json"], { cwd: process.cwd(), timeout: 180_000, maxBuffer: 2 * 1024 * 1024 })
34-
const result = JSON.parse(stdout) as { success: boolean; executions: Array<{ stdout: string }> }
34+
const result = await runRecipe({
35+
recipePath,
36+
previewHoldBlocking: false,
37+
previewLeaseRequested: false,
38+
previewLeaseChild: false,
39+
timeoutMs: 180_000,
40+
json: true,
41+
summary: false,
42+
dryRun: false,
43+
})
3544
assert.equal(result.success, true)
3645
assert.equal(result.executions.at(-1)?.stdout.trim(), "1")
3746
console.log("disposable MySQL mysqli E2E passed")

0 commit comments

Comments
 (0)