44package e2e
55
66import (
7+ "fmt"
78 "os"
89 "testing"
910
@@ -15,11 +16,104 @@ import (
1516 "github.com/runfinch/finch-daemon/e2e/tests"
1617)
1718
19+ // func TestRun(t *testing.T) {
20+ // if os.Getenv("TEST_E2E") != "1" {
21+ // t.Skip("E2E tests skipped. Set TEST_E2E=1 to run these tests")
22+ // }
23+ // // TODO : Make this configurable
24+ // runtimeExe := "nerdctl"
25+ // opt, _ := option.New([]string{runtimeExe, "-n", "finch"})
26+
27+ // ginkgo.SynchronizedBeforeSuite(func() []byte {
28+ // tests.SetupLocalRegistry(opt)
29+ // return nil
30+ // }, func(bytes []byte) {})
31+
32+ // ginkgo.SynchronizedAfterSuite(func() {
33+ // tests.CleanupLocalRegistry(opt)
34+ // // clean up everything after the local registry is cleaned up
35+ // command.RemoveAll(opt)
36+ // }, func() {})
37+
38+ // const description = "Finch Daemon Functional test"
39+ // ginkgo.Describe(description, func() {
40+ // // functional test for container APIs
41+ // tests.ContainerCreate(opt)
42+ // tests.ContainerStart(opt)
43+ // tests.ContainerStop(opt)
44+ // tests.ContainerRestart(opt)
45+ // tests.ContainerRemove(opt)
46+ // tests.ContainerList(opt)
47+ // tests.ContainerRename(opt)
48+ // tests.ContainerStats(opt)
49+ // tests.ContainerAttach(opt)
50+ // tests.ContainerLogs(opt)
51+ // tests.ContainerKill(opt)
52+
53+ // // functional test for volume APIs
54+ // tests.VolumeList(opt)
55+ // tests.VolumeInspect(opt)
56+ // tests.VolumeRemove(opt)
57+
58+ // // functional test for network APIs
59+ // tests.NetworkCreate(opt)
60+ // tests.NetworkRemove(opt)
61+ // tests.NetworkList(opt)
62+ // tests.NetworkInspect(opt)
63+
64+ // // functional test for image APIs
65+ // tests.ImageRemove(opt)
66+ // tests.ImagePush(opt)
67+ // tests.ImagePull(opt)
68+
69+ // // functional test for system api
70+ // tests.SystemVersion(opt)
71+ // tests.SystemEvents(opt)
72+
73+ // // functional test for distribution api
74+ // tests.DistributionInspect(opt)
75+ // })
76+
77+ // gomega.RegisterFailHandler(ginkgo.Fail)
78+ // ginkgo.RunSpecs(t, description)
79+ // }
80+
1881func TestRun (t * testing.T ) {
19- if os .Getenv ("TEST_E2E" ) != "1" {
20- t .Skip ("E2E tests skipped. Set TEST_E2E=1 to run these tests" )
82+ if os .Getenv ("OPA_E2E" ) == "1" {
83+ runOPATests (t )
84+ } else if os .Getenv ("TEST_E2E" ) == "1" {
85+ runE2ETests (t )
86+ } else {
87+ t .Skip ("E2E tests skipped. Set TEST_E2E=1 to run regular E2E tests or OPA_E2E=1 to run OPA tests" )
2188 }
22- // TODO : Make this configurable
89+ }
90+
91+ func runOPATests (t * testing.T ) {
92+ runtimeExe := "nerdctl"
93+ opt , _ := option .New ([]string {runtimeExe , "-n" , "finch" })
94+
95+ ginkgo .SynchronizedBeforeSuite (func () []byte {
96+ tests .SetupLocalRegistry (opt )
97+ return nil
98+ }, func (bytes []byte ) {})
99+
100+ ginkgo .SynchronizedAfterSuite (func () {
101+ tests .CleanupLocalRegistry (opt )
102+ // clean up everything after the local registry is cleaned up
103+ command .RemoveAll (opt )
104+ }, func () {})
105+
106+ const description = "Finch Daemon OPA E2E Tests"
107+ ginkgo .Describe (description , func () {
108+ tests .OpaMiddlewareTest (opt )
109+ fmt .Print (opt )
110+ })
111+
112+ gomega .RegisterFailHandler (ginkgo .Fail )
113+ ginkgo .RunSpecs (t , description )
114+ }
115+
116+ func runE2ETests (t * testing.T ) {
23117 runtimeExe := "nerdctl"
24118 opt , _ := option .New ([]string {runtimeExe , "-n" , "finch" })
25119
0 commit comments