@@ -4,6 +4,8 @@ import com.cloudogu.gitops.integration.features.KubenetesApiTestSetup
4
4
import io.kubernetes.client.openapi.models.V1NamespaceList
5
5
import io.kubernetes.client.openapi.models.V1Pod
6
6
import io.kubernetes.client.openapi.models.V1PodList
7
+ import io.kubernetes.client.openapi.models.V1Service
8
+ import io.kubernetes.client.openapi.models.V1ServiceList
7
9
import org.junit.jupiter.api.BeforeAll
8
10
import org.junit.jupiter.api.Test
9
11
@@ -57,24 +59,24 @@ class GOPSmoketestsIT extends KubenetesApiTestSetup {
57
59
}
58
60
59
61
@Test
60
- void ensusreNamespacesExists () {
62
+ void ensureNamespacesExists () {
61
63
List<String > expectedNamespaces = [" argocd" ,
62
- " cert-manager" ,
63
- " default" ,
64
- " example-apps-production" ,
65
- " example-apps-staging" ,
66
- " ingress-nginx" ,
67
- " kube-node-lease" ,
68
- " kube-public" ,
69
- " kube-system" ,
70
- " monitoring" ,
71
- " secrets" ] as List<String >
64
+ " cert-manager" ,
65
+ " default" ,
66
+ " example-apps-production" ,
67
+ " example-apps-staging" ,
68
+ " ingress-nginx" ,
69
+ " kube-node-lease" ,
70
+ " kube-public" ,
71
+ " kube-system" ,
72
+ " monitoring" ,
73
+ " secrets" ] as List<String >
72
74
73
75
74
76
V1NamespaceList list = api. listNamespace(). execute()
75
77
// list.items.each {println it.getMetadata().getName()} // print namespaces
76
78
List<String > listOfNamespaces = list. getItems(). collect { it. getMetadata(). name }
77
- assertThat (expectedNamespaces). containsAll (listOfNamespaces)
79
+ assertThat (expectedNamespaces). containsAll(listOfNamespaces)
78
80
79
81
}
80
82
@@ -101,11 +103,16 @@ class GOPSmoketestsIT extends KubenetesApiTestSetup {
101
103
@Override
102
104
boolean isReadyToStartTests () {
103
105
V1PodList list = api. listPodForAllNamespaces()
104
- .execute();
105
- if (list && ! list. items. isEmpty()) {
106
+ .execute()
107
+ V1ServiceList services = api. listServiceForAllNamespaces()
108
+ .execute()
109
+ if (list && ! list. items. isEmpty() &&
110
+ services && ! services. items. isEmpty()) {
111
+
112
+ V1Pod argoPod = list. getItems(). find { it. getMetadata(). getName(). startsWith(" argo" )}
113
+ V1Service service = services. getItems()find { it. getMetadata(). getName(). startsWith(" ingress" )}
106
114
107
- V1Pod argoPod = list. getItems(). find { it. getMetadata(). getName(). startsWith(" argo" ) }
108
- if (argoPod) {
115
+ if (argoPod && service) {
109
116
return true
110
117
}
111
118
}
0 commit comments