From c7c00ce55199c1e569953a4a03055268ecca147e Mon Sep 17 00:00:00 2001 From: Ashley Cui Date: Thu, 5 May 2022 16:45:30 -0400 Subject: Add more machine tests Add more machine tests for flags in init, inspect, and list. Signed-off-by: Ashley Cui --- cmd/podman/machine/list.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'cmd/podman') 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 -- cgit v1.2.3-54-g00ecf