Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tests for DeleteTaskList #6047

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions common/persistence/nosql/nosql_task_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,27 @@ func TestUpdateTaskList_ConditionFailure(t *testing.T) {
assert.ErrorContains(t, err, "Failed to update task list. name: test-tasklist, type: 0, rangeID: 1, columns: (test-details)")
}

func TestDeleteTaskList(t *testing.T) {
store, db := setupNoSQLStoreMocks(t)
db.EXPECT().DeleteTaskList(gomock.Any(), getDecisionTaskListFilter(), int64(0)).Return(nil)

err := store.DeleteTaskList(context.Background(), getValidDeleteTaskListRequest())
assert.NoError(t, err)
}

func TestDeleteTaskList_ConditionFailure(t *testing.T) {
store, db := setupNoSQLStoreMocks(t)
db.EXPECT().DeleteTaskList(gomock.Any(), getDecisionTaskListFilter(), int64(0)).Return(
&nosqlplugin.TaskOperationConditionFailure{Details: "test-details"},
)

err := store.DeleteTaskList(context.Background(), getValidDeleteTaskListRequest())

var expectedErr *persistence.ConditionFailedError
assert.ErrorAs(t, err, &expectedErr)
assert.ErrorContains(t, err, "Failed to delete task list. name: test-tasklist, type: 0, rangeID: 0, columns: (test-details)")
}

func TestGetTasks(t *testing.T) {
store, db := setupNoSQLStoreMocks(t)
now := time.Unix(123, 456)
Expand Down Expand Up @@ -403,14 +424,6 @@ func getDecisionTaskListFilter() *nosqlplugin.TaskListFilter {
}
}

func getExpectedTaskListFilter() *nosqlplugin.TaskListFilter {
return &nosqlplugin.TaskListFilter{
DomainID: TestDomainID,
TaskListName: TestTaskListName,
TaskListType: int(types.TaskListTypeDecision),
}
}

func getExpectedTaskListRow() *nosqlplugin.TaskListRow {
return &nosqlplugin.TaskListRow{
DomainID: TestDomainID,
Expand Down Expand Up @@ -443,3 +456,13 @@ func getExpectedTaskListInfo() *persistence.TaskListInfo {
LastUpdated: time.Now(),
}
}

func getValidDeleteTaskListRequest() *persistence.DeleteTaskListRequest {
return &persistence.DeleteTaskListRequest{
DomainID: TestDomainID,
DomainName: TestDomainName,
TaskListName: TestTaskListName,
TaskListType: int(types.TaskListTypeDecision),
RangeID: 0,
}
}
Loading