summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-04-08 07:28:10 -0700
committerGitHub <noreply@github.com>2019-04-08 07:28:10 -0700
commit60e5492743ba2ea3ee9ec839d7ad44f8fb41e6c8 (patch)
treed2cc43ed107fbd5a50f4edad6c4d54e4eab24cdb /test
parentd86729e743fb5a58b9364ee5e991b5db2e9dd600 (diff)
parent88b0e74e0bcd651cf00a9bdad3ebedd317330c91 (diff)
downloadpodman-60e5492743ba2ea3ee9ec839d7ad44f8fb41e6c8.tar.gz
podman-60e5492743ba2ea3ee9ec839d7ad44f8fb41e6c8.tar.bz2
podman-60e5492743ba2ea3ee9ec839d7ad44f8fb41e6c8.zip
Merge pull request #2841 from openSUSE/ginkgo-unit
Update registrar unit tests to match them of cri-o
Diffstat (limited to 'test')
-rw-r--r--test/framework/framework.go56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/framework/framework.go b/test/framework/framework.go
new file mode 100644
index 000000000..52401faf8
--- /dev/null
+++ b/test/framework/framework.go
@@ -0,0 +1,56 @@
+package framework
+
+import (
+ "fmt"
+
+ "github.com/onsi/ginkgo"
+ "github.com/onsi/gomega"
+)
+
+// TestFramework is used to support commonnly used test features
+type TestFramework struct {
+ setup func(*TestFramework) error
+ teardown func(*TestFramework) error
+ TestError error
+}
+
+// NewTestFramework creates a new test framework instance for a given `setup`
+// and `teardown` function
+func NewTestFramework(
+ setup func(*TestFramework) error,
+ teardown func(*TestFramework) error,
+) *TestFramework {
+ return &TestFramework{
+ setup,
+ teardown,
+ fmt.Errorf("error"),
+ }
+}
+
+// NilFn is a convenience function which simply does nothing
+func NilFunc(f *TestFramework) error {
+ return nil
+}
+
+// Setup is the global initialization function which runs before each test
+// suite
+func (t *TestFramework) Setup() {
+ // Global initialization for the whole framework goes in here
+
+ // Setup the actual test suite
+ gomega.Expect(t.setup(t)).To(gomega.Succeed())
+}
+
+// Teardown is the global deinitialization function which runs after each test
+// suite
+func (t *TestFramework) Teardown() {
+ // Global deinitialization for the whole framework goes in here
+
+ // Teardown the actual test suite
+ gomega.Expect(t.teardown(t)).To(gomega.Succeed())
+}
+
+// Describe is a convenience wrapper around the `ginkgo.Describe` function
+func (t *TestFramework) Describe(text string, body func()) bool {
+ return ginkgo.Describe("libpod: "+text, body)
+}