@@ -21,8 +21,6 @@ import (
21
21
"k8s.io/apimachinery/pkg/util/uuid"
22
22
"sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/common"
23
23
gce "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/gce-cloud-provider/compute"
24
- testutils "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/test/e2e/utils"
25
- remote "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/test/remote"
26
24
27
25
csi "github.com/container-storage-interface/spec/lib/go/csi/v0"
28
26
. "github.com/onsi/ginkgo"
@@ -41,14 +39,7 @@ const (
41
39
var _ = Describe ("GCE PD CSI Driver" , func () {
42
40
43
41
It ("Should create->attach->stage->mount volume and check if it is writable, then unmount->unstage->detach->delete and check disk is deleted" , func () {
44
- // Create new driver and client
45
- Expect (testInstances ).NotTo (BeEmpty ())
46
- testContext , err := testutils .GCEClientAndDriverSetup (testInstances [0 ])
47
- Expect (err ).To (BeNil (), "Set up new Driver and Client failed with error" )
48
- defer func () {
49
- err := remote .TeardownDriverAndClient (testContext )
50
- Expect (err ).To (BeNil (), "Teardown Driver and Client failed with error" )
51
- }()
42
+ testContext := getRandomTestContext ()
52
43
53
44
p , z , _ := testContext .Instance .GetIdentity ()
54
45
client := testContext .Client
@@ -90,14 +81,8 @@ var _ = Describe("GCE PD CSI Driver", func() {
90
81
})
91
82
92
83
It ("Should create disks in correct zones when topology is specified" , func () {
93
- ///
94
- Expect (testInstances ).NotTo (BeEmpty ())
95
- testContext , err := testutils .GCEClientAndDriverSetup (testInstances [0 ])
96
- Expect (err ).To (BeNil (), "Failed to set up new driver and client" )
97
- defer func () {
98
- err := remote .TeardownDriverAndClient (testContext )
99
- Expect (err ).To (BeNil (), "Teardown Driver and Client failed with error" )
100
- }()
84
+ Expect (testContexts ).ToNot (BeEmpty ())
85
+ testContext := getRandomTestContext ()
101
86
102
87
p , _ , _ := testContext .Instance .GetIdentity ()
103
88
@@ -126,14 +111,8 @@ var _ = Describe("GCE PD CSI Driver", func() {
126
111
})
127
112
128
113
It ("Should successfully create RePD in two zones in the drivers region when none are specified" , func () {
129
- // Create new driver and client
130
- Expect (testInstances ).NotTo (BeEmpty ())
131
- testContext , err := testutils .GCEClientAndDriverSetup (testInstances [0 ])
132
- Expect (err ).To (BeNil (), "Failed to set up new driver and client" )
133
- defer func () {
134
- err := remote .TeardownDriverAndClient (testContext )
135
- Expect (err ).To (BeNil (), "Teardown Driver and Client failed with error" )
136
- }()
114
+ Expect (testContexts ).ToNot (BeEmpty ())
115
+ testContext := getRandomTestContext ()
137
116
138
117
controllerInstance := testContext .Instance
139
118
controllerClient := testContext .Client
@@ -177,14 +156,8 @@ var _ = Describe("GCE PD CSI Driver", func() {
177
156
})
178
157
179
158
It ("Should create and delete disk with default zone" , func () {
180
- // Create new driver and client
181
- Expect (testInstances ).NotTo (BeEmpty ())
182
- testContext , err := testutils .GCEClientAndDriverSetup (testInstances [0 ])
183
- Expect (err ).To (BeNil (), "Set up new Driver and Client failed with error" )
184
- defer func () {
185
- err := remote .TeardownDriverAndClient (testContext )
186
- Expect (err ).To (BeNil (), "Teardown Driver and Client failed with error" )
187
- }()
159
+ Expect (testContexts ).ToNot (BeEmpty ())
160
+ testContext := getRandomTestContext ()
188
161
189
162
p , z , _ := testContext .Instance .GetIdentity ()
190
163
client := testContext .Client
0 commit comments