@@ -36,12 +36,15 @@ func init() {
3636
3737func TestClientCreateProfile (t * testing.T ) {
3838 var body = & model.ProfileSpec {
39- Name : "silver" ,
40- Description : "silver policy" ,
39+ //BaseModel: &model.BaseModel{
40+ // Id: "1106b972-66ef-11e7-b172-db03f3689c9c",
41+ //},
42+ Name : "default" ,
43+ Description : "default policy" ,
4144 StorageType : "block" ,
42- CustomProperties : model.CustomPropertiesSpec {
43- "diskType" : "SAS" ,
44- },
45+ // CustomProperties: model.CustomPropertiesSpec{
46+ // "diskType": "SAS",
47+ // },
4548 }
4649
4750 prf , err := c .CreateProfile (body )
@@ -546,3 +549,115 @@ func TestClientFailoverReplication(t *testing.T) {
546549 t.Log("Disable volume replication not ready!")
547550}
548551*/
552+
553+ /*
554+ File share integration test cases
555+ */
556+
557+ func TestClientCreateFileProfile (t * testing.T ) {
558+ var body = & model.ProfileSpec {
559+ Name : "gold" ,
560+ Description : "gold policy" ,
561+ StorageType : "block" ,
562+ CustomProperties : model.CustomPropertiesSpec {
563+ "diskType" : "SAS" ,
564+ },
565+ }
566+
567+ prf , err := c .CreateProfile (body )
568+ if err != nil {
569+ t .Error ("create profile in client failed:" , err )
570+ return
571+ }
572+ // If customized properties are not defined, create an empty one.
573+ if prf .CustomProperties == nil {
574+ prf .CustomProperties = model.CustomPropertiesSpec {}
575+ }
576+
577+ var expected = & SampleFileShareProfiles [0 ]
578+ if ! reflect .DeepEqual (prf , expected ) {
579+ t .Errorf ("expected %+v, got %+v\n " , expected , prf )
580+ }
581+ }
582+
583+ //func TestClientGetProfile(t *testing.T) {
584+ // var prfID = "2f9c0a04-66ef-11e7-ade2-43158893e017"
585+ //
586+ // prf, err := c.GetProfile(prfID)
587+ // if err != nil {
588+ // t.Error("get profile in client failed:", err)
589+ // return
590+ // }
591+ //
592+ // var expected = &SampleProfiles[1]
593+ // if !reflect.DeepEqual(prf, expected) {
594+ // t.Errorf("expected %+v, got %+v\n", expected, prf)
595+ // }
596+ //}
597+ //
598+ //func TestClientListProfiles(t *testing.T) {
599+ // prfs, err := c.ListProfiles()
600+ // if err != nil {
601+ // t.Error("list profiles in client failed:", err)
602+ // return
603+ // }
604+ // // If extras are not defined, create an empty one.
605+ // for _, prf := range prfs {
606+ // if prf.CustomProperties == nil {
607+ // prf.CustomProperties = model.CustomPropertiesSpec{}
608+ // }
609+ // }
610+ //
611+ // var expected []*model.ProfileSpec
612+ // for i := range SampleProfiles {
613+ // expected = append(expected, &SampleProfiles[i])
614+ // }
615+ // if !reflect.DeepEqual(prfs, expected) {
616+ // t.Errorf("expected %+v, got %+v\n", expected, prfs)
617+ // }
618+ //}
619+ //
620+ //func TestClientAddCustomProperty(t *testing.T) {
621+ // var prfID = "2f9c0a04-66ef-11e7-ade2-43158893e017"
622+ // var body = &model.CustomPropertiesSpec{
623+ // "diskType": "SAS",
624+ // }
625+ //
626+ // ext, err := c.AddCustomProperty(prfID, body)
627+ // if err != nil {
628+ // t.Error("add profile extra property in client failed:", err)
629+ // return
630+ // }
631+ //
632+ // var expected = &SampleProfiles[0].CustomProperties
633+ // if !reflect.DeepEqual(ext, expected) {
634+ // t.Errorf("expected %+v, got %+v\n", expected, ext)
635+ // }
636+ //}
637+ //
638+ //func TestClientListCustomProperties(t *testing.T) {
639+ // var prfID = "2f9c0a04-66ef-11e7-ade2-43158893e017"
640+ //
641+ // ext, err := c.ListCustomProperties(prfID)
642+ // if err != nil {
643+ // t.Error("list profile customized properties in client failed:", err)
644+ // return
645+ // }
646+ //
647+ // var expected = &SampleProfiles[0].CustomProperties
648+ // if !reflect.DeepEqual(ext, expected) {
649+ // t.Errorf("expected %+v, got %+v\n", expected, ext)
650+ // }
651+ //}
652+ //
653+ //func TestClientRemoveCustomProperty(t *testing.T) {
654+ // var prfID = "2f9c0a04-66ef-11e7-ade2-43158893e017"
655+ // var customKey = "iops"
656+ //
657+ // if err := c.RemoveCustomProperty(prfID, customKey); err != nil {
658+ // t.Error("remove profile customized property in client failed:", err)
659+ // return
660+ // }
661+ //
662+ // t.Log("Remove customized property <iops> success!")
663+ //}
0 commit comments