Skip to content

Commit

Permalink
end
Browse files Browse the repository at this point in the history
  • Loading branch information
Shruthi-1MN committed Sep 9, 2019
1 parent 140905a commit c84b213
Show file tree
Hide file tree
Showing 2 changed files with 182 additions and 114 deletions.
199 changes: 182 additions & 17 deletions test/integration/fileshare_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ package integration
import (
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/opensds/opensds/test/integration/utils"
)

Expand All @@ -35,60 +33,227 @@ var (

var _ = Describe("FileShare Testing", func() {
Context("create FileShare ", func() {
It("TC_FS_IT_01: Create fileshare with name input ", func() {
var jsonStr = map[string]interface{}{"name": "share2223", "description": "This is just for test222", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
It("TC_FS_IT_01: Create fileshare with name input", func() {
var jsonStr = map[string]interface{}{"name": "share2223", "description": "This is just for test222", "size": 2}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_02: Create fileshare with empty file share name ", func() {
var jsonStr2 = map[string]interface{}{"name": "", "description": "This is just for testxxx", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
It("TC_FS_IT_02: Create fileshare with empty file share name", func() {
var jsonStr2 = map[string]interface{}{"name": "", "description": "This is just for testxxx", "size": 2}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, _ := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(400))
})
It("TC_FS_IT_03: Create file share name with other encoding characters(except utf-8) ", func() {
var jsonStr2 = map[string]interface{}{"name": "İnanç Esasları", "description": "This is just for testxxx", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
It("TC_FS_IT_03: Create file share name with other encoding characters(except utf-8)", func() {
var jsonStr2 = map[string]interface{}{"name": "İnanç Esasları", "description": "This is just for testxxx", "size": 2}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_04: Create file share name having special characters ", func() {
var jsonStr2 = map[string]interface{}{"name": "#FileShare Code!$!test", "description": "This is just for testxxx", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
It("TC_FS_IT_04: Create file share name having special characters", func() {
var jsonStr2 = map[string]interface{}{"name": "#FileShare Code!$!test", "description": "This is just for testxxx", "size": 2}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, _ := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
})
It("TC_FS_IT_05: Create file share name starts with numbers ", func() {
var jsonStr2 = map[string]interface{}{"name": "123test", "description": "This is just for testxxx", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
It("TC_FS_IT_05: Create file share name starts with numbers", func() {
var jsonStr2 = map[string]interface{}{"name": "123test", "description": "This is just for testxxx", "size": 2}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_06: Create file share name length more than 255 characters ", func() {
var jsonStr2 = map[string]interface{}{"name": "abqwqwqwggg012345678910gggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg", "description": "This is just for testxxx", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
It("TC_FS_IT_06: Create file share name length more than 255 characters", func() {
var jsonStr2 = map[string]interface{}{"name": "abqwqwqwggg012345678910gggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg", "description": "This is just for testxxx", "size": 2}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(400))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_08: Create file share description with empty string ", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd123", "description": "#FileShare Code!$!test", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
It("TC_FS_IT_08: Create file share description with empty string", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd123", "description": "", "size": 2}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_09: Create file share with description having special characters", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd124", "description": "#FileShare Code!$!test", "size": 2}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(400))
Expect(err).NotTo(HaveOccurred())
})

It("TC_FS_IT_10: Create file share with description with more than 255 characters", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd125", "description": "abqwqwqwggg012345678910ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg", "size": 2}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_11: Create file share without required parameters like fileshare name, size", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd126", "description": " "}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(400))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_12: Create file share with size with -ve number", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd127", "description": " ", "size": -2}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(400))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_13: Create file share with size with +ve number", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd128", "description": " ", "size": 2}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_14: Create file share with size with more than total capacity", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd129", "description": " ", "size": 50}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_15: Create file share Size with 0", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd130", "description": " ", "size": 0}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(400))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_16: Create file share by specifying the File Share Id", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd131", "description": " ", "size": 2}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_17: Create file share by specifying the Profile id", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd132", "description": " ", "size": 2, "profileId": "0191d383-3af4-46ca-abd4-8027daa4446c"}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_18: Create file share by without specifying Profile Id", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd133", "description": " ", "size": 2}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_19: Create file share by specifying wrong profile Id", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd134", "description": " ", "size": 2, "profileId": "df40af1a-17b5-48e5-899f-fa098b0bd5da"}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(400))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_20: Create file share by specifying Availability zone name", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd135", "description": " ", "size": 2, "availabillityZone": "default"}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_21: Create file share by specifying wrong Availability zone name", func() {
var jsonStr2 = map[string]interface{}{"name": "abcd136", "description": " ", "size": 2, "availabillityZone": "default1"}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares"
methodName := "POST"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(400))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_22: Update file share name with empty string", func() {
var jsonStr2 = map[string]interface{}{"name": "", "description": "This is test for case TC_FS_IT_22"}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/add61d3c-5248-4dec-8d0d-9e84fd6fbbb6"
methodName := "PUT"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_23: Update file share name with special character string", func() {
var jsonStr2 = map[string]interface{}{"name": "$File$Test!1", "description": "This is test for case TC_FS_IT_23"}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/e3885ace-23d4-4a52-a47f-0efc87b82821"
methodName := "PUT"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_24: Update file share name length greater than 255 characters", func() {
var jsonStr2 = map[string]interface{}{"name": "abc2abqwqwqwggg012345678910ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg", "description": "This is test for case TC_FS_IT_24"}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/ea5b77d1-9cb1-4ccc-b5a5-7126e1f6fffb"
methodName := "PUT"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_25: Update file share Description with empty string", func() {
var jsonStr2 = map[string]interface{}{"description": " "}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/de3c2b70-ae83-4a90-b5be-c792d22c7930"
methodName := "PUT"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_26: Update file share Description with special characters", func() {
var jsonStr2 = map[string]interface{}{"description": " "}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/de3c2b70-ae83-4a90-b5be-c792d22c7930"
methodName := "PUT"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_27: Update file share Description length more than 255 characters", func() {
var jsonStr2 = map[string]interface{}{"description": " "}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/de3c2b70-ae83-4a90-b5be-c792d22c7930"
methodName := "PUT"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_28: Update file share Description with non utf-8 code characters", func() {
var jsonStr2 = map[string]interface{}{"description": " "}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/de3c2b70-ae83-4a90-b5be-c792d22c7930"
methodName := "PUT"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
It("TC_FS_IT_29: Update file share with wrong File Share Id", func() {
var jsonStr2 = map[string]interface{}{"description": " "}
url := "http://127.0.0.1:50040/v1beta/e93b4c0934da416eb9c8d120c5d04d96/file/shares/de3c2b70-ae83-4a90-b5be-c792d22c7930"
methodName := "PUT"
resp, err := utils.ConnectToHTTP(methodName, url, jsonStr2)
Expect(resp.StatusCode).Should(Equal(202))
Expect(err).NotTo(HaveOccurred())
})
})
})
Loading

0 comments on commit c84b213

Please sign in to comment.