Files
podman/pkg/machine/e2e/config_rm.go
Brent Baude 833456e079 Add podman machine test suite
This PR introduces a test suite for podman machine.  It can currently be
run on developers' local machines and is not part of the official CI
testing; however, the expectation is that any work on machine should
come with an accompanying test.

At present, the test must be run on Linux.  It is untested on Darwin.
There is no Makefile target for the test.  It can be run like `ginkgo -v
pkg/machine/test/.`.  It should be run as a unprivileged user.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2022-04-25 13:05:35 -05:00

57 lines
1.0 KiB
Go

package e2e
type rmMachine struct {
/*
-f, --force Stop and do not prompt before rming
--save-ignition Do not delete ignition file
--save-image Do not delete the image file
--save-keys Do not delete SSH keys
*/
force bool
saveIgnition bool
saveImage bool
saveKeys bool
cmd []string
}
func (i *rmMachine) buildCmd(m *machineTestBuilder) []string {
cmd := []string{"machine", "rm"}
if i.force {
cmd = append(cmd, "--force")
}
if i.saveIgnition {
cmd = append(cmd, "--save-ignition")
}
if i.saveImage {
cmd = append(cmd, "--save-image")
}
if i.saveKeys {
cmd = append(cmd, "--save-keys")
}
cmd = append(cmd, m.name)
i.cmd = cmd
return cmd
}
func (i *rmMachine) withForce() *rmMachine {
i.force = true
return i
}
func (i *rmMachine) withSaveIgnition() *rmMachine {
i.saveIgnition = true
return i
}
func (i *rmMachine) withSaveImage() *rmMachine {
i.saveImage = true
return i
}
func (i *rmMachine) withSaveKeys() *rmMachine {
i.saveKeys = true
return i
}