Skip to content

Commit

Permalink
fix lock ut case
Browse files Browse the repository at this point in the history
  • Loading branch information
wenxuwan committed Dec 11, 2023
1 parent 414a9e7 commit c1c3fb7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pkg/grpc/default_api/api_lock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func TestTryLock(t *testing.T) {

t.Run("normal", func(t *testing.T) {
mockLockStore := mock_lock.NewMockLockStore(gomock.NewController(t))
mockLockStore.EXPECT().TryLock(gomock.Any()).DoAndReturn(func(req *lock.TryLockRequest) (*lock.TryLockResponse, error) {
mockLockStore.EXPECT().TryLock(context.TODO(), gomock.Any()).DoAndReturn(func(ctx context.Context, req *lock.TryLockRequest) (*lock.TryLockResponse, error) {
assert.Equal(t, "lock|||resource", req.ResourceId)
assert.Equal(t, "owner", req.LockOwner)
assert.Equal(t, int32(1), req.Expire)
Expand Down Expand Up @@ -195,7 +195,7 @@ func TestUnlock(t *testing.T) {

t.Run("normal", func(t *testing.T) {
mockLockStore := mock_lock.NewMockLockStore(gomock.NewController(t))
mockLockStore.EXPECT().Unlock(gomock.Any()).DoAndReturn(func(req *lock.UnlockRequest) (*lock.UnlockResponse, error) {
mockLockStore.EXPECT().Unlock(context.TODO(), gomock.Any()).DoAndReturn(func(ctx context.Context, req *lock.UnlockRequest) (*lock.UnlockResponse, error) {
assert.Equal(t, "lock|||resource", req.ResourceId)
assert.Equal(t, "owner", req.LockOwner)
return &lock.UnlockResponse{
Expand Down
13 changes: 6 additions & 7 deletions pkg/mock/components/lock/lock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c1c3fb7

Please sign in to comment.