@@ -14,12 +14,13 @@ See the License for the specific language governing permissions and
14
14
limitations under the License.
15
15
*/
16
16
17
- package e2e
17
+ package v2
18
18
19
19
import (
20
20
"fmt"
21
21
"io/ioutil"
22
22
"path/filepath"
23
+ "sigs.k8s.io/kubebuilder/test/e2e/utils"
23
24
"strconv"
24
25
"strings"
25
26
"time"
@@ -30,10 +31,10 @@ import (
30
31
31
32
var _ = Describe ("kubebuilder" , func () {
32
33
Context ("with v2 scaffolding" , func () {
33
- var kbc * KBTestContext
34
+ var kbc * utils. KBTestContext
34
35
BeforeEach (func () {
35
36
var err error
36
- kbc , err = TestContext ("GO111MODULE=on" )
37
+ kbc , err = utils . TestContext ("GO111MODULE=on" )
37
38
Expect (err ).NotTo (HaveOccurred ())
38
39
Expect (kbc .Prepare ()).To (Succeed ())
39
40
@@ -73,7 +74,7 @@ var _ = Describe("kubebuilder", func() {
73
74
Expect (err ).Should (Succeed ())
74
75
75
76
By ("implementing the API" )
76
- Expect (insertCode (
77
+ Expect (utils . InsertCode (
77
78
filepath .Join (kbc .Dir , "api" , kbc .Version , fmt .Sprintf ("%s_types.go" , strings .ToLower (kbc .Kind ))),
78
79
fmt .Sprintf (`type %sSpec struct {
79
80
` , kbc .Kind ),
@@ -97,19 +98,19 @@ var _ = Describe("kubebuilder", func() {
97
98
Expect (err ).Should (Succeed ())
98
99
99
100
By ("uncomment kustomization.yaml to enable webhook and ca injection" )
100
- Expect (uncommentCode (
101
+ Expect (utils . UncommentCode (
101
102
filepath .Join (kbc .Dir , "config" , "default" , "kustomization.yaml" ),
102
103
"#- ../webhook" , "#" )).To (Succeed ())
103
- Expect (uncommentCode (
104
+ Expect (utils . UncommentCode (
104
105
filepath .Join (kbc .Dir , "config" , "default" , "kustomization.yaml" ),
105
106
"#- ../certmanager" , "#" )).To (Succeed ())
106
- Expect (uncommentCode (
107
+ Expect (utils . UncommentCode (
107
108
filepath .Join (kbc .Dir , "config" , "default" , "kustomization.yaml" ),
108
109
"#- manager_webhook_patch.yaml" , "#" )).To (Succeed ())
109
- Expect (uncommentCode (
110
+ Expect (utils . UncommentCode (
110
111
filepath .Join (kbc .Dir , "config" , "default" , "kustomization.yaml" ),
111
112
"#- webhookcainjection_patch.yaml" , "#" )).To (Succeed ())
112
- Expect (uncommentCode (filepath .Join (kbc .Dir , "config" , "default" , "kustomization.yaml" ),
113
+ Expect (utils . UncommentCode (filepath .Join (kbc .Dir , "config" , "default" , "kustomization.yaml" ),
113
114
`#- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
114
115
# objref:
115
116
# kind: Certificate
@@ -161,7 +162,7 @@ var _ = Describe("kubebuilder", func() {
161
162
"pods" , "-l" , "control-plane=controller-manager" ,
162
163
"-o" , "go-template={{ range .items }}{{ if not .metadata.deletionTimestamp }}{{ .metadata.name }}{{ \" \\ n\" }}{{ end }}{{ end }}" )
163
164
Expect (err ).NotTo (HaveOccurred ())
164
- podNames := getNonEmptyLines (podOutput )
165
+ podNames := utils . GetNonEmptyLines (podOutput )
165
166
if len (podNames ) != 1 {
166
167
return fmt .Errorf ("expect 1 controller pods running, but got %d" , len (podNames ))
167
168
}
0 commit comments