@@ -50,12 +50,12 @@ public class TpuVmIT {
5050 private static final String PROJECT_ID = System .getenv ("GOOGLE_CLOUD_PROJECT" );
5151 private static final String ZONE = "europe-west4-a" ;
5252 static String javaVersion = System .getProperty ("java.version" ).substring (0 , 2 );
53- private static final String TPU_VM_NAME = "test-tpu-" + javaVersion + "-"
53+ private static final String NODE_NAME = "test-tpu-" + javaVersion + "-"
5454 + UUID .randomUUID ().toString ().substring (0 , 8 );
55- private static final String ACCELERATOR_TYPE = "v2-8" ;
56- private static final String VERSION = "tpu-vm-tf-2.14.1" ;
57- private static final String TPU_VM_PATH_NAME =
58- String .format ("projects/%s/locations/%s/nodes/%s" , PROJECT_ID , ZONE , TPU_VM_NAME );
55+ private static final String TPU_TYPE = "v2-8" ;
56+ private static final String TPU_SOFTWARE_VERSION = "tpu-vm-tf-2.14.1" ;
57+ private static final String NODE_PATH_NAME =
58+ String .format ("projects/%s/locations/%s/nodes/%s" , PROJECT_ID , ZONE , NODE_NAME );
5959
6060 public static void requireEnvVar (String envVarName ) {
6161 assertWithMessage (String .format ("Missing environment variable '%s' " , envVarName ))
@@ -74,12 +74,12 @@ public static void setUp()
7474
7575 @ AfterAll
7676 public static void cleanup () throws Exception {
77- DeleteTpuVm .deleteTpuVm (PROJECT_ID , ZONE , TPU_VM_NAME );
77+ DeleteTpuVm .deleteTpuVm (PROJECT_ID , ZONE , NODE_NAME );
7878
7979 // Test that TPUs is deleted
8080 Assertions .assertThrows (
8181 NotFoundException .class ,
82- () -> GetTpuVm .getTpuVm (PROJECT_ID , ZONE , TPU_VM_NAME ));
82+ () -> GetTpuVm .getTpuVm (PROJECT_ID , ZONE , NODE_NAME ));
8383 }
8484
8585 @ Test
@@ -88,20 +88,20 @@ public void testCreateTpuVm() throws IOException, ExecutionException, Interrupte
8888 final PrintStream out = System .out ;
8989 ByteArrayOutputStream stdOut = new ByteArrayOutputStream ();
9090 System .setOut (new PrintStream (stdOut ));
91- CreateTpuVm .createTpuVm (PROJECT_ID , ZONE , TPU_VM_NAME , ACCELERATOR_TYPE , VERSION );
91+ CreateTpuVm .createTpuVm (PROJECT_ID , ZONE , NODE_NAME , TPU_TYPE , TPU_SOFTWARE_VERSION );
9292
93- assertThat (stdOut .toString ()).contains ("TPU VM created: " + TPU_VM_PATH_NAME );
93+ assertThat (stdOut .toString ()).contains ("TPU VM created: " + NODE_PATH_NAME );
9494 stdOut .close ();
9595 System .setOut (out );
9696 }
9797
9898 @ Test
9999 @ Order (2 )
100100 public void testGetTpuVm () throws IOException {
101- Node node = GetTpuVm .getTpuVm (PROJECT_ID , ZONE , TPU_VM_NAME );
101+ Node node = GetTpuVm .getTpuVm (PROJECT_ID , ZONE , NODE_NAME );
102102
103103 assertNotNull (node );
104- assertThat (node .getName ()).isEqualTo (TPU_VM_PATH_NAME );
104+ assertThat (node .getName ()).isEqualTo (NODE_PATH_NAME );
105105 }
106106
107107 @ Test
@@ -118,17 +118,17 @@ public void testListTpuVm() throws IOException {
118118 @ Test
119119 @ Order (2 )
120120 public void testStopTpuVm () throws IOException , ExecutionException , InterruptedException {
121- StopTpuVm .stopTpuVm (PROJECT_ID , ZONE , TPU_VM_NAME );
122- Node node = GetTpuVm .getTpuVm (PROJECT_ID , ZONE , TPU_VM_NAME );
121+ StopTpuVm .stopTpuVm (PROJECT_ID , ZONE , NODE_NAME );
122+ Node node = GetTpuVm .getTpuVm (PROJECT_ID , ZONE , NODE_NAME );
123123
124124 assertThat (node .getState ()).isEqualTo (STOPPED );
125125 }
126126
127127 @ Test
128128 @ Order (3 )
129129 public void testStartTpuVm () throws IOException , ExecutionException , InterruptedException {
130- StartTpuVm .startTpuVm (PROJECT_ID , ZONE , TPU_VM_NAME );
131- Node node = GetTpuVm .getTpuVm (PROJECT_ID , ZONE , TPU_VM_NAME );
130+ StartTpuVm .startTpuVm (PROJECT_ID , ZONE , NODE_NAME );
131+ Node node = GetTpuVm .getTpuVm (PROJECT_ID , ZONE , NODE_NAME );
132132
133133 assertThat (node .getState ()).isEqualTo (READY );
134134 }
0 commit comments