-
Notifications
You must be signed in to change notification settings - Fork 542
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add a unit test for consumer and remove implicit init (#859)
* feat: add a unit test for consumer and remove implicit init * fix: add implict init function to compatible integration tests * chore: add other cosumer unit test and refacotor some code * fix: remove intergration instead of unit test * fix: add EOL for file * chore: use sub test to run table test * chore: test desc * chore: test desc Co-authored-by: Wen Ming <moonbingbing@gmail.com>
- Loading branch information
1 parent
b157cc2
commit f938c0c
Showing
7 changed files
with
483 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package store | ||
|
||
import ( | ||
"context" | ||
"github.com/stretchr/testify/mock" | ||
) | ||
|
||
type MockInterface struct { | ||
mock.Mock | ||
} | ||
|
||
func (m *MockInterface) Get(key string) (interface{}, error) { | ||
ret := m.Mock.Called(key) | ||
return ret.Get(0), ret.Error(1) | ||
} | ||
|
||
func (m *MockInterface) List(input ListInput) (*ListOutput, error) { | ||
ret := m.Called(input) | ||
|
||
var ( | ||
r0 *ListOutput | ||
r1 error | ||
) | ||
|
||
if rf, ok := ret.Get(0).(func(ListInput) *ListOutput); ok { | ||
r0 = rf(input) | ||
} else { | ||
r0 = ret.Get(0).(*ListOutput) | ||
} | ||
r1 = ret.Error(1) | ||
|
||
return r0, r1 | ||
} | ||
|
||
func (m *MockInterface) Create(ctx context.Context, obj interface{}) error { | ||
ret := m.Mock.Called(ctx, obj) | ||
return ret.Error(0) | ||
} | ||
|
||
func (m *MockInterface) Update(ctx context.Context, obj interface{}, createOnFail bool) error { | ||
ret := m.Mock.Called(ctx, obj, createOnFail) | ||
return ret.Error(0) | ||
} | ||
|
||
func (m *MockInterface) BatchDelete(ctx context.Context, keys []string) error { | ||
ret := m.Mock.Called(ctx, keys) | ||
return ret.Error(0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.