Skip to content

Commit c84b213

Browse files
author
Shruthi-1MN
committed
end
1 parent 140905a commit c84b213

2 files changed

Lines changed: 182 additions & 114 deletions

File tree

test/integration/fileshare_test.go

Lines changed: 182 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ package integration
1919
import (
2020
"testing"
2121

22-
. "github.com/onsi/ginkgo"
23-
. "github.com/onsi/gomega"
2422
"github.com/opensds/opensds/test/integration/utils"
2523
)
2624

@@ -35,60 +33,227 @@ var (
3533

3634
var _ = Describe("FileShare Testing", func() {
3735
Context("create FileShare ", func() {
38-
It("TC_FS_IT_01: Create fileshare with name input ", func() {
39-
var jsonStr = map[string]interface{}{"name": "share2223", "description": "This is just for test222", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
36+
It("TC_FS_IT_01: Create fileshare with name input", func() {
37+
var jsonStr = map[string]interface{}{"name": "share2223", "description": "This is just for test222", "size": 2}
4038
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
4139
methodName := "POST"
4240
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr)
4341
Expect(resp.StatusCode).Should(Equal(202))
4442
Expect(err).NotTo(HaveOccurred())
4543
})
46-
It("TC_FS_IT_02: Create fileshare with empty file share name ", func() {
47-
var jsonStr2 = map[string]interface{}{"name": "", "description": "This is just for testxxx", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
44+
It("TC_FS_IT_02: Create fileshare with empty file share name", func() {
45+
var jsonStr2 = map[string]interface{}{"name": "", "description": "This is just for testxxx", "size": 2}
4846
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
4947
methodName := "POST"
5048
resp, _ := utils.ConnectToHTTP(methodName, url, jsonStr2)
5149
Expect(resp.StatusCode).Should(Equal(400))
5250
})
53-
It("TC_FS_IT_03: Create file share name with other encoding characters(except utf-8) ", func() {
54-
var jsonStr2 = map[string]interface{}{"name": "İnanç Esasları", "description": "This is just for testxxx", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
51+
It("TC_FS_IT_03: Create file share name with other encoding characters(except utf-8)", func() {
52+
var jsonStr2 = map[string]interface{}{"name": "İnanç Esasları", "description": "This is just for testxxx", "size": 2}
5553
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
5654
methodName := "POST"
5755
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
5856
Expect(resp.StatusCode).Should(Equal(202))
5957
Expect(err).NotTo(HaveOccurred())
6058
})
61-
It("TC_FS_IT_04: Create file share name having special characters ", func() {
62-
var jsonStr2 = map[string]interface{}{"name": "#FileShare Code!$!test", "description": "This is just for testxxx", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
59+
It("TC_FS_IT_04: Create file share name having special characters", func() {
60+
var jsonStr2 = map[string]interface{}{"name": "#FileShare Code!$!test", "description": "This is just for testxxx", "size": 2}
6361
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
6462
methodName := "POST"
6563
resp, _ := utils.ConnectToHTTP(methodName, url, jsonStr2)
6664
Expect(resp.StatusCode).Should(Equal(202))
6765
})
68-
It("TC_FS_IT_05: Create file share name starts with numbers ", func() {
69-
var jsonStr2 = map[string]interface{}{"name": "123test", "description": "This is just for testxxx", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
66+
It("TC_FS_IT_05: Create file share name starts with numbers", func() {
67+
var jsonStr2 = map[string]interface{}{"name": "123test", "description": "This is just for testxxx", "size": 2}
7068
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
7169
methodName := "POST"
7270
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
7371
Expect(resp.StatusCode).Should(Equal(202))
7472
Expect(err).NotTo(HaveOccurred())
7573
})
76-
It("TC_FS_IT_06: Create file share name length more than 255 characters ", func() {
77-
var jsonStr2 = map[string]interface{}{"name": "abqwqwqwggg012345678910gggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg", "description": "This is just for testxxx", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
74+
It("TC_FS_IT_06: Create file share name length more than 255 characters", func() {
75+
var jsonStr2 = map[string]interface{}{"name": "abqwqwqwggg012345678910gggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg", "description": "This is just for testxxx", "size": 2}
7876
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
7977
methodName := "POST"
8078
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
8179
Expect(resp.StatusCode).Should(Equal(400))
8280
Expect(err).NotTo(HaveOccurred())
8381
})
84-
It("TC_FS_IT_08: Create file share description with empty string ", func() {
85-
var jsonStr2 = map[string]interface{}{"name": "abcd123", "description": "#FileShare Code!$!test", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
82+
It("TC_FS_IT_08: Create file share description with empty string", func() {
83+
var jsonStr2 = map[string]interface{}{"name": "abcd123", "description": "", "size": 2}
84+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
85+
methodName := "POST"
86+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
87+
Expect(resp.StatusCode).Should(Equal(202))
88+
Expect(err).NotTo(HaveOccurred())
89+
})
90+
It("TC_FS_IT_09: Create file share with description having special characters", func() {
91+
var jsonStr2 = map[string]interface{}{"name": "abcd124", "description": "#FileShare Code!$!test", "size": 2}
8692
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
8793
methodName := "POST"
8894
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
8995
Expect(resp.StatusCode).Should(Equal(400))
9096
Expect(err).NotTo(HaveOccurred())
9197
})
92-
98+
It("TC_FS_IT_10: Create file share with description with more than 255 characters", func() {
99+
var jsonStr2 = map[string]interface{}{"name": "abcd125", "description": "abqwqwqwggg012345678910ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg", "size": 2}
100+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
101+
methodName := "POST"
102+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
103+
Expect(resp.StatusCode).Should(Equal(202))
104+
Expect(err).NotTo(HaveOccurred())
105+
})
106+
It("TC_FS_IT_11: Create file share without required parameters like fileshare name, size", func() {
107+
var jsonStr2 = map[string]interface{}{"name": "abcd126", "description": " "}
108+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
109+
methodName := "POST"
110+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
111+
Expect(resp.StatusCode).Should(Equal(400))
112+
Expect(err).NotTo(HaveOccurred())
113+
})
114+
It("TC_FS_IT_12: Create file share with size with -ve number", func() {
115+
var jsonStr2 = map[string]interface{}{"name": "abcd127", "description": " ", "size": -2}
116+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
117+
methodName := "POST"
118+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
119+
Expect(resp.StatusCode).Should(Equal(400))
120+
Expect(err).NotTo(HaveOccurred())
121+
})
122+
It("TC_FS_IT_13: Create file share with size with +ve number", func() {
123+
var jsonStr2 = map[string]interface{}{"name": "abcd128", "description": " ", "size": 2}
124+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
125+
methodName := "POST"
126+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
127+
Expect(resp.StatusCode).Should(Equal(202))
128+
Expect(err).NotTo(HaveOccurred())
129+
})
130+
It("TC_FS_IT_14: Create file share with size with more than total capacity", func() {
131+
var jsonStr2 = map[string]interface{}{"name": "abcd129", "description": " ", "size": 50}
132+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
133+
methodName := "POST"
134+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
135+
Expect(resp.StatusCode).Should(Equal(202))
136+
Expect(err).NotTo(HaveOccurred())
137+
})
138+
It("TC_FS_IT_15: Create file share Size with 0", func() {
139+
var jsonStr2 = map[string]interface{}{"name": "abcd130", "description": " ", "size": 0}
140+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
141+
methodName := "POST"
142+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
143+
Expect(resp.StatusCode).Should(Equal(400))
144+
Expect(err).NotTo(HaveOccurred())
145+
})
146+
It("TC_FS_IT_16: Create file share by specifying the File Share Id", func() {
147+
var jsonStr2 = map[string]interface{}{"name": "abcd131", "description": " ", "size": 2}
148+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
149+
methodName := "POST"
150+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
151+
Expect(resp.StatusCode).Should(Equal(202))
152+
Expect(err).NotTo(HaveOccurred())
153+
})
154+
It("TC_FS_IT_17: Create file share by specifying the Profile id", func() {
155+
var jsonStr2 = map[string]interface{}{"name": "abcd132", "description": " ", "size": 2, "profileId": "0191d383-3af4-46ca-abd4-8027daa4446c"}
156+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
157+
methodName := "POST"
158+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
159+
Expect(resp.StatusCode).Should(Equal(202))
160+
Expect(err).NotTo(HaveOccurred())
161+
})
162+
It("TC_FS_IT_18: Create file share by without specifying Profile Id", func() {
163+
var jsonStr2 = map[string]interface{}{"name": "abcd133", "description": " ", "size": 2}
164+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
165+
methodName := "POST"
166+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
167+
Expect(resp.StatusCode).Should(Equal(202))
168+
Expect(err).NotTo(HaveOccurred())
169+
})
170+
It("TC_FS_IT_19: Create file share by specifying wrong profile Id", func() {
171+
var jsonStr2 = map[string]interface{}{"name": "abcd134", "description": " ", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
172+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
173+
methodName := "POST"
174+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
175+
Expect(resp.StatusCode).Should(Equal(400))
176+
Expect(err).NotTo(HaveOccurred())
177+
})
178+
It("TC_FS_IT_20: Create file share by specifying Availability zone name", func() {
179+
var jsonStr2 = map[string]interface{}{"name": "abcd135", "description": " ", "size": 2, "availabillityZone": "default"}
180+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
181+
methodName := "POST"
182+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
183+
Expect(resp.StatusCode).Should(Equal(202))
184+
Expect(err).NotTo(HaveOccurred())
185+
})
186+
It("TC_FS_IT_21: Create file share by specifying wrong Availability zone name", func() {
187+
var jsonStr2 = map[string]interface{}{"name": "abcd136", "description": " ", "size": 2, "availabillityZone": "default1"}
188+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
189+
methodName := "POST"
190+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
191+
Expect(resp.StatusCode).Should(Equal(400))
192+
Expect(err).NotTo(HaveOccurred())
193+
})
194+
It("TC_FS_IT_22: Update file share name with empty string", func() {
195+
var jsonStr2 = map[string]interface{}{"name": "", "description": "This is test for case TC_FS_IT_22"}
196+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/add61d3c-5248-4dec-8d0d-9e84fd6fbbb6"
197+
methodName := "PUT"
198+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
199+
Expect(resp.StatusCode).Should(Equal(202))
200+
Expect(err).NotTo(HaveOccurred())
201+
})
202+
It("TC_FS_IT_23: Update file share name with special character string", func() {
203+
var jsonStr2 = map[string]interface{}{"name": "$File$Test!1", "description": "This is test for case TC_FS_IT_23"}
204+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/e3885ace-23d4-4a52-a47f-0efc87b82821"
205+
methodName := "PUT"
206+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
207+
Expect(resp.StatusCode).Should(Equal(202))
208+
Expect(err).NotTo(HaveOccurred())
209+
})
210+
It("TC_FS_IT_24: Update file share name length greater than 255 characters", func() {
211+
var jsonStr2 = map[string]interface{}{"name": "abc2abqwqwqwggg012345678910ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg", "description": "This is test for case TC_FS_IT_24"}
212+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/ea5b77d1-9cb1-4ccc-b5a5-7126e1f6fffb"
213+
methodName := "PUT"
214+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
215+
Expect(resp.StatusCode).Should(Equal(202))
216+
Expect(err).NotTo(HaveOccurred())
217+
})
218+
It("TC_FS_IT_25: Update file share Description with empty string", func() {
219+
var jsonStr2 = map[string]interface{}{"description": " "}
220+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/de3c2b70-ae83-4a90-b5be-c792d22c7930"
221+
methodName := "PUT"
222+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
223+
Expect(resp.StatusCode).Should(Equal(202))
224+
Expect(err).NotTo(HaveOccurred())
225+
})
226+
It("TC_FS_IT_26: Update file share Description with special characters", func() {
227+
var jsonStr2 = map[string]interface{}{"description": " "}
228+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/de3c2b70-ae83-4a90-b5be-c792d22c7930"
229+
methodName := "PUT"
230+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
231+
Expect(resp.StatusCode).Should(Equal(202))
232+
Expect(err).NotTo(HaveOccurred())
233+
})
234+
It("TC_FS_IT_27: Update file share Description length more than 255 characters", func() {
235+
var jsonStr2 = map[string]interface{}{"description": " "}
236+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/de3c2b70-ae83-4a90-b5be-c792d22c7930"
237+
methodName := "PUT"
238+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
239+
Expect(resp.StatusCode).Should(Equal(202))
240+
Expect(err).NotTo(HaveOccurred())
241+
})
242+
It("TC_FS_IT_28: Update file share Description with non utf-8 code characters", func() {
243+
var jsonStr2 = map[string]interface{}{"description": " "}
244+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/de3c2b70-ae83-4a90-b5be-c792d22c7930"
245+
methodName := "PUT"
246+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
247+
Expect(resp.StatusCode).Should(Equal(202))
248+
Expect(err).NotTo(HaveOccurred())
249+
})
250+
It("TC_FS_IT_29: Update file share with wrong File Share Id", func() {
251+
var jsonStr2 = map[string]interface{}{"description": " "}
252+
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/de3c2b70-ae83-4a90-b5be-c792d22c7930"
253+
methodName := "PUT"
254+
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
255+
Expect(resp.StatusCode).Should(Equal(202))
256+
Expect(err).NotTo(HaveOccurred())
257+
})
93258
})
94259
})

0 commit comments

Comments
 (0)