Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(bug-fix): use local registry for VZ/Rosetta tests #327

Merged
merged 9 commits into from
Apr 7, 2023
14 changes: 12 additions & 2 deletions e2e/vm/virtualization_framework_rosetta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,14 @@ var testVirtualizationFrameworkAndRosetta = func(o *option.Option, installed boo
}

resetVM(o, installed)
resetDisks(o, installed)
writeFile(finchConfigFilePath, []byte("memory: 4GiB\ncpus: 6\nvmType: vz\nrosetta: false"))
initCmdSession := command.New(o, virtualMachineRootCmd, "init").WithTimeoutInSeconds(180).Run()
initCmdSession := command.New(o, virtualMachineRootCmd, "init").WithTimeoutInSeconds(600).Run()
gomega.Expect(initCmdSession).Should(gexec.Exit(0))
tests.SetupLocalRegistry(o)
ginkgo.DeferCleanup(func() {
tests.CleanupLocalRegistry(o)
})
})

// Run sanity check tests
Expand All @@ -47,9 +52,14 @@ var testVirtualizationFrameworkAndRosetta = func(o *option.Option, installed boo
}

resetVM(o, installed)
resetDisks(o, installed)
writeFile(finchConfigFilePath, []byte("memory: 4GiB\ncpus: 6\nvmType: vz\nrosetta: true"))
initCmdSession := command.New(o, virtualMachineRootCmd, "init").WithTimeoutInSeconds(180).Run()
initCmdSession := command.New(o, virtualMachineRootCmd, "init").WithTimeoutInSeconds(600).Run()
gomega.Expect(initCmdSession).Should(gexec.Exit(0))
tests.SetupLocalRegistry(o)
ginkgo.DeferCleanup(func() {
tests.CleanupLocalRegistry(o)
})
})

// Run sanity check tests
Expand Down
15 changes: 15 additions & 0 deletions e2e/vm/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
package vm

import (
"os"
"os/exec"
"path"
"path/filepath"
"testing"

Expand Down Expand Up @@ -82,3 +84,16 @@ var resetVM = func(o *option.Option, installed bool) string {

return limaConfigFilePath
}

var resetDisks = func(o *option.Option, installed bool) {
if installed {
path, err := exec.LookPath(e2e.InstalledTestSubject)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
realFinchPath, err := filepath.EvalSymlinks(path)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
gomega.Expect(os.RemoveAll(filepath.Join(realFinchPath, "../../lima/data/_disks")))
} else {
gomega.Expect(os.RemoveAll("../../_output/lima/data/_disks")).ShouldNot(gomega.HaveOccurred())
}
gomega.Expect(os.RemoveAll(path.Join(os.Getenv("HOME"), ".finch", ".disks"))).ShouldNot(gomega.HaveOccurred())
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/onsi/gomega v1.27.5
github.com/pelletier/go-toml v1.9.5
github.com/pkg/sftp v1.13.5
github.com/runfinch/common-tests v0.6.3
github.com/runfinch/common-tests v0.6.4
github.com/sirupsen/logrus v1.9.0
github.com/spf13/afero v1.9.5
github.com/spf13/cobra v1.6.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/runfinch/common-tests v0.6.3 h1:Xbk2rzk3Un93wacbB3ACuRk4ujke6pqNyiCcIXhwk5U=
github.com/runfinch/common-tests v0.6.3/go.mod h1:/lEtd8e5vQuK1NjVCeCPl09T/XVF7owDeQCAiOP6rtw=
github.com/runfinch/common-tests v0.6.4 h1:pcBQBUmjS09L25S4e5tUzJvRg3OinCmn3f1t++tQcng=
github.com/runfinch/common-tests v0.6.4/go.mod h1:/lEtd8e5vQuK1NjVCeCPl09T/XVF7owDeQCAiOP6rtw=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
Expand Down