Skip to content

Commit

Permalink
end
Browse files Browse the repository at this point in the history
  • Loading branch information
Shruthi-1MN committed Oct 9, 2019
1 parent 74f207d commit a2e7373
Show file tree
Hide file tree
Showing 10 changed files with 860 additions and 178 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ before_install:
- sudo apt-get install -y build-essential gcc
- sudo apt-get install -y librados-dev librbd-dev
- sudo apt-get install -y lvm2 tgt open-iscsi
- go get -v github.com/onsi/gomega
- go get -v github.com/onsi/ginkgo/ginkgo
- go get github.com/modocache/gover
- go get -v -t ./...
- export PATH=$PATH:$HOME/gopath/bin

matrix:
fast_finish: true
Expand Down Expand Up @@ -61,6 +66,11 @@ jobs:
- script: make osds_e2etest_build
name: "e2e_test" # names the fifth Tests stage job

after_failure:
- for v in /var/log/opensds/*.log ; do
echo $v logtail ======================== ; tail -100 $v ;
done

after_success:
- bash <(curl -s https://codecov.io/bash)
# Clean OpenSDS Controller built data
Expand Down
5 changes: 3 additions & 2 deletions client/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package client

import (
"fmt"
"strings"

"github.com/opensds/opensds/pkg/model"
Expand Down Expand Up @@ -54,11 +55,11 @@ func (p *ProfileMgr) CreateProfile(body ProfileBuilder) (*model.ProfileSpec, err
url := strings.Join([]string{
p.Endpoint,
urls.GenerateProfileURL(urls.Client, p.TenantId)}, "/")

fmt.Println("client boddy...................... ", body)
if err := p.Recv(url, "POST", body, &res); err != nil {
return nil, err
}

fmt.Println("res body >>>>>>>>>>>>>>>>>>>>>>>>>>>> ", res)
return &res, nil
}

Expand Down
17 changes: 14 additions & 3 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,28 @@ func init() {
prfs, _ := c.ListProfiles()
if len(prfs) == 0 {
fmt.Println("Start creating profile...")
var body = &model.ProfileSpec{
var vbody = &model.ProfileSpec{
Name: "default",
Description: "default policy",
StorageType: "block",
}
prf, err := c.CreateProfile(body)
vprf, err := c.CreateProfile(vbody)
if err != nil {
fmt.Printf("create profile failed: %v\n", err)
return
}
prfs = append(prfs, prf)
prfs = append(prfs, vprf)
var fbody = &model.ProfileSpec{
Name: "default_file",
Description: "default_file policy",
StorageType: "block",
}
fprf, err := c.CreateProfile(fbody)
if err != nil {
fmt.Printf("create profile failed: %v\n", err)
return
}
prfs = append(prfs, fprf)
}
profileId = prfs[0].Id
}
Expand Down
46 changes: 38 additions & 8 deletions test/integration/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package integration

import (
"fmt"
"reflect"
"testing"

Expand All @@ -35,28 +36,57 @@ func init() {
}

func TestClientCreateProfile(t *testing.T) {
var body = &model.ProfileSpec{
var body1 = &model.ProfileSpec{
Name: "silver",
Description: "silver policy",
StorageType: "block",
CustomProperties: model.CustomPropertiesSpec{
"diskType": "SAS",
},
}

prf, err := c.CreateProfile(body)
fmt.Println("body >>>>>>>>>>>>>>>>>>>> ", body1)
prf1, err := c.CreateProfile(body1)
if err != nil {
t.Error("create profile in client failed:", err)
return
}

// If customized properties are not defined, create an empty one.
if prf.CustomProperties == nil {
prf.CustomProperties = model.CustomPropertiesSpec{}
if prf1.CustomProperties == nil {
prf1.CustomProperties = model.CustomPropertiesSpec{}
}
fmt.Println("got >>>>>>>>>>>>>>>>>>>>> ",prf1)

var expected = &SampleProfiles[0]
if !reflect.DeepEqual(prf, expected) {
t.Errorf("expected %+v, got %+v\n", expected, prf)
var expected = &SampleProfiles[1]
fmt.Println("expected >>>>>>>>>>>>>>>>>>>>>>> ", expected)
if !reflect.DeepEqual(prf1, expected) {
t.Errorf("expected %+v, got %+v\n", expected, prf1)
}
}

func TestClientCreateFileProfile(t *testing.T) {
var filebody = &model.ProfileSpec{
Name: "file_prf",
Description: "file_prf policy",
StorageType: "file",
//CustomProperties: model.CustomPropertiesSpec{
// "diskType": "SAS",
//},
}

fileprf, err := c.CreateProfile(filebody)
if err != nil {
t.Error("create profile in client failed:", err)
return
}
// If customized properties are not defined, create an empty one.
//if prf.CustomProperties == nil {
// prf.CustomProperties = model.CustomPropertiesSpec{}
//}

var expected = &SampleFileShareProfiles[2]
if !reflect.DeepEqual(fileprf, expected) {
t.Errorf("expected %+v, got %+v\n", expected, fileprf)
}
}

Expand Down
14 changes: 7 additions & 7 deletions test/integration/fileshare_suit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ import (
"fmt"
"testing"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/ginkgo"
"github.com/onsi/gomega"
)

//Function to run the Ginkgo Test
func TestFileShareIntegration(t *testing.T) {
RegisterFailHandler(Fail)
gomega.RegisterFailHandler(ginkgo.Fail)
//var UID string
var _ = BeforeSuite(func() {
var _ = ginkgo.BeforeSuite(func() {
fmt.Println("Before Suite Execution")

})
AfterSuite(func() {
By("After Suite Execution....!")
ginkgo.AfterSuite(func() {
ginkgo.By("After Suite Execution....!")
})

RunSpecs(t, "File Share Integration Test Suite")
ginkgo.RunSpecs(t, "File Share Integration Test Suite")
}
Loading

0 comments on commit a2e7373

Please sign in to comment.