Change image-path to image for tests

As we deprecate image-path for image.

Signed-off-by: Ashley Cui <acui@redhat.com>
This commit is contained in:
Ashley Cui
2024-02-28 01:18:40 -05:00
parent 527b3793b8
commit 2b86ab5a1e
15 changed files with 57 additions and 57 deletions

View File

@@ -34,7 +34,7 @@ var _ = Describe("run basic podman commands", func() {
// so skip it on cirrus envs and where CIRRUS_CI isn't set.
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withNow()).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath).withNow()).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -62,7 +62,7 @@ var _ = Describe("run basic podman commands", func() {
It("Podman ops with port forwarding and gvproxy", func() {
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withNow()).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath).withNow()).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -110,7 +110,7 @@ var _ = Describe("run basic podman commands", func() {
name := randomString()
machinePath := "/does/not/exist"
init := new(initMachine).withVolume(fmt.Sprintf("%s:%s", dir, machinePath)).withImagePath(mb.imagePath).withNow()
init := new(initMachine).withVolume(fmt.Sprintf("%s:%s", dir, machinePath)).withImage(mb.imagePath).withNow()
session, err := mb.setName(name).setCmd(init).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))

View File

@@ -23,7 +23,7 @@ type initMachine struct {
diskSize *uint
ignitionPath string
username string
imagePath string
image string
memory *uint
now bool
timezone string
@@ -50,8 +50,8 @@ func (i *initMachine) buildCmd(m *machineTestBuilder) []string {
if l := len(i.username); l > 0 {
cmd = append(cmd, "--username", i.username)
}
if l := len(i.imagePath); l > 0 {
cmd = append(cmd, "--image-path", i.imagePath)
if l := len(i.image); l > 0 {
cmd = append(cmd, "--image-path", i.image)
}
if i.memory != nil {
cmd = append(cmd, "--memory", strconv.Itoa(int(*i.memory)))
@@ -95,8 +95,8 @@ func (i *initMachine) withUsername(username string) *initMachine {
return i
}
func (i *initMachine) withImagePath(path string) *initMachine {
i.imagePath = path
func (i *initMachine) withImage(path string) *initMachine {
i.image = path
return i
}

View File

@@ -39,7 +39,7 @@ var _ = Describe("podman machine info", func() {
// Create a machine and check if info has been updated
i := new(initMachine)
initSession, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
initSession, err := mb.setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(initSession).To(Exit(0))

View File

@@ -61,7 +61,7 @@ var _ = Describe("podman machine init", func() {
bi := new(initMachine)
want := fmt.Sprintf("system connection \"%s\" already exists", badName)
badInit, berr := mb.setName(badName).setCmd(bi.withImagePath(mb.imagePath)).run()
badInit, berr := mb.setName(badName).setCmd(bi.withImage(mb.imagePath)).run()
Expect(berr).ToNot(HaveOccurred())
Expect(badInit).To(Exit(125))
Expect(badInit.errorToString()).To(ContainSubstring(want))
@@ -81,7 +81,7 @@ var _ = Describe("podman machine init", func() {
It("simple init", func() {
i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -100,7 +100,7 @@ var _ = Describe("podman machine init", func() {
It("simple init with start", func() {
i := initMachine{}
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -137,7 +137,7 @@ var _ = Describe("podman machine init", func() {
It("simple init with username", func() {
i := new(initMachine)
remoteUsername := "remoteuser"
session, err := mb.setCmd(i.withImagePath(mb.imagePath).withUsername(remoteUsername)).run()
session, err := mb.setCmd(i.withImage(mb.imagePath).withUsername(remoteUsername)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -160,7 +160,7 @@ var _ = Describe("podman machine init", func() {
skipIfWSL("setting hardware resource numbers and timezone are not supported on WSL")
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withCPUs(2).withDiskSize(102).withMemory(4096).withTimezone("Pacific/Honolulu")).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath).withCPUs(2).withDiskSize(102).withMemory(4096).withTimezone("Pacific/Honolulu")).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -212,7 +212,7 @@ var _ = Describe("podman machine init", func() {
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withVolume(mount).withNow()).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath).withVolume(mount).withNow()).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -226,7 +226,7 @@ var _ = Describe("podman machine init", func() {
It("machine init rootless docker.sock check", func() {
i := initMachine{}
name := randomString()
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -249,7 +249,7 @@ var _ = Describe("podman machine init", func() {
It("machine init rootful with docker.sock check", func() {
i := initMachine{}
name := randomString()
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withRootful(true)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath).withRootful(true)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -276,7 +276,7 @@ var _ = Describe("podman machine init", func() {
It("init should cleanup on failure", func() {
i := new(initMachine)
name := randomString()
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -303,7 +303,7 @@ var _ = Describe("podman machine init", func() {
// Bad ignition path - init fails
i = new(initMachine)
i.ignitionPath = "/bad/path"
session, err = mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err = mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(125))
@@ -355,7 +355,7 @@ var _ = Describe("podman machine init", func() {
// We should be able to init with a bad config present
i := new(initMachine)
name := randomString()
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))

View File

@@ -33,7 +33,7 @@ var _ = Describe("podman machine init - windows only", func() {
}
i := new(initMachine)
name := randomString()
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withUserModeNetworking(true)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath).withUserModeNetworking(true)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -86,7 +86,7 @@ var _ = Describe("podman machine init - windows only", func() {
}
}()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(125))
Expect(session.errorToString()).To(ContainSubstring("already exists on hypervisor"))
@@ -104,7 +104,7 @@ var _ = Describe("podman machine init - windows only", func() {
// create a bogus machine
i := new(initMachine)
session, err := mb.setName("foobarexport").setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName("foobarexport").setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -129,7 +129,7 @@ var _ = Describe("podman machine init - windows only", func() {
}()
// Trying to make a vm with the same name as an existing name should result in a 125
checkSession, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
checkSession, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(checkSession).To(Exit(125))
})

View File

@@ -33,12 +33,12 @@ var _ = Describe("podman inspect stop", func() {
It("inspect two machines", func() {
i := new(initMachine)
foo1, err := mb.setName("foo1").setCmd(i.withImagePath(mb.imagePath)).run()
foo1, err := mb.setName("foo1").setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(foo1).To(Exit(0))
ii := new(initMachine)
foo2, err := mb.setName("foo2").setCmd(ii.withImagePath(mb.imagePath)).run()
foo2, err := mb.setName("foo2").setCmd(ii.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(foo2).To(Exit(0))
@@ -53,7 +53,7 @@ var _ = Describe("podman inspect stop", func() {
It("inspect with go format", func() {
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))

View File

@@ -33,7 +33,7 @@ var _ = Describe("podman machine list", func() {
Expect(firstList.outputToStringSlice()).To(HaveLen(1)) // just the header
i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -60,11 +60,11 @@ var _ = Describe("podman machine list", func() {
Expect(noheaderSession.outputToStringSlice()).To(BeEmpty())
i := new(initMachine)
session, err := mb.setName(name1).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name1).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
session2, err := mb.setName(name2).setCmd(i.withImagePath(mb.imagePath)).run()
session2, err := mb.setName(name2).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session2).To(Exit(0))
@@ -82,7 +82,7 @@ var _ = Describe("podman machine list", func() {
It("list machine: check if running while starting", func() {
skipIfWSL("the below logic does not work on WSL. #20978")
i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -123,7 +123,7 @@ var _ = Describe("podman machine list", func() {
name1 := randomString()
i := new(initMachine)
session, err := mb.setName(name1).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name1).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))

View File

@@ -21,7 +21,7 @@ package e2e_test
// It("apply machine", func() {
// i := new(initMachine)
// foo1, err := mb.setName("foo1").setCmd(i.withImagePath(mb.imagePath)).run()
// foo1, err := mb.setName("foo1").setCmd(i.withImage(mb.imagePath)).run()
// Expect(err).ToNot(HaveOccurred())
// Expect(foo1).To(Exit(0))
@@ -33,7 +33,7 @@ package e2e_test
// It("apply machine from containers-storage", func() {
// i := new(initMachine)
// foo1, err := mb.setName("foo1").setCmd(i.withImagePath(mb.imagePath)).run()
// foo1, err := mb.setName("foo1").setCmd(i.withImage(mb.imagePath)).run()
// Expect(err).ToNot(HaveOccurred())
// Expect(foo1).To(Exit(0))

View File

@@ -44,7 +44,7 @@ var _ = Describe("podman machine proxy settings propagation", func() {
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))

View File

@@ -29,7 +29,7 @@ var _ = Describe("podman machine reset", func() {
It("reset machine with one defined machine", func() {
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -53,7 +53,7 @@ var _ = Describe("podman machine reset", func() {
It("reset with running machine and other machines idle ", func() {
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withNow()).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath).withNow()).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -65,7 +65,7 @@ var _ = Describe("podman machine reset", func() {
name2 := randomString()
i2 := new(initMachine)
session2, err := mb.setName(name2).setCmd(i2.withImagePath(mb.imagePath)).run()
session2, err := mb.setName(name2).setCmd(i2.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session2).To(Exit(0))

View File

@@ -35,7 +35,7 @@ var _ = Describe("podman machine rm", func() {
It("Remove machine", func() {
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
rm := rmMachine{}
@@ -59,7 +59,7 @@ var _ = Describe("podman machine rm", func() {
It("Remove running machine", func() {
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withNow()).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath).withNow()).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
rm := new(rmMachine)
@@ -83,7 +83,7 @@ var _ = Describe("podman machine rm", func() {
It("machine rm --save-ignition --save-image", func() {
i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -125,13 +125,13 @@ var _ = Describe("podman machine rm", func() {
fooName := "foo"
foo := new(initMachine)
session, err := mb.setName(fooName).setCmd(foo.withImagePath(mb.imagePath)).run()
session, err := mb.setName(fooName).setCmd(foo.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
barName := "bar"
bar := new(initMachine)
session, err = mb.setName(barName).setCmd(bar.withImagePath(mb.imagePath).withNow()).run()
session, err = mb.setName(barName).setCmd(bar.withImage(mb.imagePath).withNow()).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -165,7 +165,7 @@ var _ = Describe("podman machine rm", func() {
It("Removing all machines doesn't delete ssh keys", func() {
fooName := "foo"
foo := new(initMachine)
session, err := mb.setName(fooName).setCmd(foo.withImagePath(mb.imagePath)).run()
session, err := mb.setName(fooName).setCmd(foo.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))

View File

@@ -29,7 +29,7 @@ var _ = Describe("podman machine set", func() {
skipIfWSL("WSL cannot change set properties of disk, processor, or memory")
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -79,7 +79,7 @@ var _ = Describe("podman machine set", func() {
skipIfNotVmtype(define.WSLVirt, "tests are only for WSL provider")
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -104,7 +104,7 @@ var _ = Describe("podman machine set", func() {
skipIfWSL("WSL cannot change set properties of disk, processor, or memory")
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -138,7 +138,7 @@ var _ = Describe("podman machine set", func() {
It("set rootful with docker sock change", func() {
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -176,7 +176,7 @@ var _ = Describe("podman machine set", func() {
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -196,7 +196,7 @@ var _ = Describe("podman machine set", func() {
It("set while machine already running", func() {
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))

View File

@@ -32,7 +32,7 @@ var _ = Describe("podman machine ssh", func() {
It("ssh to non-running machine", func() {
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
@@ -47,7 +47,7 @@ var _ = Describe("podman machine ssh", func() {
wsl := testProvider.VMType() == define.WSLVirt
name := randomString()
i := new(initMachine)
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withNow()).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath).withNow()).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))

View File

@@ -23,7 +23,7 @@ var _ = Describe("podman machine start", func() {
It("start simple machine", func() {
i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
s := new(startMachine)
@@ -68,7 +68,7 @@ var _ = Describe("podman machine start", func() {
It("start machine already started", func() {
i := new(initMachine)
session, err := mb.setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
s := new(startMachine)
@@ -90,13 +90,13 @@ var _ = Describe("podman machine start", func() {
It("start only starts specified machine", func() {
i := initMachine{}
startme := randomString()
session, err := mb.setName(startme).setCmd(i.withImagePath(mb.imagePath)).run()
session, err := mb.setName(startme).setCmd(i.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))
j := initMachine{}
dontstartme := randomString()
session2, err := mb.setName(dontstartme).setCmd(j.withImagePath(mb.imagePath)).run()
session2, err := mb.setName(dontstartme).setCmd(j.withImage(mb.imagePath)).run()
Expect(err).ToNot(HaveOccurred())
Expect(session2).To(Exit(0))

View File

@@ -34,7 +34,7 @@ var _ = Describe("podman machine stop", func() {
name := randomString()
i := new(initMachine)
starttime := time.Now()
session, err := mb.setName(name).setCmd(i.withImagePath(mb.imagePath).withNow()).run()
session, err := mb.setName(name).setCmd(i.withImage(mb.imagePath).withNow()).run()
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(0))