Skip to content

Commit

Permalink
test: add unit test for /arana/pkg/sequence/... package
Browse files Browse the repository at this point in the history
  • Loading branch information
Mulavar committed Sep 16, 2023
1 parent 4ebc401 commit 58cf3ba
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 136 deletions.
2 changes: 1 addition & 1 deletion pkg/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

//go:generate mockgen -destination=../../testdata/mock_rt_runtime.go -package=testdata . Runtime
//go:generate mockgen -destination=./mock_runtime.go -package=runtime . Runtime
package runtime

import (
Expand Down
2 changes: 1 addition & 1 deletion pkg/sequence/group/group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func Test_groupSequence_Acquire(t *testing.T) {
mockTx.EXPECT().Rollback(gomock.Any()).Return(mockRes, uint16(0), nil).AnyTimes()

// build mock runtime
mockRt := testdata.NewMockRuntime(ctrl)
mockRt := runtime.NewMockRuntime(ctrl)

Check failure on line 80 in pkg/sequence/group/group_test.go

View workflow job for this annotation

GitHub Actions / runner / golangci-lint

[golangci] reported by reviewdog 🐶 undefined: runtime.NewMockRuntime (typecheck) Raw Output: pkg/sequence/group/group_test.go:80:20: undefined: runtime.NewMockRuntime (typecheck) /*

Check failure on line 80 in pkg/sequence/group/group_test.go

View workflow job for this annotation

GitHub Actions / ubuntu-latest - Go 1.20

undefined: runtime.NewMockRuntime
mockRt.EXPECT().Begin(gomock.Any()).Return(mockTx, nil).AnyTimes()

runtime.Register(tenant, schema, mockRt)
Expand Down
3 changes: 2 additions & 1 deletion pkg/sequence/snowflake/snowflake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (

import (
"github.com/arana-db/arana/pkg/proto"
"github.com/arana-db/arana/pkg/runtime"
"github.com/arana-db/arana/testdata"
)

Expand Down Expand Up @@ -68,7 +69,7 @@ func Test_snowflakeSequence_Acquire(t *testing.T) {
mockTx.EXPECT().Rollback(gomock.Any()).Return(mockRes, uint16(0), nil).AnyTimes()

// build mock runtime
mockRt := testdata.NewMockRuntime(ctrl)
mockRt := runtime.NewMockRuntime(ctrl)

Check failure on line 72 in pkg/sequence/snowflake/snowflake_test.go

View workflow job for this annotation

GitHub Actions / runner / golangci-lint

[golangci] reported by reviewdog 🐶 undefined: runtime.NewMockRuntime (typecheck) Raw Output: pkg/sequence/snowflake/snowflake_test.go:72:20: undefined: runtime.NewMockRuntime (typecheck) /*

Check failure on line 72 in pkg/sequence/snowflake/snowflake_test.go

View workflow job for this annotation

GitHub Actions / ubuntu-latest - Go 1.20

undefined: runtime.NewMockRuntime
mockRt.EXPECT().Begin(gomock.Any()).Return(mockTx, nil).AnyTimes()

ctx := context.WithValue(context.Background(), proto.RuntimeCtxKey{}, mockRt)
Expand Down
133 changes: 0 additions & 133 deletions testdata/mock_rt_runtime.go

This file was deleted.

0 comments on commit 58cf3ba

Please sign in to comment.