@@ -21,6 +21,7 @@ import (
21
21
csi "github.com/container-storage-interface/spec/lib/go/csi/v0"
22
22
. "github.com/onsi/ginkgo"
23
23
. "github.com/onsi/gomega"
24
+ "k8s.io/apimachinery/pkg/util/sets"
24
25
"k8s.io/apimachinery/pkg/util/uuid"
25
26
"sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/common"
26
27
gce "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/gce-cloud-provider/compute"
@@ -117,13 +118,20 @@ var _ = Describe("GCE PD CSI Driver Multi-Zone", func() {
117
118
})
118
119
Expect (err ).To (BeNil (), "CreateVolume failed with error: %v" , err )
119
120
120
- // TODO: Validate Disk Created
121
+ // Validate Disk Created
121
122
cloudDisk , err := betaComputeService .RegionDisks .Get (p , region , volName ).Do ()
122
123
Expect (err ).To (BeNil (), "Could not get disk from cloud directly" )
123
124
Expect (cloudDisk .Type ).To (ContainSubstring (standardDiskType ))
124
125
Expect (cloudDisk .Status ).To (Equal (readyState ))
125
126
Expect (cloudDisk .SizeGb ).To (Equal (defaultSizeGb ))
126
127
Expect (cloudDisk .Name ).To (Equal (volName ))
128
+ Expect (len (cloudDisk .ReplicaZones )).To (Equal (2 ))
129
+ zonesSet := sets .NewString (zones ... )
130
+ for _ , replicaZone := range cloudDisk .ReplicaZones {
131
+ tokens := strings .Split (replicaZone , "/" )
132
+ actualZone := tokens [len (tokens )- 1 ]
133
+ Expect (zonesSet .Has (actualZone )).To (BeTrue (), "Expected zone %v to exist in zone set %v" , actualZone , zones )
134
+ }
127
135
128
136
defer func () {
129
137
// Delete Disk
@@ -153,6 +161,7 @@ var _ = Describe("GCE PD CSI Driver Multi-Zone", func() {
153
161
func testAttachWriteReadDetach (volId string , volName string , instance * remote.InstanceInfo , client * remote.CsiClient , readOnly bool ) {
154
162
var err error
155
163
164
+ Logf ("Starting testAttachWriteReadDetach with volume %v node %v with readonly %v" , volId , instance .GetNodeID (), readOnly )
156
165
// Attach Disk
157
166
err = client .ControllerPublishVolume (volId , instance .GetNodeID ())
158
167
Expect (err ).To (BeNil (), "ControllerPublishVolume failed with error for disk %v on node %v" , volId , instance .GetNodeID ())
@@ -212,4 +221,5 @@ func testAttachWriteReadDetach(volId string, volName string, instance *remote.In
212
221
err = client .NodeUnpublishVolume (volId , secondPublishDir )
213
222
Expect (err ).To (BeNil (), "NodeUnpublishVolume failed with error" )
214
223
224
+ Logf ("Completed testAttachWriteReadDetach with volume %v node %v" , volId , instance .GetNodeID ())
215
225
}
0 commit comments