@@ -12,7 +12,7 @@ See the License for the specific language governing permissions and
12
12
limitations under the License.
13
13
*/
14
14
15
- package e2e
15
+ package tests
16
16
17
17
import (
18
18
"fmt"
@@ -21,6 +21,7 @@ import (
21
21
22
22
"k8s.io/apimachinery/pkg/util/uuid"
23
23
remote "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/test/binremote"
24
+ "sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/test/e2e/utils"
24
25
25
26
. "github.com/onsi/ginkgo"
26
27
. "github.com/onsi/gomega"
@@ -37,7 +38,7 @@ const (
37
38
)
38
39
39
40
var (
40
- client * csiClient
41
+ client * utils. CsiClient
41
42
instance * remote.InstanceInfo
42
43
//gceCloud *gce.CloudProvider
43
44
nodeID string
@@ -49,21 +50,21 @@ var _ = BeforeSuite(func() {
49
50
nodeID = "gce-pd-csi-e2e-us-central1-c"
50
51
port := "2000"
51
52
if * runInProw {
52
- * project , * serviceAccount = setupProwConfig ()
53
+ * project , * serviceAccount = utils . SetupProwConfig ()
53
54
}
54
55
55
56
Expect (* project ).ToNot (BeEmpty (), "Project should not be empty" )
56
57
Expect (* serviceAccount ).ToNot (BeEmpty (), "Service account should not be empty" )
57
58
58
- instance , err = setupInstanceAndDriver (* project , "us-central1-c" , nodeID , port , * serviceAccount )
59
+ instance , err = utils . SetupInstanceAndDriver (* project , "us-central1-c" , nodeID , port , * serviceAccount )
59
60
Expect (err ).To (BeNil ())
60
61
61
- client = createCSIClient (fmt .Sprintf ("localhost:%s" , port ))
62
+ client = utils . CreateCSIClient (fmt .Sprintf ("localhost:%s" , port ))
62
63
})
63
64
64
65
var _ = AfterSuite (func () {
65
66
// Close the client
66
- err := client .conn . Close ()
67
+ err := client .CloseConn ()
67
68
if err != nil {
68
69
Logf ("Failed to close the client" )
69
70
} else {
@@ -76,7 +77,7 @@ var _ = AfterSuite(func() {
76
77
var _ = Describe ("GCE PD CSI Driver" , func () {
77
78
78
79
BeforeEach (func () {
79
- err := client .assertCSIConnection ()
80
+ err := client .AssertCSIConnection ()
80
81
Expect (err ).To (BeNil (), "Failed to assert csi client connection: %v" , err )
81
82
})
82
83
@@ -125,21 +126,21 @@ var _ = Describe("GCE PD CSI Driver", func() {
125
126
// Unstage Disk
126
127
err := client .NodeUnstageVolume (volId , stageDir )
127
128
Expect (err ).To (BeNil (), "NodeUnstageVolume failed with error" )
128
- err = rmAll (instance , filepath .Join ("/tmp/" , volName ))
129
+ err = utils . RmAll (instance , filepath .Join ("/tmp/" , volName ))
129
130
Expect (err ).To (BeNil (), "Failed to remove temp directory" )
130
131
}()
131
132
132
133
// Mount Disk
133
134
publishDir := filepath .Join ("/tmp/" , volName , "mount" )
134
135
err = client .NodePublishVolume (volId , stageDir , publishDir )
135
136
Expect (err ).To (BeNil (), "NodePublishVolume failed with error" )
136
- err = forceChmod (instance , filepath .Join ("/tmp/" , volName ), "777" )
137
+ err = utils . ForceChmod (instance , filepath .Join ("/tmp/" , volName ), "777" )
137
138
Expect (err ).To (BeNil (), "Chmod failed with error" )
138
139
139
140
// Write a file
140
141
testFileContents := "test"
141
142
testFile := filepath .Join (publishDir , "testfile" )
142
- err = writeFile (instance , testFile , testFileContents )
143
+ err = utils . WriteFile (instance , testFile , testFileContents )
143
144
Expect (err ).To (BeNil (), "Failed to write file" )
144
145
145
146
// Unmount Disk
@@ -150,12 +151,12 @@ var _ = Describe("GCE PD CSI Driver", func() {
150
151
secondPublishDir := filepath .Join ("/tmp/" , volName , "secondmount" )
151
152
err = client .NodePublishVolume (volId , stageDir , secondPublishDir )
152
153
Expect (err ).To (BeNil (), "NodePublishVolume failed with error" )
153
- err = forceChmod (instance , filepath .Join ("/tmp/" , volName ), "777" )
154
+ err = utils . ForceChmod (instance , filepath .Join ("/tmp/" , volName ), "777" )
154
155
Expect (err ).To (BeNil (), "Chmod failed with error" )
155
156
156
157
// Read File
157
158
secondTestFile := filepath .Join (secondPublishDir , "testfile" )
158
- readContents , err := readFile (instance , secondTestFile )
159
+ readContents , err := utils . ReadFile (instance , secondTestFile )
159
160
Expect (err ).To (BeNil (), "ReadFile failed with error" )
160
161
Expect (strings .TrimSpace (string (readContents ))).To (Equal (testFileContents ))
161
162
0 commit comments