@@ -1298,6 +1298,54 @@ func TestCreateVolumeArguments(t *testing.T) {
1298
1298
},
1299
1299
expErrCode : codes .InvalidArgument ,
1300
1300
},
1301
+ {
1302
+ name : "err empty HdB ROX single-zone disk no content source" ,
1303
+ req : & csi.CreateVolumeRequest {
1304
+ Name : name ,
1305
+ CapacityRange : stdCapRange ,
1306
+ VolumeCapabilities : []* csi.VolumeCapability {
1307
+ {
1308
+ AccessType : & csi.VolumeCapability_Mount {
1309
+ Mount : & csi.VolumeCapability_MountVolume {},
1310
+ },
1311
+ AccessMode : & csi.VolumeCapability_AccessMode {
1312
+ Mode : csi .VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY ,
1313
+ },
1314
+ },
1315
+ },
1316
+ Parameters : map [string ]string {
1317
+ common .ParameterKeyType : "hyperdisk-balanced" ,
1318
+ },
1319
+ },
1320
+ expErrCode : codes .InvalidArgument ,
1321
+ },
1322
+ {
1323
+ name : "success empty HdML ROX single-zone disk no content source" ,
1324
+ req : & csi.CreateVolumeRequest {
1325
+ Name : name ,
1326
+ CapacityRange : stdCapRange ,
1327
+ VolumeCapabilities : []* csi.VolumeCapability {
1328
+ {
1329
+ AccessType : & csi.VolumeCapability_Mount {
1330
+ Mount : & csi.VolumeCapability_MountVolume {},
1331
+ },
1332
+ AccessMode : & csi.VolumeCapability_AccessMode {
1333
+ Mode : csi .VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY ,
1334
+ },
1335
+ },
1336
+ },
1337
+ Parameters : map [string ]string {
1338
+ common .ParameterKeyType : "hyperdisk-ml" ,
1339
+ },
1340
+ },
1341
+ expVol : & csi.Volume {
1342
+ CapacityBytes : common .GbToBytes (20 ),
1343
+ VolumeId : testVolumeID ,
1344
+ VolumeContext : nil ,
1345
+ AccessibleTopology : stdTopology ,
1346
+ },
1347
+ expErrCode : codes .OK ,
1348
+ },
1301
1349
}
1302
1350
1303
1351
// Run test cases
@@ -1318,6 +1366,7 @@ func TestCreateVolumeArguments(t *testing.T) {
1318
1366
}
1319
1367
continue
1320
1368
}
1369
+ t .Logf ("ErroCode: %v" , err )
1321
1370
if tc .expErrCode != codes .OK {
1322
1371
t .Fatalf ("Expected error: %v, got no error" , tc .expErrCode )
1323
1372
}
@@ -1504,7 +1553,7 @@ func TestMultiZoneVolumeCreation(t *testing.T) {
1504
1553
expZones : []string {"us-central1-a" , "us-central1-b" , "us-central1-c" },
1505
1554
},
1506
1555
{
1507
- name : "err single ROX multi-zone no topology " ,
1556
+ name : "success empty HdML ROX multi-zone disk no content source " ,
1508
1557
req : & csi.CreateVolumeRequest {
1509
1558
Name : "test-name" ,
1510
1559
CapacityRange : stdCapRange ,
@@ -1522,18 +1571,26 @@ func TestMultiZoneVolumeCreation(t *testing.T) {
1522
1571
common .ParameterKeyType : "hyperdisk-ml" ,
1523
1572
common .ParameterKeyEnableMultiZoneProvisioning : "true" ,
1524
1573
},
1525
- VolumeContentSource : & csi.VolumeContentSource {
1526
- Type : & csi.VolumeContentSource_Snapshot {
1527
- Snapshot : & csi.VolumeContentSource_SnapshotSource {
1528
- SnapshotId : testSnapshotID ,
1574
+ AccessibilityRequirements : & csi.TopologyRequirement {
1575
+ Requisite : []* csi.Topology {
1576
+ {
1577
+ Segments : map [string ]string {common .TopologyKeyZone : "us-central1-a" },
1578
+ },
1579
+ },
1580
+ Preferred : []* csi.Topology {
1581
+ {
1582
+ Segments : map [string ]string {common .TopologyKeyZone : "us-central1-a" },
1583
+ },
1584
+ {
1585
+ Segments : map [string ]string {common .TopologyKeyZone : "us-central1-b" },
1529
1586
},
1530
1587
},
1531
1588
},
1532
1589
},
1533
- expErrCode : codes . InvalidArgument ,
1590
+ expZones : [] string { "us-central1-a" , "us-central1-b" } ,
1534
1591
},
1535
1592
{
1536
- name : "err rwo access mode " ,
1593
+ name : "error empty HdB ROX multi-zone disk no content source " ,
1537
1594
req : & csi.CreateVolumeRequest {
1538
1595
Name : "test-name" ,
1539
1596
CapacityRange : stdCapRange ,
@@ -1543,21 +1600,14 @@ func TestMultiZoneVolumeCreation(t *testing.T) {
1543
1600
Mount : & csi.VolumeCapability_MountVolume {},
1544
1601
},
1545
1602
AccessMode : & csi.VolumeCapability_AccessMode {
1546
- Mode : csi .VolumeCapability_AccessMode_SINGLE_NODE_WRITER ,
1603
+ Mode : csi .VolumeCapability_AccessMode_MULTI_NODE_READER_ONLY ,
1547
1604
},
1548
1605
},
1549
1606
},
1550
1607
Parameters : map [string ]string {
1551
- common .ParameterKeyType : "hyperdisk-ml " ,
1608
+ common .ParameterKeyType : "hyperdisk-balanced " ,
1552
1609
common .ParameterKeyEnableMultiZoneProvisioning : "true" ,
1553
1610
},
1554
- VolumeContentSource : & csi.VolumeContentSource {
1555
- Type : & csi.VolumeContentSource_Snapshot {
1556
- Snapshot : & csi.VolumeContentSource_SnapshotSource {
1557
- SnapshotId : testSnapshotID ,
1558
- },
1559
- },
1560
- },
1561
1611
AccessibilityRequirements : & csi.TopologyRequirement {
1562
1612
Requisite : []* csi.Topology {
1563
1613
{
@@ -1568,13 +1618,16 @@ func TestMultiZoneVolumeCreation(t *testing.T) {
1568
1618
{
1569
1619
Segments : map [string ]string {common .TopologyKeyZone : "us-central1-a" },
1570
1620
},
1621
+ {
1622
+ Segments : map [string ]string {common .TopologyKeyZone : "us-central1-b" },
1623
+ },
1571
1624
},
1572
1625
},
1573
1626
},
1574
1627
expErrCode : codes .InvalidArgument ,
1575
1628
},
1576
1629
{
1577
- name : "err no content source " ,
1630
+ name : "err single ROX multi-zone no topology " ,
1578
1631
req : & csi.CreateVolumeRequest {
1579
1632
Name : "test-name" ,
1580
1633
CapacityRange : stdCapRange ,
@@ -1592,6 +1645,42 @@ func TestMultiZoneVolumeCreation(t *testing.T) {
1592
1645
common .ParameterKeyType : "hyperdisk-ml" ,
1593
1646
common .ParameterKeyEnableMultiZoneProvisioning : "true" ,
1594
1647
},
1648
+ VolumeContentSource : & csi.VolumeContentSource {
1649
+ Type : & csi.VolumeContentSource_Snapshot {
1650
+ Snapshot : & csi.VolumeContentSource_SnapshotSource {
1651
+ SnapshotId : testSnapshotID ,
1652
+ },
1653
+ },
1654
+ },
1655
+ },
1656
+ expErrCode : codes .InvalidArgument ,
1657
+ },
1658
+ {
1659
+ name : "err rwo access mode" ,
1660
+ req : & csi.CreateVolumeRequest {
1661
+ Name : "test-name" ,
1662
+ CapacityRange : stdCapRange ,
1663
+ VolumeCapabilities : []* csi.VolumeCapability {
1664
+ {
1665
+ AccessType : & csi.VolumeCapability_Mount {
1666
+ Mount : & csi.VolumeCapability_MountVolume {},
1667
+ },
1668
+ AccessMode : & csi.VolumeCapability_AccessMode {
1669
+ Mode : csi .VolumeCapability_AccessMode_SINGLE_NODE_WRITER ,
1670
+ },
1671
+ },
1672
+ },
1673
+ Parameters : map [string ]string {
1674
+ common .ParameterKeyType : "hyperdisk-ml" ,
1675
+ common .ParameterKeyEnableMultiZoneProvisioning : "true" ,
1676
+ },
1677
+ VolumeContentSource : & csi.VolumeContentSource {
1678
+ Type : & csi.VolumeContentSource_Snapshot {
1679
+ Snapshot : & csi.VolumeContentSource_SnapshotSource {
1680
+ SnapshotId : testSnapshotID ,
1681
+ },
1682
+ },
1683
+ },
1595
1684
AccessibilityRequirements : & csi.TopologyRequirement {
1596
1685
Requisite : []* csi.Topology {
1597
1686
{
0 commit comments