2929import java .util .concurrent .TimeUnit ;
3030import java .util .concurrent .TimeoutException ;
3131import org .junit .Assert ;
32- import org .junit .FixMethodOrder ;
3332import org .junit .jupiter .api .AfterAll ;
3433import org .junit .jupiter .api .BeforeAll ;
34+ import org .junit .jupiter .api .MethodOrderer ;
35+ import org .junit .jupiter .api .Order ;
3536import org .junit .jupiter .api .Test ;
37+ import org .junit .jupiter .api .TestMethodOrder ;
3638import org .junit .jupiter .api .Timeout ;
3739import org .junit .runner .RunWith ;
3840import org .junit .runners .JUnit4 ;
39- import org .junit .runners .MethodSorters ;
4041
4142@ RunWith (JUnit4 .class )
4243@ Timeout (value = 6 , unit = TimeUnit .MINUTES )
43- @ FixMethodOrder ( MethodSorters . NAME_ASCENDING )
44+ @ TestMethodOrder ( MethodOrderer . OrderAnnotation . class )
4445public class HyperdisksIT {
4546 private static final String PROJECT_ID = System .getenv ("GOOGLE_CLOUD_PROJECT" );
4647 private static final String ZONE = "us-central1-a" ;
47- private static String HYPERDISK_NAME ;
48- private static String HYPERDISK_IN_POOL_NAME ;
49- private static String STORAGE_POOL_NAME ;
48+ private static final String HYPERDISK_NAME = "test-hyperdisk-enc-" + UUID . randomUUID () ;
49+ private static final String HYPERDISK_IN_POOL_NAME = "test-hyperdisk-enc-" + UUID . randomUUID () ;
50+ private static final String STORAGE_POOL_NAME = "test-storage-pool-enc-" + UUID . randomUUID () ;
5051 private static final String PERFORMANCE_PROVISIONING_TYPE = "advanced" ;
52+ private static final String CAPACITY_PROVISIONING_TYPE = "advanced" ;
5153
5254 // Check if the required environment variables are set.
5355 public static void requireEnvVar (String envVarName ) {
@@ -60,9 +62,6 @@ public static void setUp()
6062 throws IOException , ExecutionException , InterruptedException , TimeoutException {
6163 requireEnvVar ("GOOGLE_APPLICATION_CREDENTIALS" );
6264 requireEnvVar ("GOOGLE_CLOUD_PROJECT" );
63- HYPERDISK_NAME = "test-hyperdisk-enc-" + UUID .randomUUID ();
64- HYPERDISK_IN_POOL_NAME = "test-hyperdisk-enc-" + UUID .randomUUID ();
65- STORAGE_POOL_NAME = "test-storage-pool-enc-" + UUID .randomUUID ();
6665 }
6766
6867 @ AfterAll
@@ -76,7 +75,8 @@ public static void cleanup()
7675 }
7776
7877 @ Test
79- public void stage1_CreateHyperdiskTest ()
78+ @ Order (1 )
79+ public void testCreateHyperdisk ()
8080 throws IOException , ExecutionException , InterruptedException , TimeoutException {
8181 String diskType = String .format ("zones/%s/diskTypes/hyperdisk-balanced" , ZONE );
8282
@@ -94,29 +94,32 @@ public void stage1_CreateHyperdiskTest()
9494 }
9595
9696 @ Test
97- public void stage1_CreateHyperdiskStoragePoolTest ()
97+ @ Order (1 )
98+ public void testCreateHyperdiskStoragePool ()
9899 throws IOException , ExecutionException , InterruptedException , TimeoutException {
99100 String poolType = String .format ("projects/%s/zones/%s/storagePoolTypes/hyperdisk-balanced" ,
100101 PROJECT_ID , ZONE );
101102 StoragePool storagePool = CreateHyperdiskStoragePool
102103 .createHyperdiskStoragePool (PROJECT_ID , ZONE , STORAGE_POOL_NAME , poolType ,
103- "advanced" , 10240 , 10000 , 10240 ,
104+ CAPACITY_PROVISIONING_TYPE , 10240 , 10000 , 1024 ,
104105 PERFORMANCE_PROVISIONING_TYPE );
105106
106107 Assert .assertNotNull (storagePool );
107108 Assert .assertEquals (STORAGE_POOL_NAME , storagePool .getName ());
108109 Assert .assertEquals (10000 , storagePool .getPoolProvisionedIops ());
109- Assert .assertEquals (10240 , storagePool .getPoolProvisionedThroughput ());
110+ Assert .assertEquals (1024 , storagePool .getPoolProvisionedThroughput ());
110111 Assert .assertEquals (10240 , storagePool .getPoolProvisionedCapacityGb ());
111112 Assert .assertTrue (storagePool .getStoragePoolType ().contains ("hyperdisk-balanced" ));
112- Assert .assertTrue (storagePool .getCapacityProvisioningType ().equalsIgnoreCase ("advanced" ));
113+ Assert .assertTrue (storagePool .getCapacityProvisioningType ()
114+ .equalsIgnoreCase (CAPACITY_PROVISIONING_TYPE ));
113115 Assert .assertTrue (storagePool .getPerformanceProvisioningType ()
114116 .equalsIgnoreCase (PERFORMANCE_PROVISIONING_TYPE ));
115117 Assert .assertTrue (storagePool .getZone ().contains (ZONE ));
116118 }
117119
118120 @ Test
119- public void stage2_CreateHyperdiskStoragePoolTest ()
121+ @ Order (2 )
122+ public void testCreateDiskInStoragePool ()
120123 throws IOException , ExecutionException , InterruptedException , TimeoutException {
121124 String diskType = String .format ("zones/%s/diskTypes/hyperdisk-balanced" , ZONE );
122125 String storagePoolLink = String
0 commit comments