1717package integration
1818
1919import (
20+ "fmt"
2021 "reflect"
2122 "testing"
2223
@@ -35,28 +36,57 @@ func init() {
3536}
3637
3738func 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
0 commit comments