@@ -155,30 +155,10 @@ protected void before() throws Throwable {
155
155
}
156
156
157
157
@ Override
158
- public TestManager getTestManager () {
159
- return new TestManager () {
160
- @ Override
161
- public void testFinished () {
162
- stateManager .setTestDidPassIfNotFailed ();
163
- }
164
-
165
- @ Override
166
- public void testDidFail (GalvanFailureException failure ) {
167
- stateManager .testDidFail (failure );
168
- }
169
-
170
- @ Override
171
- public boolean isComplete () throws GalvanFailureException {
172
- return stateManager .checkDidPass ();
173
- }
174
- };
158
+ public ClusterInfo getClusterInfo () {
159
+ return this .cluster .getClusterInfo ();
175
160
}
176
161
177
- @ Override
178
- public ClusterInfo getClusterInfo () {
179
- return this .cluster .getClusterInfo ();
180
- }
181
-
182
162
private void internalStart (CompletableFuture <Void > checker ) throws Throwable {
183
163
VerboseLogger harnessLogger = new VerboseLogger (System .out , null );
184
164
VerboseLogger fileHelpersLogger = new VerboseLogger (null , null );
@@ -269,34 +249,30 @@ public void run() {
269
249
stateManager .waitForFinish ();
270
250
didPass = true ;
271
251
} catch (GalvanFailureException e ) {
272
- e .printStackTrace ();
273
252
checker .completeExceptionally (e );
274
253
didPass = false ;
275
254
} finally {
276
- // Whether we passed or failed, bring everything down.
255
+ setSafeForRun ( false );
277
256
try {
278
- interlock .forceShutdown ();
279
- } catch (Exception e ) {
280
- e .printStackTrace ();
281
- didPass = false ;
282
- } finally {
283
- setSafeForRun (false );
284
-
285
- serverPortRefs .forEach (PortManager .PortRef ::close );
286
- groupPortRefs .forEach (PortManager .PortRef ::close );
287
- debugPortRefs .stream ().filter (Objects ::nonNull ).forEach (PortManager .PortRef ::close );
288
-
289
- if (!didPass ) {
290
- // Typically, we want to interrupt the thread running as the "client" as it might be stuck in a connection
291
- // attempt, etc. When Galvan is run in the purely multi-process mode, this is typically where all
292
- // sub-processes would be terminated. Since we are running the client as another thread, in-process, the
293
- // best we can do is interrupt it from a lower-level blocking call.
294
- // NOTE: the "client" is also the thread which created us and will join on our termination, before
295
- // returning back to the user code so it is possible that this interruption could be experienced in its
296
- // join() call (in which case, we can safely ignore it).
297
- isInterruptingClient = true ;
298
- clientThread .interrupt ();
299
- }
257
+ // make sure all servers are down before releasing ports
258
+ interlock .waitForAllServerTerminated ();
259
+ } catch (GalvanFailureException ge ) {
260
+
261
+ }
262
+ serverPortRefs .forEach (PortManager .PortRef ::close );
263
+ groupPortRefs .forEach (PortManager .PortRef ::close );
264
+ debugPortRefs .stream ().filter (Objects ::nonNull ).forEach (PortManager .PortRef ::close );
265
+
266
+ if (!didPass ) {
267
+ // Typically, we want to interrupt the thread running as the "client" as it might be stuck in a connection
268
+ // attempt, etc. When Galvan is run in the purely multi-process mode, this is typically where all
269
+ // sub-processes would be terminated. Since we are running the client as another thread, in-process, the
270
+ // best we can do is interrupt it from a lower-level blocking call.
271
+ // NOTE: the "client" is also the thread which created us and will join on our termination, before
272
+ // returning back to the user code so it is possible that this interruption could be experienced in its
273
+ // join() call (in which case, we can safely ignore it).
274
+ isInterruptingClient = true ;
275
+ clientThread .interrupt ();
300
276
}
301
277
}
302
278
}
@@ -319,7 +295,6 @@ private void internalStop() {
319
295
try {
320
296
interlock .ignoreServerCrashes (true );
321
297
interlock .forceShutdown ();
322
- interlock .waitForAllServerTerminated ();
323
298
} catch (GalvanFailureException gf ) {
324
299
stateManager .testDidFail (gf );
325
300
}
0 commit comments