@@ -87,16 +87,6 @@ public static void setUp()
8787 ByteArrayOutputStream stdOut = new ByteArrayOutputStream ();
8888 System .setOut (new PrintStream (stdOut ));
8989
90- // Cleanup existing stale resources.
91- Util .cleanUpExistingInstances ("test-instance" , PROJECT_ID , ZONE );
92- Util .cleanUpExistingInstanceTemplates ("test-global-inst-temp" , PROJECT_ID );
93- Util .cleanUpExistingRegionalInstanceTemplates ("test-regional-inst-temp" , PROJECT_ID , ZONE );
94- Util .cleanUpExistingReservations ("test-reserv-" , PROJECT_ID , ZONE );
95-
96- // Initialize the clients once for all tests
97- reservationsClient = ReservationsClient .create ();
98- instancesClient = InstancesClient .create ();
99-
10090 RESERVATION_NAME_GLOBAL = "test-reserv-global-" + UUID .randomUUID ();
10191 RESERVATION_NAME_REGIONAL = "test-reserv-regional-" + UUID .randomUUID ();
10292 GLOBAL_INSTANCE_TEMPLATE_URI = String .format ("projects/%s/global/instanceTemplates/%s" ,
@@ -105,6 +95,17 @@ public static void setUp()
10595 String .format ("projects/%s/regions/%s/instanceTemplates/%s" ,
10696 PROJECT_ID , REGION , REGIONAL_INSTANCE_TEMPLATE_NAME );
10797
98+ // Initialize the clients once for all tests
99+ reservationsClient = ReservationsClient .create ();
100+ instancesClient = InstancesClient .create ();
101+
102+ // Cleanup existing stale resources.
103+ Util .cleanUpExistingInstances ("test-instance" , PROJECT_ID , ZONE );
104+ Util .cleanUpExistingInstanceTemplates ("test-global-inst-temp" , PROJECT_ID );
105+ Util .cleanUpExistingRegionalInstanceTemplates ("test-regional-inst-temp" , PROJECT_ID , ZONE );
106+ Util .cleanUpExistingReservations ("test-reserv-" , PROJECT_ID , ZONE );
107+ TimeUnit .MINUTES .sleep (5 );
108+
108109 // Create instance template with GLOBAL location.
109110 CreateInstanceTemplate .createInstanceTemplate (PROJECT_ID , GLOBAL_INSTANCE_TEMPLATE_NAME );
110111 assertThat (stdOut .toString ())
0 commit comments