@@ -38,8 +38,8 @@ public static int Main(string[] arguments)
3838 if ( string . IsNullOrEmpty ( Environment . GetEnvironmentVariable ( "NEST_YAML_FILE" ) ) )
3939 {
4040 // build always sets previous argument, assume we are running from the IDE or dotnet run
41- var yamlFile = TestConfiguration . LocateTestYamlFile ( ) ;
42- Environment . SetEnvironmentVariable ( "NEST_YAML_FILE" , yamlFile , EnvironmentVariableTarget . Process ) ;
41+ var yamlFile = TestConfiguration . LocateTestYamlFile ( ) ;
42+ Environment . SetEnvironmentVariable ( "NEST_YAML_FILE" , yamlFile , EnvironmentVariableTarget . Process ) ;
4343 }
4444
4545 // if version is passed this will take precedence over the version in the yaml file
@@ -64,12 +64,19 @@ public static int Main(string[] arguments)
6464 AppDomain . CurrentDomain . ProcessExit += ( s , ev ) => Instance ? . Dispose ( ) ;
6565 Console . CancelKeyPress += ( s , ev ) => Instance ? . Dispose ( ) ;
6666
67- if ( ! TryStartClientTestClusterBaseImplementation ( cluster ) && ! TryStartXPackClusterImplementation ( cluster ) )
67+ try
6868 {
69+ if ( TryStartClientTestClusterBaseImplementation ( cluster ) || TryStartXPackClusterImplementation ( cluster ) ) return 0 ;
70+
6971 Console . Error . WriteLine ( $ "Could not create an instance of '{ cluster . FullName } ") ;
7072 return 1 ;
7173 }
72- return 0 ;
74+ catch ( Exception e )
75+ {
76+ Console . WriteLine ( e ) ;
77+ Instance ? . Dispose ( ) ;
78+ throw ;
79+ }
7380 }
7481
7582 private static bool TryStartXPackClusterImplementation ( Type cluster )
@@ -94,7 +101,7 @@ private static bool TryStartClientTestClusterBaseImplementation(Type cluster)
94101 private static bool Run ( ICluster < EphemeralClusterConfiguration > instance )
95102 {
96103 TestConfiguration . Instance . DumpConfiguration ( ) ;
97- instance . Start ( ) ;
104+ using var start = instance . Start ( ) ;
98105 if ( ! instance . Started )
99106 {
100107 Console . Error . WriteLine ( $ "Failed to start cluster: '{ instance . GetType ( ) . FullName } ") ;
@@ -121,7 +128,7 @@ private static Type[] GetClusters()
121128
122129 return types
123130 . Where ( t => t . Implements ( typeof ( IEphemeralCluster ) ) )
124- . Where ( t=> ! t . IsAbstract )
131+ . Where ( t => ! t . IsAbstract )
125132 . ToArray ( ) ;
126133 }
127134 }
0 commit comments