Skip to content

Commit 5a4e0a9

Browse files
Fix ArchiveExecutionTask key type (#3720)
1 parent 728f6ce commit 5a4e0a9

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

service/history/tasks/archive_execution_task.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type (
4545
)
4646

4747
func (a *ArchiveExecutionTask) GetKey() Key {
48-
return NewImmediateKey(a.TaskID)
48+
return NewKey(a.VisibilityTimestamp, a.TaskID)
4949
}
5050

5151
func (a *ArchiveExecutionTask) GetTaskID() int64 {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// The MIT License
2+
//
3+
// Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
4+
//
5+
// Copyright (c) 2020 Uber Technologies, Inc.
6+
//
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy
8+
// of this software and associated documentation files (the "Software"), to deal
9+
// in the Software without restriction, including without limitation the rights
10+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
// copies of the Software, and to permit persons to whom the Software is
12+
// furnished to do so, subject to the following conditions:
13+
//
14+
// The above copyright notice and this permission notice shall be included in
15+
// all copies or substantial portions of the Software.
16+
//
17+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
// THE SOFTWARE.
24+
25+
package tasks
26+
27+
import (
28+
"testing"
29+
"time"
30+
31+
"github.com/stretchr/testify/assert"
32+
33+
enumsspb "go.temporal.io/server/api/enums/v1"
34+
"go.temporal.io/server/common/definition"
35+
)
36+
37+
func TestArchiveExecutionTask(t *testing.T) {
38+
workflowKey := definition.NewWorkflowKey("namespace", "workflowID", "runID")
39+
visibilityTimestamp := time.Now()
40+
taskID := int64(123)
41+
version := int64(456)
42+
task := &ArchiveExecutionTask{
43+
WorkflowKey: workflowKey,
44+
VisibilityTimestamp: visibilityTimestamp,
45+
TaskID: taskID,
46+
Version: version,
47+
}
48+
assert.Equal(t, NewKey(visibilityTimestamp, taskID), task.GetKey())
49+
assert.Equal(t, taskID, task.GetTaskID())
50+
assert.Equal(t, visibilityTimestamp, task.GetVisibilityTime())
51+
assert.Equal(t, version, task.GetVersion())
52+
assert.Equal(t, CategoryArchival, task.GetCategory())
53+
assert.Equal(t, enumsspb.TASK_TYPE_ARCHIVAL_ARCHIVE_EXECUTION, task.GetType())
54+
}

0 commit comments

Comments
 (0)