24
24
import eu .openanalytics .containerproxy .test .helpers .ShinyProxyClient ;
25
25
import eu .openanalytics .containerproxy .test .helpers .ShinyProxyInstance ;
26
26
import io .fabric8 .kubernetes .api .model .Pod ;
27
+ import org .junit .jupiter .api .AfterEach ;
27
28
import org .junit .jupiter .api .Assertions ;
28
29
import org .junit .jupiter .api .Test ;
29
30
import org .junit .jupiter .params .ParameterizedTest ;
@@ -51,6 +52,11 @@ private static Stream<Arguments> provideStringsForIsBlank() {
51
52
);
52
53
}
53
54
55
+ @ AfterEach
56
+ public void waitForCleanup () throws InterruptedException {
57
+ Thread .sleep (20_000 );
58
+ }
59
+
54
60
@ ParameterizedTest
55
61
@ MethodSource ("provideStringsForIsBlank" )
56
62
public void simple_recover_single_app_after_shutdown (String backend , String extraArgs ) throws IOException , InterruptedException {
@@ -89,8 +95,6 @@ public void simple_recover_single_app_after_shutdown(String backend, String extr
89
95
// 8. stop the proxy
90
96
Assertions .assertTrue (shinyProxyClient .stopProxy (id ));
91
97
92
- Thread .sleep (500 ); // Give ShinyProxy time to cleanup
93
-
94
98
// 9. stop the instance
95
99
instance2 .stop ();
96
100
} finally {
@@ -105,7 +109,7 @@ public void new_app_should_work_after_recovery(String backend, String extraArgs)
105
109
List <ShinyProxyInstance > instances = new ArrayList <>();
106
110
try {
107
111
// 1. create the instance
108
- ShinyProxyInstance instance1 = new ShinyProxyInstance ("1 " , String .format ("application-app-recovery_%s.yml" , backend ), extraArgs );
112
+ ShinyProxyInstance instance1 = new ShinyProxyInstance ("3 " , String .format ("application-app-recovery_%s.yml" , backend ), extraArgs );
109
113
instances .add (instance1 );
110
114
Assertions .assertTrue (instance1 .start ());
111
115
@@ -121,7 +125,7 @@ public void new_app_should_work_after_recovery(String backend, String extraArgs)
121
125
instance1 .stop ();
122
126
123
127
// 5. start the instance again
124
- ShinyProxyInstance instance2 = new ShinyProxyInstance ("2 " , String .format ("application-app-recovery_%s.yml" , backend ), extraArgs );
128
+ ShinyProxyInstance instance2 = new ShinyProxyInstance ("4 " , String .format ("application-app-recovery_%s.yml" , backend ), extraArgs );
125
129
instances .add (instance2 );
126
130
Assertions .assertTrue (instance2 .start ());
127
131
@@ -144,8 +148,6 @@ public void new_app_should_work_after_recovery(String backend, String extraArgs)
144
148
Assertions .assertTrue (shinyProxyClient .stopProxy (id1 ));
145
149
Assertions .assertTrue (shinyProxyClient .stopProxy (id2 ));
146
150
147
- Thread .sleep (1000 ); // Give ShinyProxy time to cleanup
148
-
149
151
// 9. stop the instance
150
152
instance2 .stop ();
151
153
} finally {
@@ -163,7 +165,7 @@ public void complex_recover_multiple_apps_after_shutdown(String backend, String
163
165
List <ShinyProxyInstance > instances = new ArrayList <>();
164
166
try {
165
167
// 1. create the instance
166
- ShinyProxyInstance instance1 = new ShinyProxyInstance ("1 " , String .format ("application-app-recovery_%s.yml" , backend ), extraArgs );
168
+ ShinyProxyInstance instance1 = new ShinyProxyInstance ("5 " , String .format ("application-app-recovery_%s.yml" , backend ), extraArgs );
167
169
instances .add (instance1 );
168
170
Assertions .assertTrue (instance1 .start ());
169
171
@@ -209,7 +211,7 @@ public void complex_recover_multiple_apps_after_shutdown(String backend, String
209
211
instance1 .stop ();
210
212
211
213
// 9. start the instance again
212
- ShinyProxyInstance instance2 = new ShinyProxyInstance ("2 " , String .format ("application-app-recovery_%s.yml" , backend ), extraArgs );
214
+ ShinyProxyInstance instance2 = new ShinyProxyInstance ("6 " , String .format ("application-app-recovery_%s.yml" , backend ), extraArgs );
213
215
instances .add (instance2 );
214
216
Assertions .assertTrue (instance2 .start ());
215
217
@@ -245,8 +247,6 @@ public void complex_recover_multiple_apps_after_shutdown(String backend, String
245
247
Assertions .assertTrue (shinyProxyClient3 .stopProxy (id5 ));
246
248
Assertions .assertTrue (shinyProxyClient3 .stopProxy (id6 ));
247
249
248
- Thread .sleep (2500 ); // Give ShinyProxy time to cleanup
249
-
250
250
// 17. stop the instance
251
251
instance2 .stop ();
252
252
} finally {
@@ -262,12 +262,12 @@ public void simple_recover_multiple_instances(String backend, String extraArgs)
262
262
List <ShinyProxyInstance > instances = new ArrayList <>();
263
263
try {
264
264
// 1. create the first instance
265
- ShinyProxyInstance instance1 = new ShinyProxyInstance ("1 " , String .format ("application-app-recovery_%s.yml" , backend ), 7583 , extraArgs );
265
+ ShinyProxyInstance instance1 = new ShinyProxyInstance ("7 " , String .format ("application-app-recovery_%s.yml" , backend ), 7583 , extraArgs );
266
266
instances .add (instance1 );
267
267
Assertions .assertTrue (instance1 .start ());
268
268
269
269
// 1. create the second instance
270
- ShinyProxyInstance instance2 = new ShinyProxyInstance ("2 " , String .format ("application-app-recovery_%s_2.yml" , backend ), 7584 , extraArgs );
270
+ ShinyProxyInstance instance2 = new ShinyProxyInstance ("8 " , String .format ("application-app-recovery_%s_2.yml" , backend ), 7584 , extraArgs );
271
271
instances .add (instance2 );
272
272
Assertions .assertTrue (instance2 .start ());
273
273
@@ -292,11 +292,11 @@ public void simple_recover_multiple_instances(String backend, String extraArgs)
292
292
instance2 .stop ();
293
293
294
294
// 5. start both instances again
295
- ShinyProxyInstance instance3 = new ShinyProxyInstance ("3 " , String .format ("application-app-recovery_%s.yml" , backend ), 7583 , extraArgs );
295
+ ShinyProxyInstance instance3 = new ShinyProxyInstance ("9 " , String .format ("application-app-recovery_%s.yml" , backend ), 7583 , extraArgs );
296
296
instances .add (instance3 );
297
297
Assertions .assertTrue (instance3 .start ());
298
298
299
- ShinyProxyInstance instance4 = new ShinyProxyInstance ("4 " , String .format ("application-app-recovery_%s_2.yml" , backend ), 7584 , extraArgs );
299
+ ShinyProxyInstance instance4 = new ShinyProxyInstance ("10 " , String .format ("application-app-recovery_%s_2.yml" , backend ), 7584 , extraArgs );
300
300
instances .add (instance4 );
301
301
Assertions .assertTrue (instance4 .start ());
302
302
@@ -315,8 +315,6 @@ public void simple_recover_multiple_instances(String backend, String extraArgs)
315
315
Assertions .assertTrue (shinyProxyClient1 .stopProxy (id1 ));
316
316
Assertions .assertTrue (shinyProxyClient2 .stopProxy (id2 ));
317
317
318
- Thread .sleep (1000 ); // Give ShinyProxy time to cleanup
319
-
320
318
// 9. stop the instance
321
319
instance3 .stop ();
322
320
instance4 .stop ();
@@ -332,7 +330,7 @@ public void kubernetes_multiple_namespaces() {
332
330
List <ShinyProxyInstance > instances = new ArrayList <>();
333
331
try {
334
332
// 1. create the instance
335
- ShinyProxyInstance instance1 = new ShinyProxyInstance ("1 " , "application-app-recovery_kubernetes_multi_ns.yml" );
333
+ ShinyProxyInstance instance1 = new ShinyProxyInstance ("11 " , "application-app-recovery_kubernetes_multi_ns.yml" );
336
334
instances .add (instance1 );
337
335
Assertions .assertTrue (instance1 .start ());
338
336
@@ -351,7 +349,7 @@ public void kubernetes_multiple_namespaces() {
351
349
instance1 .stop ();
352
350
353
351
// 5. start the instance again
354
- ShinyProxyInstance instance2 = new ShinyProxyInstance ("2 " , "application-app-recovery_kubernetes_multi_ns.yml" );
352
+ ShinyProxyInstance instance2 = new ShinyProxyInstance ("12 " , "application-app-recovery_kubernetes_multi_ns.yml" );
355
353
instances .add (instance2 );
356
354
Assertions .assertTrue (instance2 .start ());
357
355
@@ -366,8 +364,6 @@ public void kubernetes_multiple_namespaces() {
366
364
Assertions .assertTrue (shinyProxyClient .stopProxy (id1 ));
367
365
Assertions .assertTrue (shinyProxyClient .stopProxy (id2 ));
368
366
369
- Thread .sleep (1000 ); // Give ShinyProxy time to cleanup
370
-
371
367
// 9. stop the instance
372
368
instance2 .stop ();
373
369
} finally {
@@ -384,7 +380,7 @@ public void shutdown_should_cleanup_by_default() {
384
380
List <ShinyProxyInstance > instances = new ArrayList <>();
385
381
try {
386
382
// 1. create the instance
387
- ShinyProxyInstance instance1 = new ShinyProxyInstance ("1 " , "application-app-recovery_kubernetes_normal_shutdown.yml" );
383
+ ShinyProxyInstance instance1 = new ShinyProxyInstance ("13 " , "application-app-recovery_kubernetes_normal_shutdown.yml" );
388
384
instances .add (instance1 );
389
385
Assertions .assertTrue (instance1 .start ());
390
386
0 commit comments