@@ -777,6 +777,32 @@ func TestNVMeGetReplicationDetails_Error(t *testing.T) {
777777 assert .ErrorContains (t , err , "invalid volume name" )
778778}
779779
780+ func TestNVMeUpdateMirror_Error (t * testing.T ) {
781+ d := newNVMeDriver (nil , nil , nil )
782+
783+ err := d .UpdateMirror (ctx , "" , "" )
784+
785+ assert .ErrorContains (t , err , "invalid volume name" )
786+ }
787+
788+ func TestNVMeCheckMirrorTransferState_Error (t * testing.T ) {
789+ d , mAPI := newNVMeDriverAndMockApi (t )
790+ mAPI .EXPECT ().SVMName ().Return ("svm" )
791+
792+ _ , err := d .CheckMirrorTransferState (ctx , "" )
793+
794+ assert .ErrorContains (t , err , "invalid volume name" )
795+ }
796+
797+ func TestNVMeGetMirrorTransferTime_Error (t * testing.T ) {
798+ d , mAPI := newNVMeDriverAndMockApi (t )
799+ mAPI .EXPECT ().SVMName ().Return ("svm" )
800+
801+ _ , err := d .GetMirrorTransferTime (ctx , "" )
802+
803+ assert .ErrorContains (t , err , "invalid volume name" )
804+ }
805+
780806func getNVMeCreateArgs (d * NVMeStorageDriver ) (storage.Pool , * storage.VolumeConfig , map [string ]sa.Request ) {
781807 pool1 := d .virtualPools ["pool1" ]
782808 volConfig := & storage.VolumeConfig {InternalName : "vol1" , Size : "200000000" }
@@ -1177,8 +1203,9 @@ func TestNVMeDestroy_VolumeDestroy(t *testing.T) {
11771203 "Volume destroy API call return error" : {
11781204 configureMockOntapAPI : func (mockAPI * mockapi.MockOntapAPI ) {
11791205 mockAPI .EXPECT ().VolumeExists (ctx , gomock .Any ()).Return (true , nil )
1180- mockAPI .EXPECT ().SVMName ().Return ("svm" )
1206+ mockAPI .EXPECT ().SVMName ().Return ("svm" ). AnyTimes ()
11811207 mockAPI .EXPECT ().SnapmirrorDeleteViaDestination (ctx , gomock .Any (), gomock .Any ()).Return (nil )
1208+ mockAPI .EXPECT ().SnapmirrorRelease (ctx , gomock .Any (), gomock .Any ()).Return (nil )
11821209 mockAPI .EXPECT ().VolumeDestroy (ctx , gomock .Any (), true ,
11831210 false ).Return (fmt .Errorf ("destroy volume failed" ))
11841211 },
@@ -1191,8 +1218,9 @@ func TestNVMeDestroy_VolumeDestroy(t *testing.T) {
11911218 "volume Destroy error: volume config with internal snapshot" : {
11921219 configureMockOntapAPI : func (mockAPI * mockapi.MockOntapAPI ) {
11931220 mockAPI .EXPECT ().VolumeExists (ctx , gomock .Any ()).Return (true , nil )
1194- mockAPI .EXPECT ().SVMName ().Return ("svm" )
1221+ mockAPI .EXPECT ().SVMName ().Return ("svm" ). AnyTimes ()
11951222 mockAPI .EXPECT ().SnapmirrorDeleteViaDestination (ctx , gomock .Any (), gomock .Any ()).Return (nil )
1223+ mockAPI .EXPECT ().SnapmirrorRelease (ctx , gomock .Any (), gomock .Any ()).Return (nil )
11961224 mockAPI .EXPECT ().VolumeDestroy (ctx , gomock .Any (), true ,
11971225 false ).Return (fmt .Errorf ("destroy volume failed" ))
11981226 },
@@ -1207,8 +1235,9 @@ func TestNVMeDestroy_VolumeDestroy(t *testing.T) {
12071235 "happy path" : {
12081236 configureMockOntapAPI : func (mockAPI * mockapi.MockOntapAPI ) {
12091237 mockAPI .EXPECT ().VolumeExists (ctx , gomock .Any ()).Return (true , nil )
1210- mockAPI .EXPECT ().SVMName ().Return ("svm" )
1238+ mockAPI .EXPECT ().SVMName ().Return ("svm" ). AnyTimes ()
12111239 mockAPI .EXPECT ().SnapmirrorDeleteViaDestination (ctx , gomock .Any (), gomock .Any ()).Return (nil )
1240+ mockAPI .EXPECT ().SnapmirrorRelease (ctx , gomock .Any (), gomock .Any ()).Return (nil )
12121241 mockAPI .EXPECT ().VolumeDestroy (ctx , gomock .Any (), true , false ).Return (nil )
12131242 },
12141243 getVolumeConfig : func (driver * NVMeStorageDriver ) storage.VolumeConfig {
@@ -1220,8 +1249,9 @@ func TestNVMeDestroy_VolumeDestroy(t *testing.T) {
12201249 "happy path: volume config with internal snapshot" : {
12211250 configureMockOntapAPI : func (mockAPI * mockapi.MockOntapAPI ) {
12221251 mockAPI .EXPECT ().VolumeExists (ctx , gomock .Any ()).Return (true , nil )
1223- mockAPI .EXPECT ().SVMName ().Return ("svm" )
1252+ mockAPI .EXPECT ().SVMName ().Return ("svm" ). AnyTimes ()
12241253 mockAPI .EXPECT ().SnapmirrorDeleteViaDestination (ctx , gomock .Any (), gomock .Any ()).Return (nil )
1254+ mockAPI .EXPECT ().SnapmirrorRelease (ctx , gomock .Any (), gomock .Any ()).Return (nil )
12251255 mockAPI .EXPECT ().VolumeDestroy (ctx , gomock .Any (), true , false ).Return (nil )
12261256 mockAPI .EXPECT ().VolumeSnapshotDelete (ctx , cloneSourceSnapshot , "" ).Return (nil )
12271257 },
@@ -1236,8 +1266,9 @@ func TestNVMeDestroy_VolumeDestroy(t *testing.T) {
12361266 "volume config with internal snapshot: snapshot delete error" : {
12371267 configureMockOntapAPI : func (mockAPI * mockapi.MockOntapAPI ) {
12381268 mockAPI .EXPECT ().VolumeExists (ctx , gomock .Any ()).Return (true , nil )
1239- mockAPI .EXPECT ().SVMName ().Return ("svm" )
1269+ mockAPI .EXPECT ().SVMName ().Return ("svm" ). AnyTimes ()
12401270 mockAPI .EXPECT ().SnapmirrorDeleteViaDestination (ctx , gomock .Any (), gomock .Any ()).Return (nil )
1271+ mockAPI .EXPECT ().SnapmirrorRelease (ctx , gomock .Any (), gomock .Any ()).Return (nil )
12411272 mockAPI .EXPECT ().VolumeDestroy (ctx , gomock .Any (), true , false ).Return (nil )
12421273 mockAPI .EXPECT ().VolumeSnapshotDelete (ctx , cloneSourceSnapshot , "" ).
12431274 Return (fmt .Errorf ("failed to delete snapshot" ))
@@ -1253,8 +1284,9 @@ func TestNVMeDestroy_VolumeDestroy(t *testing.T) {
12531284 "volume config with internal snapshot: snapshot delete not found error" : {
12541285 configureMockOntapAPI : func (mockAPI * mockapi.MockOntapAPI ) {
12551286 mockAPI .EXPECT ().VolumeExists (ctx , gomock .Any ()).Return (true , nil )
1256- mockAPI .EXPECT ().SVMName ().Return ("svm" )
1287+ mockAPI .EXPECT ().SVMName ().Return ("svm" ). AnyTimes ()
12571288 mockAPI .EXPECT ().SnapmirrorDeleteViaDestination (ctx , gomock .Any (), gomock .Any ()).Return (nil )
1289+ mockAPI .EXPECT ().SnapmirrorRelease (ctx , gomock .Any (), gomock .Any ()).Return (nil )
12581290 mockAPI .EXPECT ().VolumeDestroy (ctx , gomock .Any (), true , false ).Return (nil )
12591291 mockAPI .EXPECT ().VolumeSnapshotDelete (ctx , cloneSourceSnapshot , "" ).
12601292 Return (api .NotFoundError ("snapshot not found" ))
@@ -1270,8 +1302,9 @@ func TestNVMeDestroy_VolumeDestroy(t *testing.T) {
12701302 "skipRecoveryQueue volume" : {
12711303 configureMockOntapAPI : func (mockAPI * mockapi.MockOntapAPI ) {
12721304 mockAPI .EXPECT ().VolumeExists (ctx , gomock .Any ()).Return (true , nil )
1273- mockAPI .EXPECT ().SVMName ().Return ("svm" )
1305+ mockAPI .EXPECT ().SVMName ().Return ("svm" ). AnyTimes ()
12741306 mockAPI .EXPECT ().SnapmirrorDeleteViaDestination (ctx , gomock .Any (), gomock .Any ()).Return (nil )
1307+ mockAPI .EXPECT ().SnapmirrorRelease (ctx , gomock .Any (), gomock .Any ()).Return (nil )
12751308 mockAPI .EXPECT ().VolumeDestroy (ctx , gomock .Any (), true , true ).Return (nil )
12761309 },
12771310 getVolumeConfig : func (driver * NVMeStorageDriver ) storage.VolumeConfig {
0 commit comments