Skip to content

Commit fe416fe

Browse files
author
Shruthi-1MN
committed
end
1 parent 74f207d commit fe416fe

10 files changed

Lines changed: 872 additions & 187 deletions

File tree

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ before_install:
2525
- sudo apt-get install -y build-essential gcc
2626
- sudo apt-get install -y librados-dev librbd-dev
2727
- sudo apt-get install -y lvm2 tgt open-iscsi
28+
- go get -v github.com/onsi/gomega
29+
- go get -v github.com/onsi/ginkgo/ginkgo
30+
- go get github.com/modocache/gover
31+
- go get -v -t ./...
32+
- export PATH=$PATH:$HOME/gopath/bin
2833

2934
matrix:
3035
fast_finish: true
@@ -61,6 +66,11 @@ jobs:
6166
- script: make osds_e2etest_build
6267
name: "e2e_test" # names the fifth Tests stage job
6368

69+
after_failure:
70+
- for v in /var/log/opensds/*.log ; do
71+
echo $v logtail ======================== ; tail -100 $v ;
72+
done
73+
6474
after_success:
6575
- bash <(curl -s https://codecov.io/bash)
6676
# Clean OpenSDS Controller built data

client/profile.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package client
1616

1717
import (
18+
"fmt"
1819
"strings"
1920

2021
"github.com/opensds/opensds/pkg/model"
@@ -54,11 +55,11 @@ func (p *ProfileMgr) CreateProfile(body ProfileBuilder) (*model.ProfileSpec, err
5455
url := strings.Join([]string{
5556
p.Endpoint,
5657
urls.GenerateProfileURL(urls.Client, p.TenantId)}, "/")
57-
58+
fmt.Println("client boddy...................... ", body)
5859
if err := p.Recv(url, "POST", body, &res); err != nil {
5960
return nil, err
6061
}
61-
62+
fmt.Println("res body >>>>>>>>>>>>>>>>>>>>>>>>>>>> ", res)
6263
return &res, nil
6364
}
6465

test/e2e/e2e_test.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,28 @@ func init() {
4747
prfs, _ := c.ListProfiles()
4848
if len(prfs) == 0 {
4949
fmt.Println("Start creating profile...")
50-
var body = &model.ProfileSpec{
50+
var vbody = &model.ProfileSpec{
5151
Name: "default",
5252
Description: "default policy",
5353
StorageType: "block",
5454
}
55-
prf, err := c.CreateProfile(body)
55+
vprf, err := c.CreateProfile(vbody)
5656
if err != nil {
5757
fmt.Printf("create profile failed: %v\n", err)
5858
return
5959
}
60-
prfs = append(prfs, prf)
60+
prfs = append(prfs, vprf)
61+
var fbody = &model.ProfileSpec{
62+
Name: "test_file",
63+
Description: "test_file policy",
64+
StorageType: "block",
65+
}
66+
fprf, err := c.CreateProfile(fbody)
67+
if err != nil {
68+
fmt.Printf("create profile failed: %v\n", err)
69+
return
70+
}
71+
prfs = append(prfs, fprf)
6172
}
6273
profileId = prfs[0].Id
6374
}

test/integration/client_test.go

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package integration
1818

1919
import (
20+
"fmt"
2021
"reflect"
2122
"testing"
2223

@@ -35,28 +36,57 @@ func init() {
3536
}
3637

3738
func TestClientCreateProfile(t *testing.T) {
38-
var body = &model.ProfileSpec{
39+
var body1 = &model.ProfileSpec{
3940
Name: "silver",
4041
Description: "silver policy",
4142
StorageType: "block",
4243
CustomProperties: model.CustomPropertiesSpec{
4344
"diskType": "SAS",
4445
},
4546
}
46-
47-
prf, err := c.CreateProfile(body)
47+
fmt.Println("body >>>>>>>>>>>>>>>>>>>> ", body1)
48+
prf1, err := c.CreateProfile(body1)
4849
if err != nil {
4950
t.Error("create profile in client failed:", err)
5051
return
5152
}
53+
5254
// If customized properties are not defined, create an empty one.
53-
if prf.CustomProperties == nil {
54-
prf.CustomProperties = model.CustomPropertiesSpec{}
55+
if prf1.CustomProperties == nil {
56+
prf1.CustomProperties = model.CustomPropertiesSpec{}
5557
}
58+
fmt.Println("got >>>>>>>>>>>>>>>>>>>>> ",prf1)
5659

57-
var expected = &SampleProfiles[0]
58-
if !reflect.DeepEqual(prf, expected) {
59-
t.Errorf("expected %+v, got %+v\n", expected, prf)
60+
var expected = &SampleProfiles[1]
61+
fmt.Println("expected >>>>>>>>>>>>>>>>>>>>>>> ", expected)
62+
if !reflect.DeepEqual(prf1, expected) {
63+
t.Errorf("expected %+v, got %+v\n", expected, prf1)
64+
}
65+
}
66+
67+
func TestClientCreateFileProfile(t *testing.T) {
68+
var filebody = &model.ProfileSpec{
69+
Name: "file_prf",
70+
Description: "file_prf policy",
71+
StorageType: "file",
72+
//CustomProperties: model.CustomPropertiesSpec{
73+
// "diskType": "SAS",
74+
//},
75+
}
76+
77+
fileprf, err := c.CreateProfile(filebody)
78+
if err != nil {
79+
t.Error("create profile in client failed:", err)
80+
return
81+
}
82+
// If customized properties are not defined, create an empty one.
83+
//if prf.CustomProperties == nil {
84+
// prf.CustomProperties = model.CustomPropertiesSpec{}
85+
//}
86+
87+
var expected = &SampleFileShareProfiles[2]
88+
if !reflect.DeepEqual(fileprf, expected) {
89+
t.Errorf("expected %+v, got %+v\n", expected, fileprf)
6090
}
6191
}
6292

test/integration/fileshare_suit_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ import (
2020
"fmt"
2121
"testing"
2222

23-
. "github.com/onsi/ginkgo"
24-
. "github.com/onsi/gomega"
23+
"github.com/onsi/ginkgo"
24+
"github.com/onsi/gomega"
2525
)
2626

2727
//Function to run the Ginkgo Test
2828
func TestFileShareIntegration(t *testing.T) {
29-
RegisterFailHandler(Fail)
29+
gomega.RegisterFailHandler(ginkgo.Fail)
3030
//var UID string
31-
var _ = BeforeSuite(func() {
31+
var _ = ginkgo.BeforeSuite(func() {
3232
fmt.Println("Before Suite Execution")
3333

3434
})
35-
AfterSuite(func() {
36-
By("After Suite Execution....!")
35+
ginkgo.AfterSuite(func() {
36+
ginkgo.By("After Suite Execution....!")
3737
})
3838

39-
RunSpecs(t, "File Share Integration Test Suite")
39+
ginkgo.RunSpecs(t, "File Share Integration Test Suite")
4040
}

0 commit comments

Comments
 (0)