@@ -69,11 +69,12 @@ public class DisksIT {
6969 private static String EMPTY_DISK_NAME ;
7070 private static String SNAPSHOT_NAME ;
7171 private static String DISK_TYPE ;
72-
7372 private static String ZONAL_BLANK_DISK ;
74-
7573 private static String REGIONAL_BLANK_DISK ;
76-
74+ private static String REGIONAL_REPLICATED_DISK ;
75+ private static final List <String > replicaZones = Arrays .asList (
76+ String .format ("projects/%s/zones/%s-a" , PROJECT_ID , REGION ),
77+ String .format ("projects/%s/zones/%s-b" , PROJECT_ID , REGION ));
7778 private ByteArrayOutputStream stdOut ;
7879
7980 // Check if the required environment variables are set.
@@ -101,12 +102,13 @@ public static void setup()
101102 DISK_TYPE = String .format ("zones/%s/diskTypes/pd-ssd" , ZONE );
102103 ZONAL_BLANK_DISK = "gcloud-test-disk-zattach-" + uuid ;
103104 REGIONAL_BLANK_DISK = "gcloud-test-disk-rattach-" + uuid ;
105+ REGIONAL_REPLICATED_DISK = "gcloud-test-disk-replicated-" + uuid ;
104106
105107 // Cleanup existing stale instances.
106108 Util .cleanUpExistingInstances ("test-disks" , PROJECT_ID , ZONE );
107109 Util .cleanUpExistingDisks ("gcloud-test-" , PROJECT_ID , ZONE );
108110 Util .cleanUpExistingSnapshots ("gcloud-test-snapshot-" , PROJECT_ID );
109-
111+ Util . cleanUpExistingRegionalDisks ( "gcloud-test-disk-" , PROJECT_ID , REGION );
110112 // Create disk from image.
111113 Image debianImage = null ;
112114 try (ImagesClient imagesClient = ImagesClient .create ()) {
@@ -170,6 +172,7 @@ public static void cleanUp()
170172 DeleteDisk .deleteDisk (PROJECT_ID , ZONE , EMPTY_DISK_NAME );
171173 DeleteDisk .deleteDisk (PROJECT_ID , ZONE , ZONAL_BLANK_DISK );
172174 RegionalDelete .deleteRegionalDisk (PROJECT_ID , REGION , REGIONAL_BLANK_DISK );
175+ RegionalDelete .deleteRegionalDisk (PROJECT_ID , REGION , REGIONAL_REPLICATED_DISK );
173176
174177 stdOut .close ();
175178 System .setOut (out );
@@ -245,9 +248,7 @@ public static void createZonalDisk()
245248 public static void createRegionalDisk ()
246249 throws IOException , ExecutionException , InterruptedException , TimeoutException {
247250 String diskType = String .format ("regions/%s/diskTypes/pd-balanced" , REGION );
248- List <String > replicaZones = Arrays .asList (
249- String .format ("projects/%s/zones/%s-a" , PROJECT_ID , REGION ),
250- String .format ("projects/%s/zones/%s-b" , PROJECT_ID , REGION ));
251+
251252 RegionalCreateFromSource .createRegionalDisk (PROJECT_ID , REGION , replicaZones ,
252253 REGIONAL_BLANK_DISK , diskType , 11 , Optional .empty (), Optional .empty ());
253254 }
@@ -301,4 +302,12 @@ public void testDiskAttachResize()
301302 Util .getRegionalDisk (PROJECT_ID , REGION , REGIONAL_BLANK_DISK ).getSizeGb ());
302303 }
303304
305+ @ Test
306+ public void testCreateReplicatedDisk ()
307+ throws IOException , ExecutionException , InterruptedException , TimeoutException {
308+ Operation .Status status = CreateReplicatedDisk .createReplicatedDisk (PROJECT_ID , REGION ,
309+ replicaZones , REGIONAL_REPLICATED_DISK , 100 , DISK_TYPE );
310+
311+ assertThat (status ).isEqualTo (Operation .Status .DONE );
312+ }
304313}
0 commit comments