Skip to content

Commit

Permalink
Merge pull request #8404 from Lyndon-Li/release-1.15
Browse files Browse the repository at this point in the history
[1.15] Issue 8391: check ErrCancelled from suffix
  • Loading branch information
Lyndon-Li authored Nov 13, 2024
2 parents 13d8e7d + 0fc822b commit 40b8551
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelogs/unreleased/8404-Lyndon-Li
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix issue #8391, check ErrCancelled from suffix of data mover pod's termination message
3 changes: 2 additions & 1 deletion pkg/datapath/micro_service_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"encoding/json"
"os"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -321,7 +322,7 @@ func (ms *microServiceBRWatcher) startWatch() {
if lastPod.Status.Phase == v1.PodSucceeded {
ms.callbacks.OnCompleted(ms.ctx, ms.namespace, ms.taskName, funcGetResultFromMessage(ms.taskType, terminateMessage, ms.log))
} else {
if terminateMessage == ErrCancelled {
if strings.HasSuffix(terminateMessage, ErrCancelled) {
ms.callbacks.OnCancelled(ms.ctx, ms.namespace, ms.taskName)
} else {
ms.callbacks.OnFailed(ms.ctx, ms.namespace, ms.taskName, errors.New(terminateMessage))
Expand Down
2 changes: 1 addition & 1 deletion pkg/datapath/micro_service_watcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ func TestStartWatch(t *testing.T) {
event: &v1.Event{Reason: EventReasonStopped},
},
},
terminationMessage: ErrCancelled,
terminationMessage: fmt.Sprintf("Failed to init data path service for DataUpload %s: %v", "fake-du-name", errors.New(ErrCancelled)),
expectStartEvent: true,
expectTerminateEvent: true,
expectCancel: true,
Expand Down

0 comments on commit 40b8551

Please sign in to comment.