Skip to content

Commit

Permalink
Added test for GetOrphanTasks
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobht committed May 21, 2024
1 parent c0b0576 commit 73dbc94
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions common/persistence/nosql/nosql_task_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@
package nosql

import (
ctx "context"
"testing"

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"

"github.com/uber/cadence/common/log"
"github.com/uber/cadence/common/types"
)

func TestNewNoSQLStore(t *testing.T) {
Expand All @@ -38,3 +41,25 @@ func TestNewNoSQLStore(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, store)
}

func setupNoSQLStoreMocks(t *testing.T) *nosqlTaskStore {
ctrl := gomock.NewController(t)
shardedNosqlStoreMock := NewMockshardedNosqlStore(ctrl)

store := &nosqlTaskStore{
shardedNosqlStore: shardedNosqlStoreMock,
}

return store
}

func TestGetOrphanTasks(t *testing.T) {
store := setupNoSQLStoreMocks(t)

// We just expect the function to return an error so we don't need to check the result
_, err := store.GetOrphanTasks(ctx.Background(), nil)

var expectedErr *types.InternalServiceError
assert.ErrorAs(t, err, &expectedErr)
assert.ErrorContains(t, err, "Unimplemented call to GetOrphanTasks for NoSQL")
}

0 comments on commit 73dbc94

Please sign in to comment.