@@ -44,6 +44,10 @@ func TestClient(t *testing.T) {
44
44
datastore := os .Getenv ("CNS_DATASTORE" )
45
45
datastore2 := os .Getenv ("CNS_DATASTORE2" )
46
46
47
+ // set CNS_RUN_TRANSACTION_TESTS environment to true, if you want to run CNS Transaction tests
48
+ // example: export CNS_RUN_TRANSACTION_TESTS='true'
49
+ run_cns_transaction_tests := os .Getenv ("CNS_RUN_TRANSACTION_TESTS" )
50
+
47
51
// set CNS_RUN_FILESHARE_TESTS environment to true, if your setup has vsanfileshare enabled.
48
52
// when CNS_RUN_FILESHARE_TESTS is not set to true, vsan file share related tests are skipped.
49
53
// example: export CNS_RUN_FILESHARE_TESTS='true'
@@ -146,9 +150,9 @@ func TestClient(t *testing.T) {
146
150
147
151
pvclaimUID := "901e87eb-c2bd-11e9-806f-005056a0c9a0"
148
152
isvSphereVersion91orAbove := isvSphereVersion91orAbove (ctx , c .ServiceContent .About )
149
- if isvSphereVersion91orAbove {
153
+ if run_cns_transaction_tests == "true" && isvSphereVersion91orAbove {
150
154
t .Logf ("setting volumeID: %q in the cnsVolumeCreateSpec" , pvclaimUID )
151
- cnsVolumeCreateSpec .VolumeId = cnstypes.CnsVolumeId {
155
+ cnsVolumeCreateSpec .VolumeId = & cnstypes.CnsVolumeId {
152
156
Id : pvclaimUID ,
153
157
}
154
158
}
@@ -180,7 +184,7 @@ func TestClient(t *testing.T) {
180
184
volumeId := createVolumeOperationRes .VolumeId .Id
181
185
volumeCreateResult := (createTaskResult ).(* cnstypes.CnsVolumeCreateResult )
182
186
t .Logf ("volumeCreateResult %+v" , volumeCreateResult )
183
- if isvSphereVersion91orAbove {
187
+ if run_cns_transaction_tests == "true" && isvSphereVersion91orAbove {
184
188
if volumeId != pvclaimUID {
185
189
t .Fatalf ("failed to create volume with supplied volume ID: %q volume " +
186
190
"created with diffrent UUID: %q" , pvclaimUID , volumeId )
@@ -190,7 +194,7 @@ func TestClient(t *testing.T) {
190
194
191
195
// Creating Volume with same ID again on different datastore
192
196
// to observe CnsVolumeAlreadyExistsFault
193
- if isvSphereVersion91orAbove {
197
+ if run_cns_transaction_tests == "true" && isvSphereVersion91orAbove {
194
198
if datastore2 != "" {
195
199
ds2 , err := finder .Datastore (ctx , datastore2 )
196
200
if err != nil {
@@ -431,10 +435,10 @@ func TestClient(t *testing.T) {
431
435
}
432
436
433
437
var generatedSnapshotUUIDFromClient string
434
- if isvSphereVersion91orAbove {
438
+ if run_cns_transaction_tests == "true" && isvSphereVersion91orAbove {
435
439
generatedSnapshotUUIDFromClient = uuid .New ().String ()
436
440
t .Logf ("setting SnapshotID: %q in the cnsSnapshotCreateSpec" , generatedSnapshotUUIDFromClient )
437
- cnsSnapshotCreateSpec .SnapshotId = cnstypes.CnsSnapshotId {
441
+ cnsSnapshotCreateSpec .SnapshotId = & cnstypes.CnsSnapshotId {
438
442
Id : generatedSnapshotUUIDFromClient ,
439
443
}
440
444
}
@@ -465,7 +469,7 @@ func TestClient(t *testing.T) {
465
469
snapshotId := snapshotCreateResult .Snapshot .SnapshotId .Id
466
470
snapshotCreateTime := snapshotCreateResult .Snapshot .CreateTime
467
471
t .Logf ("snapshotCreateResult: %+v" , pretty .Sprint (snapshotCreateResult ))
468
- if isvSphereVersion91orAbove {
472
+ if run_cns_transaction_tests == "true" && isvSphereVersion91orAbove {
469
473
if snapshotId != generatedSnapshotUUIDFromClient {
470
474
t .Fatalf ("failed to create snapshot with snapshot id: %q snapshot " +
471
475
"created with diffrent id: %q" , generatedSnapshotUUIDFromClient , snapshotId )
0 commit comments