Skip to content

Commit

Permalink
chore: fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
twelvemo committed Jan 15, 2025
1 parent 737ecff commit 73b736a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/test/unit/src/plugins/container/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import fsExtra from "fs-extra"
const { createFile } = fsExtra
import { type ContainerBuildActionSpec } from "../../../../../src/plugins/container/config.js"
import { makeSecret, toClearText } from "../../../../../src/util/secrets.js"
import { tmpdir } from "os"
import { mkdtemp } from "fs/promises"

context("build.ts", () => {
const projectRoot = getDataDir("test-project-container")
Expand Down Expand Up @@ -148,6 +150,10 @@ context("build.ts", () => {
`GARDEN_MODULE_VERSION=${action.versionString()}`,
"--build-arg",
`GARDEN_ACTION_VERSION=${action.versionString()}`,
"--progress",
"rawjson",
"--metadata-file",
"/tmp/a-unique-path/metadata.json",
"--tag",
"some/image",
"--file",
Expand All @@ -167,6 +173,9 @@ context("build.ts", () => {
const cmdArgs = getCmdArgs(action, buildPath)
sinon.replace(containerHelpers, "dockerCli", async ({ cwd, args, ctx: _ctx }) => {
expect(cwd).to.equal(buildPath)
// metadata.json is always at a unique path - we need to replace the filename for the assertion
const idx = args.indexOf("--metadata-file") + 1
args[idx] = "/tmp/a-unique-path/metadata.json"
expect(args).to.eql(cmdArgs)
expect(_ctx).to.exist
return { all: "log", stdout: "", stderr: "", code: 0, proc: null }
Expand All @@ -192,6 +201,9 @@ context("build.ts", () => {
const cmdArgs = getCmdArgs(action, buildPath)
sinon.replace(containerHelpers, "dockerCli", async ({ cwd, args, ctx: _ctx }) => {
expect(cwd).to.equal(buildPath)
// metadata.json is always at a unique path - we need to replace the filename for the assertion
const idx = args.indexOf("--metadata-file") + 1
args[idx] = "/tmp/a-unique-path/metadata.json"
expect(args).to.eql(cmdArgs)
expect(_ctx).to.exist
return { all: "log", stdout: "", stderr: "", code: 0, proc: null }
Expand Down

0 comments on commit 73b736a

Please sign in to comment.