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