Skip to content

Commit

Permalink
fix: setup local registry before trying to run tests (#284)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
pendo324 authored Mar 27, 2024
1 parent baf528f commit 180e3bf
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 54 deletions.
102 changes: 51 additions & 51 deletions e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
4 changes: 2 additions & 2 deletions e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 180e3bf

Please sign in to comment.