Skip to content

Commit

Permalink
fix: option to use installed lima for SOCI e2e tests (#533)
Browse files Browse the repository at this point in the history
Issue #, if available:

Closes #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]>
  • Loading branch information
ginglis13 authored Aug 15, 2023
1 parent c97d2e9 commit 8b66659
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions e2e/vm/soci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package vm

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

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

ginkgo.BeforeEach(func() {
wd, err = os.Getwd()
gomega.Expect(err).Should(gomega.BeNil())
limaHomePathEnv = "LIMA_HOME=" + filepath.Join(wd, "../../_output/lima/data")
limactlO, err = option.New([]string{filepath.Join(wd, "../../_output/lima/bin/limactl")},
// Find lima paths. limactl is used to shell into the Finch VM and verify
// mounted snapshots match the expected SOCI snapshotter behavior.
if installed {
fpath, err = exec.LookPath("finch")
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
realFinchPath, err = filepath.EvalSymlinks(fpath)
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
limactlPath = filepath.Join(realFinchPath, "../../lima/bin/limactl")
limaHomePathEnv = "LIMA_HOME=" + filepath.Join(realFinchPath, "../../lima/data")
} else {
wd, err = os.Getwd()
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
limactlPath = filepath.Join(wd, "../../_output/lima/bin/limactl")
limaHomePathEnv = "LIMA_HOME=" + filepath.Join(wd, "../../_output/lima/data")
}

limactlO, err = option.New([]string{limactlPath},
option.Env([]string{limaHomePathEnv}))
gomega.Expect(err).Should(gomega.BeNil())
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
})

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

0 comments on commit 8b66659

Please sign in to comment.