Skip to content

Commit 8b66659

Browse files
authored
fix: option to use installed lima for SOCI e2e tests (runfinch#533)
Issue #, if available: Closes runfinch#532 *Description of changes:* to verify SOCI snapshotter is working correctly, limactl is used to shell into the Finch VM and check that mounted snapshots match the expected created by SOCI. In our nightly builds we test against an installed version of Finch, but the previous SOCI e2e tests did not account for this. Now, branch on `installed` to determine which lima path to use. *Testing done:* For testing, I uninstalled Finch, reinstalled from brew, and tested that pathing matched the installation with `INSTALLED=true make test-e2e-vm` and some debug statements. `INSTALLED=false make test-e2e-vm` also still works. - [X] I've reviewed the guidance in CONTRIBUTING.md #### License Acceptance By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. Signed-off-by: Gavin Inglis <[email protected]>
1 parent c97d2e9 commit 8b66659

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

Diff for: e2e/vm/soci_test.go

+20-7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package vm
55

66
import (
77
"os"
8+
"os/exec"
89
"path/filepath"
910
"strings"
1011

@@ -22,17 +23,29 @@ const (
2223
var testSoci = func(o *option.Option, installed bool) {
2324
ginkgo.Describe("SOCI", func() {
2425
var limactlO *option.Option
25-
var limaHomePathEnv string
26-
var wd string
26+
var fpath, realFinchPath, limactlPath, limaHomePathEnv, wd string
2727
var err error
2828

2929
ginkgo.BeforeEach(func() {
30-
wd, err = os.Getwd()
31-
gomega.Expect(err).Should(gomega.BeNil())
32-
limaHomePathEnv = "LIMA_HOME=" + filepath.Join(wd, "../../_output/lima/data")
33-
limactlO, err = option.New([]string{filepath.Join(wd, "../../_output/lima/bin/limactl")},
30+
// Find lima paths. limactl is used to shell into the Finch VM and verify
31+
// mounted snapshots match the expected SOCI snapshotter behavior.
32+
if installed {
33+
fpath, err = exec.LookPath("finch")
34+
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
35+
realFinchPath, err = filepath.EvalSymlinks(fpath)
36+
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
37+
limactlPath = filepath.Join(realFinchPath, "../../lima/bin/limactl")
38+
limaHomePathEnv = "LIMA_HOME=" + filepath.Join(realFinchPath, "../../lima/data")
39+
} else {
40+
wd, err = os.Getwd()
41+
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
42+
limactlPath = filepath.Join(wd, "../../_output/lima/bin/limactl")
43+
limaHomePathEnv = "LIMA_HOME=" + filepath.Join(wd, "../../_output/lima/data")
44+
}
45+
46+
limactlO, err = option.New([]string{limactlPath},
3447
option.Env([]string{limaHomePathEnv}))
35-
gomega.Expect(err).Should(gomega.BeNil())
48+
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
3649
})
3750

3851
ginkgo.It("finch pull should have same mounts as nerdctl pull with SOCI", func() {

0 commit comments

Comments
 (0)