@@ -111,6 +111,13 @@ public static void cleanup()
111111 final PrintStream out = System .out ;
112112 ByteArrayOutputStream stdOut = new ByteArrayOutputStream ();
113113 System .setOut (new PrintStream (stdOut ));
114+ // Cleanup existing stale resources.
115+ Util .cleanUpExistingInstanceTemplates ("test-global-inst-temp-" + javaVersion , PROJECT_ID );
116+ Util .cleanUpExistingRegionalInstanceTemplates (
117+ "test-regional-inst-temp-" + javaVersion , PROJECT_ID , ZONE );
118+ Util .cleanUpExistingReservations (
119+ "test-reserv-global-" + javaVersion , PROJECT_ID , ZONE );
120+ Util .cleanUpExistingReservations ("test-reserv-regional-" + javaVersion , PROJECT_ID , ZONE );
114121
115122 // Delete instance template with GLOBAL location.
116123 DeleteInstanceTemplate .deleteInstanceTemplate (PROJECT_ID , GLOBAL_INSTANCE_TEMPLATE_NAME );
@@ -137,13 +144,6 @@ public static void cleanup()
137144 NotFoundException .class ,
138145 () -> GetReservation .getReservation (PROJECT_ID , RESERVATION_NAME_REGIONAL , ZONE ));
139146
140- // Cleanup existing stale resources.
141- Util .cleanUpExistingInstanceTemplates ("test-global-inst-temp-" + javaVersion , PROJECT_ID );
142- Util .cleanUpExistingRegionalInstanceTemplates (
143- "test-regional-inst-temp-" + javaVersion , PROJECT_ID , ZONE );
144- Util .cleanUpExistingReservations (
145- "test-reserv-global-" + javaVersion , PROJECT_ID , ZONE );
146- Util .cleanUpExistingReservations ("test-reserv-regional-" + javaVersion , PROJECT_ID , ZONE );
147147
148148 // Close the client after all tests
149149 reservationsClient .close ();
0 commit comments