@@ -27,12 +27,14 @@ import (
27
27
"os"
28
28
"testing"
29
29
30
+ corev1 "k8s.io/api/core/v1"
31
+
30
32
. "github.com/apache/camel-k/e2e/support"
31
33
testutil "github.com/apache/camel-k/e2e/support/util"
32
34
. "github.com/onsi/gomega"
33
35
)
34
36
35
- func TestBasicOperator (t * testing.T ) {
37
+ func TestOperatorBasic (t * testing.T ) {
36
38
makeDir := testutil .MakeTempCopyDir (t , "../../../../install" )
37
39
os .Setenv ("CAMEL_K_TEST_MAKE_DIR" , makeDir )
38
40
@@ -43,18 +45,24 @@ func TestBasicOperator(t *testing.T) {
43
45
defer Cleanup ()
44
46
45
47
WithNewTestNamespace (t , func (ns string ) {
46
- ExecMake (t , Make ("setup-cluster" , fmt .Sprintf ("NAMESPACE=%s" , ns )))
47
- ExecMake (t , Make ("setup" , fmt .Sprintf ("NAMESPACE=%s" , ns )))
48
+ namespaceArg := fmt .Sprintf ("NAMESPACE=%s" , ns )
49
+ ExpectExecSucceed (t , Make ("setup-cluster" , namespaceArg ))
50
+ ExpectExecSucceed (t , Make ("setup" , namespaceArg ))
48
51
// Skip default kamelets installation for faster test runs
49
- ExecMake (t , Make ("operator" ,
50
- fmt . Sprintf ( "NAMESPACE=%s" , ns ) ,
52
+ ExpectExecSucceed (t , Make ("operator" ,
53
+ namespaceArg ,
51
54
"INSTALL_DEFAULT_KAMELETS=false" ))
52
55
56
+ // Refresh the test client to account for the newly installed CRDs
57
+ SyncClient ()
58
+
53
59
Eventually (OperatorPod (ns )).ShouldNot (BeNil ())
60
+ Eventually (OperatorPodPhase (ns ), TestTimeoutMedium ).Should (Equal (corev1 .PodRunning ))
61
+ Eventually (Platform (ns )).ShouldNot (BeNil ())
54
62
})
55
63
}
56
64
57
- func TestAlternativeImageOperator (t * testing.T ) {
65
+ func TestOperatorAlternativeImage (t * testing.T ) {
58
66
makeDir := testutil .MakeTempCopyDir (t , "../../../../install" )
59
67
os .Setenv ("CAMEL_K_TEST_MAKE_DIR" , makeDir )
60
68
@@ -65,24 +73,27 @@ func TestAlternativeImageOperator(t *testing.T) {
65
73
defer Cleanup ()
66
74
67
75
WithNewTestNamespace (t , func (ns string ) {
68
-
69
- ExecMake (t , Make ("setup-cluster" , fmt . Sprintf ( "NAMESPACE=%s" , ns ) ))
70
- ExecMake (t , Make ("setup" , fmt . Sprintf ( "NAMESPACE=%s" , ns ) ))
76
+ namespaceArg := fmt . Sprintf ( "NAMESPACE=%s" , ns )
77
+ ExpectExecSucceed (t , Make ("setup-cluster" , namespaceArg ))
78
+ ExpectExecSucceed (t , Make ("setup" , namespaceArg ))
71
79
72
80
// Skip default kamelets installation for faster test runs
73
81
newImage := "quay.io/kameltest/kamel-operator"
74
82
newTag := "1.1.1"
75
- ExecMake (t , Make ("operator" ,
83
+ ExpectExecSucceed (t , Make ("operator" ,
76
84
fmt .Sprintf ("CUSTOM_IMAGE=%s" , newImage ),
77
85
fmt .Sprintf ("CUSTOM_VERSION=%s" , newTag ),
78
- fmt . Sprintf ( "NAMESPACE=%s" , ns ) ,
86
+ namespaceArg ,
79
87
"INSTALL_DEFAULT_KAMELETS=false" ))
80
88
89
+ // Refresh the test client to account for the newly installed CRDs
90
+ SyncClient ()
91
+
81
92
Eventually (OperatorImage (ns )).Should (Equal (fmt .Sprintf ("%s:%s" , newImage , newTag )))
82
93
})
83
94
}
84
95
85
- func TestGlobalOperator (t * testing.T ) {
96
+ func TestOperatorGlobal (t * testing.T ) {
86
97
makeDir := testutil .MakeTempCopyDir (t , "../../../../install" )
87
98
os .Setenv ("CAMEL_K_TEST_MAKE_DIR" , makeDir )
88
99
@@ -93,17 +104,22 @@ func TestGlobalOperator(t *testing.T) {
93
104
defer Cleanup ()
94
105
95
106
WithNewTestNamespace (t , func (ns string ) {
96
- ExecMake (t , Make ("setup-cluster" , fmt .Sprintf ("NAMESPACE=%s" , ns )))
97
- ExecMake (t , Make ("setup" , fmt .Sprintf ("NAMESPACE=%s" , ns ), "GLOBAL=true" ))
107
+ namespaceArg := fmt .Sprintf ("NAMESPACE=%s" , ns )
108
+ ExpectExecSucceed (t , Make ("setup-cluster" , namespaceArg ))
109
+ ExpectExecSucceed (t , Make ("setup" , namespaceArg , "GLOBAL=true" ))
98
110
99
111
// Skip default kamelets installation for faster test runs
100
- ExecMake (t , Make ("operator" ,
101
- fmt . Sprintf ( "NAMESPACE=%s" , ns ) ,
112
+ ExpectExecSucceed (t , Make ("operator" ,
113
+ namespaceArg ,
102
114
"GLOBAL=true" ,
103
115
"INSTALL_DEFAULT_KAMELETS=false" ))
104
116
117
+ // Refresh the test client to account for the newly installed CRDs
118
+ SyncClient ()
119
+
105
120
podFunc := OperatorPod (ns )
106
- Eventually (podFunc ).Should (Not (BeNil ()))
121
+ Eventually (podFunc ).ShouldNot (BeNil ())
122
+ Eventually (OperatorPodPhase (ns ), TestTimeoutMedium ).Should (Equal (corev1 .PodRunning ))
107
123
pod := podFunc ()
108
124
109
125
containers := pod .Spec .Containers
@@ -121,5 +137,7 @@ func TestGlobalOperator(t *testing.T) {
121
137
}
122
138
}
123
139
Expect (found ).To (BeTrue ())
140
+
141
+ Eventually (Platform (ns )).ShouldNot (BeNil ())
124
142
})
125
143
}
0 commit comments