diff options
author | Ashley Cui <acui@redhat.com> | 2022-05-05 16:45:30 -0400 |
---|---|---|
committer | Ashley Cui <acui@redhat.com> | 2022-05-10 14:56:13 -0400 |
commit | c7c00ce55199c1e569953a4a03055268ecca147e (patch) | |
tree | 82b78e412618b1fd4a8f6aeea0c9719af0d9e633 /cmd/podman/machine | |
parent | 28588235d2051bf673d528c293261f926fad0d92 (diff) | |
download | podman-c7c00ce55199c1e569953a4a03055268ecca147e.tar.gz podman-c7c00ce55199c1e569953a4a03055268ecca147e.tar.bz2 podman-c7c00ce55199c1e569953a4a03055268ecca147e.zip |
Add more machine tests
Add more machine tests for flags in init, inspect, and list.
Signed-off-by: Ashley Cui <acui@redhat.com>
Diffstat (limited to 'cmd/podman/machine')
-rw-r--r-- | cmd/podman/machine/list.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/cmd/podman/machine/list.go b/cmd/podman/machine/list.go index ef26b7886..5254d50cf 100644 --- a/cmd/podman/machine/list.go +++ b/cmd/podman/machine/list.go @@ -43,7 +43,7 @@ type listFlagType struct { quiet bool } -type machineReporter struct { +type ListReporter struct { Name string Default bool Created string @@ -68,7 +68,7 @@ func init() { flags := lsCmd.Flags() formatFlagName := "format" flags.StringVar(&listFlag.format, formatFlagName, "{{.Name}}\t{{.VMType}}\t{{.Created}}\t{{.LastUp}}\t{{.CPUs}}\t{{.Memory}}\t{{.DiskSize}}\n", "Format volume output using JSON or a Go template") - _ = lsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&machineReporter{})) + _ = lsCmd.RegisterFlagCompletionFunc(formatFlagName, common.AutocompleteFormat(&ListReporter{})) flags.BoolVar(&listFlag.noHeading, "noheading", false, "Do not print headers") flags.BoolVarP(&listFlag.quiet, "quiet", "q", false, "Show only machine names") } @@ -121,8 +121,8 @@ func list(cmd *cobra.Command, args []string) error { return outputTemplate(cmd, machineReporter) } -func outputTemplate(cmd *cobra.Command, responses []*machineReporter) error { - headers := report.Headers(machineReporter{}, map[string]string{ +func outputTemplate(cmd *cobra.Command, responses []*ListReporter) error { + headers := report.Headers(ListReporter{}, map[string]string{ "LastUp": "LAST UP", "VmType": "VM TYPE", "CPUs": "CPUS", @@ -181,15 +181,15 @@ func streamName(imageStream string) string { return imageStream } -func toMachineFormat(vms []*machine.ListResponse) ([]*machineReporter, error) { +func toMachineFormat(vms []*machine.ListResponse) ([]*ListReporter, error) { cfg, err := config.ReadCustomConfig() if err != nil { return nil, err } - machineResponses := make([]*machineReporter, 0, len(vms)) + machineResponses := make([]*ListReporter, 0, len(vms)) for _, vm := range vms { - response := new(machineReporter) + response := new(ListReporter) response.Default = vm.Name == cfg.Engine.ActiveService response.Name = vm.Name response.Running = vm.Running @@ -209,15 +209,15 @@ func toMachineFormat(vms []*machine.ListResponse) ([]*machineReporter, error) { return machineResponses, nil } -func toHumanFormat(vms []*machine.ListResponse) ([]*machineReporter, error) { +func toHumanFormat(vms []*machine.ListResponse) ([]*ListReporter, error) { cfg, err := config.ReadCustomConfig() if err != nil { return nil, err } - humanResponses := make([]*machineReporter, 0, len(vms)) + humanResponses := make([]*ListReporter, 0, len(vms)) for _, vm := range vms { - response := new(machineReporter) + response := new(ListReporter) if vm.Name == cfg.Engine.ActiveService { response.Name = vm.Name + "*" response.Default = true |