github.com/containers/podman/v4@v4.9.4/pkg/machine/e2e/config_set_test.go (about) 1 package e2e_test 2 3 import ( 4 "strconv" 5 ) 6 7 type setMachine struct { 8 cpus *uint 9 diskSize *uint 10 memory *uint 11 rootful bool 12 userModeNetworking bool 13 14 cmd []string 15 } 16 17 func (i *setMachine) buildCmd(m *machineTestBuilder) []string { 18 cmd := []string{"machine", "set"} 19 if i.cpus != nil { 20 cmd = append(cmd, "--cpus", strconv.Itoa(int(*i.cpus))) 21 } 22 if i.diskSize != nil { 23 cmd = append(cmd, "--disk-size", strconv.Itoa(int(*i.diskSize))) 24 } 25 if i.memory != nil { 26 cmd = append(cmd, "--memory", strconv.Itoa(int(*i.memory))) 27 } 28 if i.rootful { 29 cmd = append(cmd, "--rootful") 30 } 31 if i.userModeNetworking { 32 cmd = append(cmd, "--user-mode-networking") 33 } 34 cmd = append(cmd, m.name) 35 i.cmd = cmd 36 return cmd 37 } 38 39 func (i *setMachine) withCPUs(num uint) *setMachine { 40 i.cpus = &num 41 return i 42 } 43 func (i *setMachine) withDiskSize(size uint) *setMachine { 44 i.diskSize = &size 45 return i 46 } 47 48 func (i *setMachine) withMemory(num uint) *setMachine { 49 i.memory = &num 50 return i 51 } 52 53 func (i *setMachine) withRootful(r bool) *setMachine { 54 i.rootful = r 55 return i 56 } 57 58 func (i *setMachine) withUserModeNetworking(r bool) *setMachine { 59 i.userModeNetworking = r 60 return i 61 }