@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
5
5
you may not use this file except in compliance with the License.
6
6
You may obtain a copy of the License at
7
7
8
- http://www.apache.org/licenses/LICENSE-2.0
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
9
10
10
Unless required by applicable law or agreed to in writing, software
11
11
distributed under the License is distributed on an "AS IS" BASIS,
@@ -18,42 +18,30 @@ package e2e
18
18
19
19
import (
20
20
"fmt"
21
- "os"
22
21
"path/filepath"
23
22
"strings"
24
- "testing"
25
23
"time"
26
24
27
- "github.com/golang/glog"
28
25
"github.com/kubernetes-sigs/kubebuilder/cmd/kubebuilder/util"
29
26
"github.com/kubernetes-sigs/kubebuilder/test/e2e/framework"
30
- "github.com/kubernetes-sigs/kubebuilder/test/e2e/framework/ginkgowrapper"
31
27
e2einternal "github.com/kubernetes-sigs/kubebuilder/test/internal/e2e"
32
28
. "github.com/onsi/ginkgo"
33
29
. "github.com/onsi/gomega"
34
30
)
35
31
36
- // RunE2ETests checks configuration parameters (specified through flags) and then runs
37
- // E2E tests using the Ginkgo runner.
38
- func RunE2ETests (t * testing.T ) {
39
- RegisterFailHandler (ginkgowrapper .Fail )
40
- glog .Infof ("Starting kubebuilder suite" )
41
- RunSpecs (t , "Kubebuilder e2e suite" )
42
- }
43
-
44
- var _ = Describe ("main workflow" , func () {
32
+ var _ = Describe ("v0 main workflow" , func () {
45
33
It ("should perform main kubebuilder workflow successfully" , func () {
46
34
testSuffix := framework .RandomSuffix ()
47
35
c := initConfig (testSuffix )
48
36
kubebuilderTest := e2einternal .NewKubebuilderTest (c .workDir , framework .TestContext .BinariesDir )
49
37
50
38
prepare (c .workDir )
51
- defer cleanup (kubebuilderTest , c .workDir , c .controllerImageName )
39
+ defer cleanupv0 (kubebuilderTest , c .workDir , c .controllerImageName )
52
40
53
41
var controllerPodName string
54
42
55
43
By ("init project" )
56
- initOptions := []string {"--domain" , c .domain }
44
+ initOptions := []string {"--domain" , c .domain , "--project-version" , "v0" }
57
45
err := kubebuilderTest .Init (initOptions )
58
46
Expect (err ).NotTo (HaveOccurred ())
59
47
@@ -86,7 +74,7 @@ var _ = Describe("main workflow", func() {
86
74
Expect (err ).NotTo (HaveOccurred ())
87
75
88
76
By ("installing controller-manager in cluster" )
89
- inputFile := filepath .Join (kubebuilderTest . Dir , "hack" , "install.yaml" )
77
+ inputFile := filepath .Join ("hack" , "install.yaml" )
90
78
installOptions := []string {"apply" , "-f" , inputFile }
91
79
_ , err = kubebuilderTest .RunKubectlCommand (framework .GetKubectlArgs (installOptions ))
92
80
Expect (err ).NotTo (HaveOccurred ())
@@ -104,7 +92,7 @@ var _ = Describe("main workflow", func() {
104
92
return fmt .Errorf ("expect 1 controller pods running, but got %d" , len (podNames ))
105
93
}
106
94
controllerPodName = podNames [0 ]
107
- Expect (controllerPodName ).Should (HavePrefix (c .installName + "-controller-manager" ))
95
+ Expect (controllerPodName ).Should (HavePrefix (c .installName + "-controller-manager" ))
108
96
109
97
// Validate pod status
110
98
getOptions = []string {"get" , "pods" , controllerPodName , "-n" , c .namespace , "-o" , "jsonpath={.status.phase}" }
@@ -150,22 +138,3 @@ var _ = Describe("main workflow", func() {
150
138
Eventually (controllerContainerLogs , 1 * time .Minute , 500 * time .Millisecond ).Should (ContainSubstring ("to reconcile deployment-example" ))
151
139
})
152
140
})
153
-
154
- func prepare (workDir string ) {
155
- By ("create a path under given project dir, as the test work dir" )
156
- err := os .MkdirAll (workDir , 0755 )
157
- Expect (err ).NotTo (HaveOccurred ())
158
- }
159
-
160
- func cleanup (builderTest * e2einternal.KubebuilderTest , workDir string , imageName string ) {
161
- By ("clean up created API objects during test process" )
162
- inputFile := filepath .Join (workDir , "hack" , "install.yaml" )
163
- createOptions := []string {"delete" , "-f" , inputFile }
164
- builderTest .RunKubectlCommand (framework .GetKubectlArgs (createOptions ))
165
-
166
- By ("remove container image created during test" )
167
- builderTest .CleanupImage ([]string {imageName })
168
-
169
- By ("remove test work dir" )
170
- os .RemoveAll (workDir )
171
- }
0 commit comments