machine e2e : set default disk size to 11

this default value for podman machine disk sizes is 100GB.  On CI
platforms where the IO is slow and some operations are not done
sparsely, this can really slow things down.

if no disk size is provided by the init command in the test suite, we
set it to 11G.

Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
Brent Baude
2023-12-13 08:52:45 -06:00
parent 4582b61d7c
commit 446df4379f
3 changed files with 7 additions and 3 deletions

View File

@ -35,13 +35,15 @@ type initMachine struct {
}
func (i *initMachine) buildCmd(m *machineTestBuilder) []string {
diskSize := defaultDiskSize
cmd := []string{"machine", "init"}
if i.cpus != nil {
cmd = append(cmd, "--cpus", strconv.Itoa(int(*i.cpus)))
}
if i.diskSize != nil {
cmd = append(cmd, "--disk-size", strconv.Itoa(int(*i.diskSize)))
diskSize = *i.diskSize
}
cmd = append(cmd, "--disk-size", strconv.Itoa(int(diskSize)))
if l := len(i.ignitionPath); l > 0 {
cmd = append(cmd, "--ignition-path", i.ignitionPath)
}

View File

@ -25,7 +25,8 @@ func TestMain(m *testing.M) {
}
const (
defaultStream = machine.Testing
defaultStream = machine.Testing
defaultDiskSize uint = 11
)
var (

View File

@ -1,6 +1,7 @@
package e2e_test
import (
"fmt"
"runtime"
"strconv"
"strings"
@ -131,7 +132,7 @@ var _ = Describe("podman machine set", func() {
sshSession3, err := mb.setName(name).setCmd(ssh3.withSSHCommand([]string{"sudo", "fdisk", "-l", "|", "grep", "Disk"})).run()
Expect(err).ToNot(HaveOccurred())
Expect(sshSession3).To(Exit(0))
Expect(sshSession3.outputToString()).To(ContainSubstring("100 GiB"))
Expect(sshSession3.outputToString()).To(ContainSubstring(fmt.Sprintf("%d GiB", defaultDiskSize)))
})
It("set rootful with docker sock change", func() {