@@ -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
@@ -61,12 +61,19 @@ public static int Main(string[] arguments)
6161 AppDomain . CurrentDomain . ProcessExit += ( s , ev ) => Instance ? . Dispose ( ) ;
6262 Console . CancelKeyPress += ( s , ev ) => Instance ? . Dispose ( ) ;
6363
64- if ( ! TryStartClientTestClusterBaseImplementation ( cluster ) && ! TryStartXPackClusterImplementation ( cluster ) )
64+ try
6565 {
66+ if ( TryStartClientTestClusterBaseImplementation ( cluster ) || TryStartXPackClusterImplementation ( cluster ) ) return 0 ;
67+
6668 Console . Error . WriteLine ( $ "Could not create an instance of '{ cluster . FullName } ") ;
6769 return 1 ;
6870 }
69- return 0 ;
71+ catch ( Exception e )
72+ {
73+ Console . WriteLine ( e ) ;
74+ Instance ? . Dispose ( ) ;
75+ throw ;
76+ }
7077 }
7178
7279 private static bool TryStartXPackClusterImplementation ( Type cluster )
@@ -91,7 +98,7 @@ private static bool TryStartClientTestClusterBaseImplementation(Type cluster)
9198 private static bool Run ( ICluster < EphemeralClusterConfiguration > instance )
9299 {
93100 TestConfiguration . Instance . DumpConfiguration ( ) ;
94- instance . Start ( ) ;
101+ using var start = instance . Start ( ) ;
95102 if ( ! instance . Started )
96103 {
97104 Console . Error . WriteLine ( $ "Failed to start cluster: '{ instance . GetType ( ) . FullName } ") ;
@@ -118,7 +125,7 @@ private static Type[] GetClusters()
118125
119126 return types
120127 . Where ( t => t . Implements ( typeof ( IEphemeralCluster ) ) )
121- . Where ( t=> ! t . IsAbstract )
128+ . Where ( t => ! t . IsAbstract )
122129 . ToArray ( ) ;
123130 }
124131 }
0 commit comments