Browse code

[integration] add main_test for image test

Adds a main_test for the image integration test, so we can download
frozen images, and clean up after the image test is ran

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>

Christopher Jones authored on 2017/11/23 01:13:32
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,33 @@
0
+package image
1
+
2
+import (
3
+	"fmt"
4
+	"os"
5
+	"testing"
6
+
7
+	"github.com/docker/docker/internal/test/environment"
8
+)
9
+
10
+var testEnv *environment.Execution
11
+
12
+func TestMain(m *testing.M) {
13
+	var err error
14
+	testEnv, err = environment.New()
15
+	if err != nil {
16
+		fmt.Println(err)
17
+		os.Exit(1)
18
+	}
19
+	err = environment.EnsureFrozenImagesLinux(testEnv)
20
+	if err != nil {
21
+		fmt.Println(err)
22
+		os.Exit(1)
23
+	}
24
+
25
+	testEnv.Print()
26
+	os.Exit(m.Run())
27
+}
28
+
29
+func setupTest(t *testing.T) func() {
30
+	environment.ProtectAll(t, testEnv)
31
+	return func() { testEnv.Clean(t) }
32
+}