From 180e3bfc13fcb17227db634b07c149c991fc5256 Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 27 Mar 2024 19:07:54 -0400 Subject: [PATCH] fix: setup local registry before trying to run tests (#284) Issue #, if available: *Description of changes:* - Setup local registry before running tests *Testing done:* - Local testing - [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: Justin Alvarez --- e2e/e2e_test.go | 102 ++++++++++++++++++++++++------------------------ e2e/go.mod | 2 +- e2e/go.sum | 4 +- 3 files changed, 54 insertions(+), 54 deletions(-) diff --git a/e2e/e2e_test.go b/e2e/e2e_test.go index eef00c5..3b6727f 100644 --- a/e2e/e2e_test.go +++ b/e2e/e2e_test.go @@ -40,67 +40,67 @@ func TestE2e(t *testing.T) { subject := "limactl" vmConfigFile := filepath.Join(wd, "./../_output/lima-template/fedora.yaml") vmName := "fedora" - o, err := option.New([]string{subject}) + limaOpt, err := option.New([]string{subject}) + nerdctlOpt, err := option.New([]string{subject, "shell", "fedora", "sudo", "-E", "nerdctl"}) + if err != nil { + t.Fatalf("failed to initialize a testing option: %v", err) + } ginkgo.SynchronizedBeforeSuite(func() []byte { - command.New(o, "start", vmConfigFile).WithTimeoutInSeconds(600).Run() + command.New(limaOpt, "start", vmConfigFile).WithTimeoutInSeconds(600).Run() + tests.SetupLocalRegistry(nerdctlOpt) return nil }, func(bytes []byte) {}) ginkgo.SynchronizedAfterSuite(func() { - command.New(o, "stop", vmName).WithTimeoutInSeconds(90).Run() - command.New(o, "remove", vmName).WithTimeoutInSeconds(60).Run() + command.New(limaOpt, "stop", vmName).WithTimeoutInSeconds(90).Run() + command.New(limaOpt, "remove", vmName).WithTimeoutInSeconds(60).Run() }, func() {}) - opt, err := option.New([]string{subject, "shell", "fedora", "sudo", "-E", "nerdctl"}) - if err != nil { - t.Fatalf("failed to initialize a testing option: %v", err) - } - ginkgo.Describe(description, func() { // TODO: add more e2e tests and make them work. - tests.Save(opt) - tests.Load(opt) - tests.Pull(opt) - tests.Rm(opt) - tests.Rmi(opt) - tests.Start(opt) - tests.Stop(opt) - tests.Cp(opt) - tests.Tag(opt) - tests.Build(opt) - tests.Push(opt) - tests.Images(opt) - tests.ComposeBuild(opt) - tests.ComposeDown(opt) - tests.ComposeKill(opt) - tests.ComposePs(opt) - tests.ComposePull(opt) - tests.ComposeLogs(opt) - tests.Create(opt) - tests.Port(opt) - tests.Kill(opt) - tests.Stats(opt) - tests.BuilderPrune(opt) - tests.Exec(opt) - tests.Logs(opt) - tests.Login(opt) - tests.Logout(opt) - tests.VolumeCreate(opt) - tests.VolumeInspect(opt) - tests.VolumeLs(opt) - tests.VolumeRm(opt) - tests.VolumePrune(opt) - tests.ImageHistory(opt) - tests.ImageInspect(opt) - tests.ImagePrune(opt) - tests.Info(opt) - tests.Events(opt) - tests.Inspect(opt) - tests.NetworkCreate(opt) - tests.NetworkInspect(opt) - tests.NetworkLs(opt) - tests.NetworkRm(opt) + tests.Save(nerdctlOpt) + tests.Load(nerdctlOpt) + tests.Pull(nerdctlOpt) + tests.Rm(nerdctlOpt) + tests.Rmi(nerdctlOpt) + tests.Start(nerdctlOpt) + tests.Stop(nerdctlOpt) + tests.Cp(nerdctlOpt) + tests.Tag(nerdctlOpt) + tests.Build(nerdctlOpt) + tests.Push(nerdctlOpt) + tests.Images(nerdctlOpt) + tests.ComposeBuild(nerdctlOpt) + tests.ComposeDown(nerdctlOpt) + tests.ComposeKill(nerdctlOpt) + tests.ComposePs(nerdctlOpt) + tests.ComposePull(nerdctlOpt) + tests.ComposeLogs(nerdctlOpt) + tests.Create(nerdctlOpt) + tests.Port(nerdctlOpt) + tests.Kill(nerdctlOpt) + tests.Stats(nerdctlOpt) + tests.BuilderPrune(nerdctlOpt) + tests.Exec(nerdctlOpt) + tests.Logs(nerdctlOpt) + tests.Login(nerdctlOpt) + tests.Logout(nerdctlOpt) + tests.VolumeCreate(nerdctlOpt) + tests.VolumeInspect(nerdctlOpt) + tests.VolumeLs(nerdctlOpt) + tests.VolumeRm(nerdctlOpt) + tests.VolumePrune(nerdctlOpt) + tests.ImageHistory(nerdctlOpt) + tests.ImageInspect(nerdctlOpt) + tests.ImagePrune(nerdctlOpt) + tests.Info(nerdctlOpt) + tests.Events(nerdctlOpt) + tests.Inspect(nerdctlOpt) + tests.NetworkCreate(nerdctlOpt) + tests.NetworkInspect(nerdctlOpt) + tests.NetworkLs(nerdctlOpt) + tests.NetworkRm(nerdctlOpt) }) gomega.RegisterFailHandler(ginkgo.Fail) diff --git a/e2e/go.mod b/e2e/go.mod index 1989344..8e3a907 100644 --- a/e2e/go.mod +++ b/e2e/go.mod @@ -5,7 +5,7 @@ go 1.22.0 require ( github.com/onsi/ginkgo/v2 v2.17.1 github.com/onsi/gomega v1.32.0 - github.com/runfinch/common-tests v0.7.15 + github.com/runfinch/common-tests v0.7.20 ) require ( diff --git a/e2e/go.sum b/e2e/go.sum index 02be3d1..c2683e5 100644 --- a/e2e/go.sum +++ b/e2e/go.sum @@ -19,8 +19,8 @@ github.com/onsi/gomega v1.32.0 h1:JRYU78fJ1LPxlckP6Txi/EYqJvjtMrDC04/MM5XRHPk= github.com/onsi/gomega v1.32.0/go.mod h1:a4x4gW6Pz2yK1MAmvluYme5lvYTn61afQ2ETw/8n4Lg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/runfinch/common-tests v0.7.15 h1:gLYjCyYen0n0mImAefQaPxG+ARaLujQVIX7LiF9RycI= -github.com/runfinch/common-tests v0.7.15/go.mod h1:4JVWZRyjSQ5+X9DRP4tg/Uvxi80AK8pOoe0qrBDi4y4= +github.com/runfinch/common-tests v0.7.20 h1:GPb42S81eTWYffCSQl8puwurCGrDJqcgCJ9moivujS0= +github.com/runfinch/common-tests v0.7.20/go.mod h1:Gp3zzIUg1B0gM8TpiAlPxZpbyZneKyRFyBJ6PLODrOQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=