@@ -63,21 +63,29 @@ class CatalogWatchIT {
6363
6464 private static KubernetesClient client ;
6565
66- private String busyboxServiceName ;
66+ private static String busyboxServiceName ;
6767
68- private String busyboxDeploymentName ;
68+ private static String busyboxDeploymentName ;
6969
70- private String appDeploymentName ;
70+ private static String appDeploymentName ;
7171
72- private String appServiceName ;
72+ private static String appServiceName ;
7373
74- private String appIngressName ;
74+ private static String appIngressName ;
7575
7676 @ BeforeAll
77- static void beforeAll () {
77+ static void beforeAll () throws Exception {
7878 K3S .start ();
7979 Config config = Config .fromKubeconfig (K3S .getKubeConfigYaml ());
8080 client = new DefaultKubernetesClient (config );
81+
82+ Commons .validateImage (APP_NAME , K3S );
83+ Commons .loadSpringCloudKubernetesImage (APP_NAME , K3S );
84+
85+ Fabric8Utils .setUp (client , "default" );
86+
87+ deployBusyboxManifests ();
88+ deployApp ();
8189 }
8290
8391 /**
@@ -90,24 +98,16 @@ static void beforeAll() {
9098 */
9199 @ SuppressWarnings ("unchecked" )
92100 @ Test
93- void testCatalogWatch () throws Exception {
94-
95- Commons .validateImage (APP_NAME , K3S );
96- Commons .loadSpringCloudKubernetesImage (APP_NAME , K3S );
97-
98- Fabric8Utils .setUp (client , "default" );
99-
100- deployBusyboxManifests ();
101- deployApp ();
101+ void testCatalogWatch () {
102102
103103 WebClient client = builder ().baseUrl ("localhost/result" ).build ();
104104 EndpointNameAndNamespace [] holder = new EndpointNameAndNamespace [2 ];
105105 ResolvableType resolvableType = ResolvableType .forClassWithGenerics (List .class , EndpointNameAndNamespace .class );
106106
107107 await ().pollInterval (Duration .ofSeconds (1 )).atMost (Duration .ofSeconds (240 )).until (() -> {
108108 List <EndpointNameAndNamespace > result = (List <EndpointNameAndNamespace >) client .method (HttpMethod .GET )
109- .retrieve ().bodyToMono (ParameterizedTypeReference .forType (resolvableType .getType ()))
110- .retryWhen (retrySpec ()).block ();
109+ .retrieve ().bodyToMono (ParameterizedTypeReference .forType (resolvableType .getType ()))
110+ .retryWhen (retrySpec ()).block ();
111111
112112 // we get 3 pods as input, but because they are sorted by name in the catalog
113113 // watcher implementation
@@ -139,8 +139,8 @@ void testCatalogWatch() throws Exception {
139139
140140 await ().pollInterval (Duration .ofSeconds (1 )).atMost (Duration .ofSeconds (240 )).until (() -> {
141141 List <EndpointNameAndNamespace > result = (List <EndpointNameAndNamespace >) client .method (HttpMethod .GET )
142- .retrieve ().bodyToMono (ParameterizedTypeReference .forType (resolvableType .getType ()))
143- .retryWhen (retrySpec ()).block ();
142+ .retrieve ().bodyToMono (ParameterizedTypeReference .forType (resolvableType .getType ()))
143+ .retryWhen (retrySpec ()).block ();
144144
145145 // we will only receive one pod here, our own
146146 if (result != null ) {
@@ -159,9 +159,14 @@ void testCatalogWatch() throws Exception {
159159
160160 }
161161
162- private void deployBusyboxManifests () {
162+ private static void deployBusyboxManifests () throws Exception {
163163
164164 Deployment deployment = client .apps ().deployments ().load (getBusyboxDeployment ()).get ();
165+
166+ String [] image = K8SUtils .getImageFromDeployment (deployment ).split (":" );
167+ Commons .pullImage (image [0 ], image [1 ], K3S );
168+ Commons .loadImage (image [0 ], image [1 ], "busybox" , K3S );
169+
165170 client .apps ().deployments ().inNamespace (NAMESPACE ).create (deployment );
166171 busyboxDeploymentName = deployment .getMetadata ().getName ();
167172
@@ -173,7 +178,7 @@ private void deployBusyboxManifests() {
173178
174179 }
175180
176- private void deployApp () {
181+ private static void deployApp () {
177182
178183 Deployment appDeployment = client .apps ().deployments ().load (getAppDeployment ()).get ();
179184
0 commit comments