diff --git a/.licenserc.yaml b/.licenserc.yaml index c6e68ae7..59a3ee69 100644 --- a/.licenserc.yaml +++ b/.licenserc.yaml @@ -82,6 +82,7 @@ header: # `header` section is configurations for source codes license header. - 'pkg/resolver/mysql/encoding.go' - 'pkg/resolver/mysql/sql_error.go' - 'pkg/resolver/mysql/type.go' + - 'pkg/runtime/mock_runtime.go' - 'VERSION' - ".errcheck-exclude" - ".golangci.yml" diff --git a/testdata/mock_rt_runtime.go b/pkg/runtime/mock_runtime.go similarity index 95% rename from testdata/mock_rt_runtime.go rename to pkg/runtime/mock_runtime.go index 05ee557d..aa87ea3c 100644 --- a/testdata/mock_rt_runtime.go +++ b/pkg/runtime/mock_runtime.go @@ -1,8 +1,8 @@ // Code generated by MockGen. DO NOT EDIT. // Source: github.com/arana-db/arana/pkg/runtime (interfaces: Runtime) -// Package testdata is a generated GoMock package. -package testdata +// Package runtime is a generated GoMock package. +package runtime import ( context "context" @@ -15,7 +15,6 @@ import ( import ( proto "github.com/arana-db/arana/pkg/proto" - runtime "github.com/arana-db/arana/pkg/runtime" namespace "github.com/arana-db/arana/pkg/runtime/namespace" ) @@ -43,7 +42,7 @@ func (m *MockRuntime) EXPECT() *MockRuntimeMockRecorder { } // Begin mocks base method. -func (m *MockRuntime) Begin(arg0 context.Context, arg1 ...runtime.TxHook) (proto.Tx, error) { +func (m *MockRuntime) Begin(arg0 context.Context, arg1 ...TxHook) (proto.Tx, error) { m.ctrl.T.Helper() varargs := []interface{}{arg0} for _, a := range arg1 { diff --git a/pkg/runtime/runtime.go b/pkg/runtime/runtime.go index 6288cb97..e57b5e3d 100644 --- a/pkg/runtime/runtime.go +++ b/pkg/runtime/runtime.go @@ -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 ( diff --git a/pkg/sequence/group/group_test.go b/pkg/sequence/group/group_test.go index f8a22aea..dd6af719 100644 --- a/pkg/sequence/group/group_test.go +++ b/pkg/sequence/group/group_test.go @@ -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) mockRt.EXPECT().Begin(gomock.Any()).Return(mockTx, nil).AnyTimes() runtime.Register(tenant, schema, mockRt) diff --git a/pkg/sequence/snowflake/snowflake_test.go b/pkg/sequence/snowflake/snowflake_test.go index afba0639..96b15fe8 100644 --- a/pkg/sequence/snowflake/snowflake_test.go +++ b/pkg/sequence/snowflake/snowflake_test.go @@ -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" ) @@ -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) mockRt.EXPECT().Begin(gomock.Any()).Return(mockTx, nil).AnyTimes() ctx := context.WithValue(context.Background(), proto.RuntimeCtxKey{}, mockRt)