Skip to content

Commit

Permalink
Update if-check for the failover REST failure (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
delldubey authored Feb 6, 2024
1 parent 53214d0 commit b66cdd0
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/dell/gofsutil v1.14.0
github.com/dell/goiscsi v1.8.0
github.com/dell/gonvme v1.6.0
github.com/dell/gopowerstore v1.14.1
github.com/dell/gopowerstore v1.14.2
github.com/fsnotify/fsnotify v1.7.0
github.com/go-openapi/strfmt v0.21.3
github.com/golang/mock v1.6.0
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,8 @@ github.com/dell/goiscsi v1.8.0 h1:kocGVOdgnufc6eGpfmwP66hyhY7OVgIafaS/+uM6ogU=
github.com/dell/goiscsi v1.8.0/go.mod h1:PTlQGJaGKYgia95mGwwHSBgvfOr3BfLIjGNh1HT6p+s=
github.com/dell/gonvme v1.6.0 h1:Y/g0Ml8E3oSB+bqGJN1/U+V621h9t0KJeYAF5aQ7NVU=
github.com/dell/gonvme v1.6.0/go.mod h1:/UgJAlR03LbPSDIK2BfhiYUlzyY7lAMJ6ao8eYab2Eg=
github.com/dell/gopowerstore v1.14.1-0.20240123112046-ec40aaf31242 h1:kR8Opp5Rr3syF5uJnmDJNe94QrUbqmLXsjTDrENFG88=
github.com/dell/gopowerstore v1.14.1-0.20240123112046-ec40aaf31242/go.mod h1:YH3SpMX2dr3ouYWWPhk5lzjip3aaVVksFOSoenRDY5w=
github.com/dell/gopowerstore v1.14.1 h1:xn9FFMLDRg42+L9OR8wOnIQfG+YGNauX9qT0vPeEfyw=
github.com/dell/gopowerstore v1.14.1/go.mod h1:YH3SpMX2dr3ouYWWPhk5lzjip3aaVVksFOSoenRDY5w=
github.com/dell/gopowerstore v1.14.2 h1:1mtQBDbMEaVtLKYj1R1z6q5TBKlI2KnGHmWOcZCvcfA=
github.com/dell/gopowerstore v1.14.2/go.mod h1:YH3SpMX2dr3ouYWWPhk5lzjip3aaVVksFOSoenRDY5w=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE=
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ func ExecuteAction(session *gopowerstore.ReplicationSession, pstoreClient gopowe
_, err := pstoreClient.ExecuteActionOnReplicationSession(context.Background(), session.ID, action,
failoverParams)
if err != nil {
if apiError, ok := err.(gopowerstore.APIError); ok && !apiError.UnableToFailoverFromDestination() {
if apiError, ok := err.(gopowerstore.APIError); ok && apiError.UnableToFailoverFromDestination() {
log.Error(fmt.Sprintf("Fail over: Failed to modify RS (%s) - Error (%s)", session.ID, err.Error()))
return status.Errorf(codes.Internal, "Execute action: Failed to modify RS (%s) - Error (%s)", session.ID, err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/replication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ var _ = ginkgo.Describe("Replication", func() {
}
session := gopowerstore.ReplicationSession{ID: "test", State: "Failed_Over"}

clientMock.On("ExecuteActionOnReplicationSession", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(gopowerstore.EmptyResponse(""), gopowerstore.APIError{ErrorMsg: &api.ErrorMsg{StatusCode: http.StatusNotFound}})
clientMock.On("ExecuteActionOnReplicationSession", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(gopowerstore.EmptyResponse(""), gopowerstore.APIError{ErrorMsg: &api.ErrorMsg{StatusCode: http.StatusBadRequest}})
clientMock.On("GetReplicationSessionByLocalResourceID", mock.Anything, mock.Anything).Return(session, nil)

params := make(map[string]string)
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (

require (
github.com/dell/csi-powerstore/v2 v2.8.0
github.com/dell/gopowerstore v1.14.1
github.com/dell/gopowerstore v1.14.2
github.com/onsi/ginkgo/v2 v2.13.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.29.0
Expand Down
1 change: 1 addition & 0 deletions tests/e2e/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ github.com/dell/gonvme v1.6.0 h1:Y/g0Ml8E3oSB+bqGJN1/U+V621h9t0KJeYAF5aQ7NVU=
github.com/dell/gonvme v1.6.0/go.mod h1:/UgJAlR03LbPSDIK2BfhiYUlzyY7lAMJ6ao8eYab2Eg=
github.com/dell/gopowerstore v1.14.1 h1:xn9FFMLDRg42+L9OR8wOnIQfG+YGNauX9qT0vPeEfyw=
github.com/dell/gopowerstore v1.14.1/go.mod h1:YH3SpMX2dr3ouYWWPhk5lzjip3aaVVksFOSoenRDY5w=
github.com/dell/gopowerstore v1.14.2/go.mod h1:YH3SpMX2dr3ouYWWPhk5lzjip3aaVVksFOSoenRDY5w=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0=
Expand Down

0 comments on commit b66cdd0

Please sign in to comment.