Skip to content

Commit

Permalink
replacing .New with .Run when possible
Browse files Browse the repository at this point in the history
Signed-off-by: Channing Gaddy <[email protected]>
  • Loading branch information
CodeChanning committed Aug 10, 2023
1 parent 3d32a8e commit 3635d25
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions e2e/vm/soci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ var testSoci = func(o *option.Option, installed bool) {
gomega.Expect(initCmdSession).Should(gexec.Exit(0))
command.New(o, "pull", FfmpegSociImage).WithTimeoutInSeconds(30).Run()
finchPullMounts := countMounts(limactlO)
command.New(o, "rmi", "-f", FfmpegSociImage).WithTimeoutInSeconds(30).Run()
command.Run(o, "rmi", "-f", FfmpegSociImage)
command.New(limactlO, "shell", "finch",
"sudo", "nerdctl", "--snapshotter=soci", "pull", FfmpegSociImage).WithTimeoutInSeconds(30).Run().Out.Contents()
"sudo", "nerdctl", "--snapshotter=soci", "pull", FfmpegSociImage).WithTimeoutInSeconds(30).Run()
nerdctlPullMounts := countMounts(limactlO)
command.New(o, "rmi", "-f", FfmpegSociImage).WithTimeoutInSeconds(30).Run()
command.Run(o, "rmi", "-f", FfmpegSociImage)
gomega.Expect(finchPullMounts).Should(gomega.Equal(nerdctlPullMounts))
})

Expand All @@ -62,18 +62,18 @@ var testSoci = func(o *option.Option, installed bool) {
gomega.Expect(initCmdSession).Should(gexec.Exit(0))
command.New(o, "run", FfmpegSociImage).WithTimeoutInSeconds(30).Run()
finchPullMounts := countMounts(limactlO)
command.New(o, "rmi", "-f", FfmpegSociImage).WithTimeoutInSeconds(30).Run()
command.Run(o, "rmi", "-f", FfmpegSociImage)
command.New(limactlO, "shell", "finch",
"sudo", "nerdctl", "--snapshotter=soci", "run", FfmpegSociImage).WithTimeoutInSeconds(30).Run().Out.Contents()
"sudo", "nerdctl", "--snapshotter=soci", "run", FfmpegSociImage).WithTimeoutInSeconds(30).Run()
nerdctlPullMounts := countMounts(limactlO)
command.New(o, "rmi", "-f", FfmpegSociImage).WithTimeoutInSeconds(30).Run()
command.Run(o, "rmi", "-f", FfmpegSociImage)
gomega.Expect(finchPullMounts).Should(gomega.Equal(nerdctlPullMounts))
})
})
}

// counts the mounts present in the VM after pulling an image.
func countMounts(limactlO *option.Option) int {
mountOutput := string(command.New(limactlO, "shell", "finch", "mount").WithTimeoutInSeconds(30).Run().Out.Contents())
mountOutput := command.StdoutStr(limactlO, "shell", "finch", "mount")
return strings.Count(mountOutput, sociMountString)
}

0 comments on commit 3635d25

Please sign in to comment.