mirror of
https://github.com/ultravioletrs/cocos.git
synced 2026-06-22 20:00:18 +00:00
NOISSUE - Use Mockery config (#323)
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
This commit is contained in:
committed by
GitHub
parent
febdba4f96
commit
bceb1727d1
@@ -39,7 +39,7 @@ protoc:
|
||||
protoc -I. --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative agent/events/events.proto
|
||||
|
||||
mocks:
|
||||
go generate ./...
|
||||
mockery --config ./mockery.yml
|
||||
|
||||
install: $(SERVICES)
|
||||
install -d $(INSTALL_DIR)
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/stretchr/testify/mock"
|
||||
"github.com/ultravioletrs/cocos/agent"
|
||||
"github.com/ultravioletrs/cocos/agent/auth"
|
||||
"github.com/ultravioletrs/cocos/agent/mocks"
|
||||
"github.com/ultravioletrs/cocos/agent/auth/mocks"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
@@ -36,7 +36,6 @@ var (
|
||||
ErrSignatureVerificationFailed = errors.New("signature verification failed")
|
||||
)
|
||||
|
||||
//go:generate mockery --name Authenticator --output=../mocks --filename auth.go --quiet --note "Copyright (c) Ultraviolet \n // SPDX-License-Identifier: Apache-2.0"
|
||||
type Authenticator interface {
|
||||
AuthenticateUser(ctx context.Context, role UserRole) (context.Context, error)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
// Copyright (c) Ultraviolet
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
@@ -18,6 +18,14 @@ type Authenticator struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type Authenticator_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *Authenticator) EXPECT() *Authenticator_Expecter {
|
||||
return &Authenticator_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// AuthenticateUser provides a mock function with given fields: ctx, role
|
||||
func (_m *Authenticator) AuthenticateUser(ctx context.Context, role auth.UserRole) (context.Context, error) {
|
||||
ret := _m.Called(ctx, role)
|
||||
@@ -48,6 +56,35 @@ func (_m *Authenticator) AuthenticateUser(ctx context.Context, role auth.UserRol
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// Authenticator_AuthenticateUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AuthenticateUser'
|
||||
type Authenticator_AuthenticateUser_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// AuthenticateUser is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - role auth.UserRole
|
||||
func (_e *Authenticator_Expecter) AuthenticateUser(ctx interface{}, role interface{}) *Authenticator_AuthenticateUser_Call {
|
||||
return &Authenticator_AuthenticateUser_Call{Call: _e.mock.On("AuthenticateUser", ctx, role)}
|
||||
}
|
||||
|
||||
func (_c *Authenticator_AuthenticateUser_Call) Run(run func(ctx context.Context, role auth.UserRole)) *Authenticator_AuthenticateUser_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(auth.UserRole))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Authenticator_AuthenticateUser_Call) Return(_a0 context.Context, _a1 error) *Authenticator_AuthenticateUser_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Authenticator_AuthenticateUser_Call) RunAndReturn(run func(context.Context, auth.UserRole) (context.Context, error)) *Authenticator_AuthenticateUser_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewAuthenticator creates a new instance of Authenticator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewAuthenticator(t interface {
|
||||
@@ -86,6 +86,3 @@ func DecompressFromContext(ctx context.Context) bool {
|
||||
func DecompressToContext(ctx context.Context, decompress bool) context.Context {
|
||||
return metadata.AppendToOutgoingContext(ctx, DecompressKey, fmt.Sprintf("%t", decompress))
|
||||
}
|
||||
|
||||
//go:generate mockery --name=AgentService_AlgoClient --output=mocks --filename agent_grpc_algo.go --quiet --note "Copyright (c) Ultraviolet \n // SPDX-License-Identifier: Apache-2.0"
|
||||
//go:generate mockery --name=AgentService_DataClient --output=mocks --filename agent_grpc_data.go --quiet --note "Copyright (c) Ultraviolet \n // SPDX-License-Identifier: Apache-2.0"
|
||||
|
||||
@@ -16,7 +16,6 @@ type service struct {
|
||||
conn io.Writer
|
||||
}
|
||||
|
||||
//go:generate mockery --name Service --output=./mocks --filename events.go --quiet --note "Copyright (c) Ultraviolet \n // SPDX-License-Identifier: Apache-2.0"
|
||||
type Service interface {
|
||||
SendEvent(event, status string, details json.RawMessage) error
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
// Copyright (c) Ultraviolet
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
@@ -16,6 +16,14 @@ type Service struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type Service_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *Service) EXPECT() *Service_Expecter {
|
||||
return &Service_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// SendEvent provides a mock function with given fields: event, status, details
|
||||
func (_m *Service) SendEvent(event string, status string, details json.RawMessage) error {
|
||||
ret := _m.Called(event, status, details)
|
||||
@@ -34,6 +42,36 @@ func (_m *Service) SendEvent(event string, status string, details json.RawMessag
|
||||
return r0
|
||||
}
|
||||
|
||||
// Service_SendEvent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendEvent'
|
||||
type Service_SendEvent_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// SendEvent is a helper method to define mock.On call
|
||||
// - event string
|
||||
// - status string
|
||||
// - details json.RawMessage
|
||||
func (_e *Service_Expecter) SendEvent(event interface{}, status interface{}, details interface{}) *Service_SendEvent_Call {
|
||||
return &Service_SendEvent_Call{Call: _e.mock.On("SendEvent", event, status, details)}
|
||||
}
|
||||
|
||||
func (_c *Service_SendEvent_Call) Run(run func(event string, status string, details json.RawMessage)) *Service_SendEvent_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string), args[1].(string), args[2].(json.RawMessage))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_SendEvent_Call) Return(_a0 error) *Service_SendEvent_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_SendEvent_Call) RunAndReturn(run func(string, string, json.RawMessage) error) *Service_SendEvent_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewService creates a new instance of Service. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewService(t interface {
|
||||
|
||||
+125
-2
@@ -1,8 +1,8 @@
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
// Copyright (c) Ultraviolet
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
@@ -18,6 +18,14 @@ type Service struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type Service_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *Service) EXPECT() *Service_Expecter {
|
||||
return &Service_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// Algo provides a mock function with given fields: ctx, algorithm
|
||||
func (_m *Service) Algo(ctx context.Context, algorithm agent.Algorithm) error {
|
||||
ret := _m.Called(ctx, algorithm)
|
||||
@@ -36,6 +44,35 @@ func (_m *Service) Algo(ctx context.Context, algorithm agent.Algorithm) error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// Service_Algo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Algo'
|
||||
type Service_Algo_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Algo is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - algorithm agent.Algorithm
|
||||
func (_e *Service_Expecter) Algo(ctx interface{}, algorithm interface{}) *Service_Algo_Call {
|
||||
return &Service_Algo_Call{Call: _e.mock.On("Algo", ctx, algorithm)}
|
||||
}
|
||||
|
||||
func (_c *Service_Algo_Call) Run(run func(ctx context.Context, algorithm agent.Algorithm)) *Service_Algo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(agent.Algorithm))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_Algo_Call) Return(_a0 error) *Service_Algo_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_Algo_Call) RunAndReturn(run func(context.Context, agent.Algorithm) error) *Service_Algo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Attestation provides a mock function with given fields: ctx, reportData
|
||||
func (_m *Service) Attestation(ctx context.Context, reportData [64]byte) ([]byte, error) {
|
||||
ret := _m.Called(ctx, reportData)
|
||||
@@ -66,6 +103,35 @@ func (_m *Service) Attestation(ctx context.Context, reportData [64]byte) ([]byte
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// Service_Attestation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Attestation'
|
||||
type Service_Attestation_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Attestation is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - reportData [64]byte
|
||||
func (_e *Service_Expecter) Attestation(ctx interface{}, reportData interface{}) *Service_Attestation_Call {
|
||||
return &Service_Attestation_Call{Call: _e.mock.On("Attestation", ctx, reportData)}
|
||||
}
|
||||
|
||||
func (_c *Service_Attestation_Call) Run(run func(ctx context.Context, reportData [64]byte)) *Service_Attestation_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].([64]byte))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_Attestation_Call) Return(_a0 []byte, _a1 error) *Service_Attestation_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_Attestation_Call) RunAndReturn(run func(context.Context, [64]byte) ([]byte, error)) *Service_Attestation_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Data provides a mock function with given fields: ctx, dataset
|
||||
func (_m *Service) Data(ctx context.Context, dataset agent.Dataset) error {
|
||||
ret := _m.Called(ctx, dataset)
|
||||
@@ -84,6 +150,35 @@ func (_m *Service) Data(ctx context.Context, dataset agent.Dataset) error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// Service_Data_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Data'
|
||||
type Service_Data_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Data is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - dataset agent.Dataset
|
||||
func (_e *Service_Expecter) Data(ctx interface{}, dataset interface{}) *Service_Data_Call {
|
||||
return &Service_Data_Call{Call: _e.mock.On("Data", ctx, dataset)}
|
||||
}
|
||||
|
||||
func (_c *Service_Data_Call) Run(run func(ctx context.Context, dataset agent.Dataset)) *Service_Data_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(agent.Dataset))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_Data_Call) Return(_a0 error) *Service_Data_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_Data_Call) RunAndReturn(run func(context.Context, agent.Dataset) error) *Service_Data_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Result provides a mock function with given fields: ctx
|
||||
func (_m *Service) Result(ctx context.Context) ([]byte, error) {
|
||||
ret := _m.Called(ctx)
|
||||
@@ -114,6 +209,34 @@ func (_m *Service) Result(ctx context.Context) ([]byte, error) {
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// Service_Result_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Result'
|
||||
type Service_Result_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Result is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
func (_e *Service_Expecter) Result(ctx interface{}) *Service_Result_Call {
|
||||
return &Service_Result_Call{Call: _e.mock.On("Result", ctx)}
|
||||
}
|
||||
|
||||
func (_c *Service_Result_Call) Run(run func(ctx context.Context)) *Service_Result_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_Result_Call) Return(_a0 []byte, _a1 error) *Service_Result_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_Result_Call) RunAndReturn(run func(context.Context) ([]byte, error)) *Service_Result_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewService creates a new instance of Service. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewService(t interface {
|
||||
|
||||
@@ -103,8 +103,6 @@ var (
|
||||
|
||||
// Service specifies an API that must be fullfiled by the domain service
|
||||
// implementation, and all of its decorators (e.g. logging & metrics).
|
||||
//
|
||||
//go:generate mockery --name Service --output=mocks --filename agent.go --quiet --note "Copyright (c) Ultraviolet \n // SPDX-License-Identifier: Apache-2.0"
|
||||
type Service interface {
|
||||
Algo(ctx context.Context, algorithm Algorithm) error
|
||||
Data(ctx context.Context, dataset Dataset) error
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
// Copyright (c) Ultraviolet
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
@@ -17,11 +17,47 @@ type StateMachine struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type StateMachine_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *StateMachine) EXPECT() *StateMachine_Expecter {
|
||||
return &StateMachine_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// AddTransition provides a mock function with given fields: t
|
||||
func (_m *StateMachine) AddTransition(t statemachine.Transition) {
|
||||
_m.Called(t)
|
||||
}
|
||||
|
||||
// StateMachine_AddTransition_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddTransition'
|
||||
type StateMachine_AddTransition_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// AddTransition is a helper method to define mock.On call
|
||||
// - t statemachine.Transition
|
||||
func (_e *StateMachine_Expecter) AddTransition(t interface{}) *StateMachine_AddTransition_Call {
|
||||
return &StateMachine_AddTransition_Call{Call: _e.mock.On("AddTransition", t)}
|
||||
}
|
||||
|
||||
func (_c *StateMachine_AddTransition_Call) Run(run func(t statemachine.Transition)) *StateMachine_AddTransition_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(statemachine.Transition))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *StateMachine_AddTransition_Call) Return() *StateMachine_AddTransition_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *StateMachine_AddTransition_Call) RunAndReturn(run func(statemachine.Transition)) *StateMachine_AddTransition_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetState provides a mock function with given fields:
|
||||
func (_m *StateMachine) GetState() statemachine.State {
|
||||
ret := _m.Called()
|
||||
@@ -42,16 +78,100 @@ func (_m *StateMachine) GetState() statemachine.State {
|
||||
return r0
|
||||
}
|
||||
|
||||
// StateMachine_GetState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetState'
|
||||
type StateMachine_GetState_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetState is a helper method to define mock.On call
|
||||
func (_e *StateMachine_Expecter) GetState() *StateMachine_GetState_Call {
|
||||
return &StateMachine_GetState_Call{Call: _e.mock.On("GetState")}
|
||||
}
|
||||
|
||||
func (_c *StateMachine_GetState_Call) Run(run func()) *StateMachine_GetState_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *StateMachine_GetState_Call) Return(_a0 statemachine.State) *StateMachine_GetState_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *StateMachine_GetState_Call) RunAndReturn(run func() statemachine.State) *StateMachine_GetState_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SendEvent provides a mock function with given fields: event
|
||||
func (_m *StateMachine) SendEvent(event statemachine.Event) {
|
||||
_m.Called(event)
|
||||
}
|
||||
|
||||
// StateMachine_SendEvent_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendEvent'
|
||||
type StateMachine_SendEvent_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// SendEvent is a helper method to define mock.On call
|
||||
// - event statemachine.Event
|
||||
func (_e *StateMachine_Expecter) SendEvent(event interface{}) *StateMachine_SendEvent_Call {
|
||||
return &StateMachine_SendEvent_Call{Call: _e.mock.On("SendEvent", event)}
|
||||
}
|
||||
|
||||
func (_c *StateMachine_SendEvent_Call) Run(run func(event statemachine.Event)) *StateMachine_SendEvent_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(statemachine.Event))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *StateMachine_SendEvent_Call) Return() *StateMachine_SendEvent_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *StateMachine_SendEvent_Call) RunAndReturn(run func(statemachine.Event)) *StateMachine_SendEvent_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetAction provides a mock function with given fields: state, action
|
||||
func (_m *StateMachine) SetAction(state statemachine.State, action statemachine.Action) {
|
||||
_m.Called(state, action)
|
||||
}
|
||||
|
||||
// StateMachine_SetAction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetAction'
|
||||
type StateMachine_SetAction_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// SetAction is a helper method to define mock.On call
|
||||
// - state statemachine.State
|
||||
// - action statemachine.Action
|
||||
func (_e *StateMachine_Expecter) SetAction(state interface{}, action interface{}) *StateMachine_SetAction_Call {
|
||||
return &StateMachine_SetAction_Call{Call: _e.mock.On("SetAction", state, action)}
|
||||
}
|
||||
|
||||
func (_c *StateMachine_SetAction_Call) Run(run func(state statemachine.State, action statemachine.Action)) *StateMachine_SetAction_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(statemachine.State), args[1].(statemachine.Action))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *StateMachine_SetAction_Call) Return() *StateMachine_SetAction_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *StateMachine_SetAction_Call) RunAndReturn(run func(statemachine.State, statemachine.Action)) *StateMachine_SetAction_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Start provides a mock function with given fields: ctx
|
||||
func (_m *StateMachine) Start(ctx context.Context) error {
|
||||
ret := _m.Called(ctx)
|
||||
@@ -70,6 +190,34 @@ func (_m *StateMachine) Start(ctx context.Context) error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// StateMachine_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
|
||||
type StateMachine_Start_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Start is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
func (_e *StateMachine_Expecter) Start(ctx interface{}) *StateMachine_Start_Call {
|
||||
return &StateMachine_Start_Call{Call: _e.mock.On("Start", ctx)}
|
||||
}
|
||||
|
||||
func (_c *StateMachine_Start_Call) Run(run func(ctx context.Context)) *StateMachine_Start_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *StateMachine_Start_Call) Return(_a0 error) *StateMachine_Start_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *StateMachine_Start_Call) RunAndReturn(run func(context.Context) error) *StateMachine_Start_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewStateMachine creates a new instance of StateMachine. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewStateMachine(t interface {
|
||||
|
||||
@@ -24,7 +24,6 @@ type Transition struct {
|
||||
To State
|
||||
}
|
||||
|
||||
//go:generate mockery --name StateMachine --output=mocks --filename state.go --quiet --note "Copyright (c) Ultraviolet \n // SPDX-License-Identifier: Apache-2.0"
|
||||
type StateMachine interface {
|
||||
AddTransition(t Transition)
|
||||
SetAction(state State, action Action)
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
// Copyright (c) Ultraviolet
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
@@ -20,8 +20,6 @@ type handler struct {
|
||||
cmpID string
|
||||
}
|
||||
|
||||
//go:generate mockery --name io.Writer --output ./mocks --filename io_writer.go
|
||||
|
||||
func NewProtoHandler(conn io.Writer, opts *slog.HandlerOptions, cmpID string) slog.Handler {
|
||||
if opts == nil {
|
||||
opts = &slog.HandlerOptions{}
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
authmocks "github.com/ultravioletrs/cocos/agent/mocks"
|
||||
authmocks "github.com/ultravioletrs/cocos/agent/auth/mocks"
|
||||
"github.com/ultravioletrs/cocos/internal/server"
|
||||
"github.com/ultravioletrs/cocos/pkg/attestation/quoteprovider/mocks"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) Ultraviolet
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
@@ -9,6 +12,14 @@ type Server struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type Server_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *Server) EXPECT() *Server_Expecter {
|
||||
return &Server_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// Start provides a mock function with given fields:
|
||||
func (_m *Server) Start() error {
|
||||
ret := _m.Called()
|
||||
@@ -27,6 +38,33 @@ func (_m *Server) Start() error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// Server_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
|
||||
type Server_Start_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Start is a helper method to define mock.On call
|
||||
func (_e *Server_Expecter) Start() *Server_Start_Call {
|
||||
return &Server_Start_Call{Call: _e.mock.On("Start")}
|
||||
}
|
||||
|
||||
func (_c *Server_Start_Call) Run(run func()) *Server_Start_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Server_Start_Call) Return(_a0 error) *Server_Start_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Server_Start_Call) RunAndReturn(run func() error) *Server_Start_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Stop provides a mock function with given fields:
|
||||
func (_m *Server) Stop() error {
|
||||
ret := _m.Called()
|
||||
@@ -45,6 +83,33 @@ func (_m *Server) Stop() error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// Server_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
|
||||
type Server_Stop_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Stop is a helper method to define mock.On call
|
||||
func (_e *Server_Expecter) Stop() *Server_Stop_Call {
|
||||
return &Server_Stop_Call{Call: _e.mock.On("Stop")}
|
||||
}
|
||||
|
||||
func (_c *Server_Stop_Call) Run(run func()) *Server_Stop_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Server_Stop_Call) Return(_a0 error) *Server_Stop_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Server_Stop_Call) RunAndReturn(run func() error) *Server_Stop_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewServer creates a new instance of Server. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewServer(t interface {
|
||||
|
||||
@@ -11,7 +11,6 @@ import (
|
||||
"syscall"
|
||||
)
|
||||
|
||||
//go:generate mockery --name Server --output ./mocks --filename server.go
|
||||
type Server interface {
|
||||
Start() error
|
||||
Stop() error
|
||||
|
||||
+153
-2
@@ -1,8 +1,8 @@
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
// Copyright (c) Ultraviolet
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
@@ -17,6 +17,14 @@ type Service struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type Service_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *Service) EXPECT() *Service_Expecter {
|
||||
return &Service_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// FetchAttestationPolicy provides a mock function with given fields: ctx, computationID
|
||||
func (_m *Service) FetchAttestationPolicy(ctx context.Context, computationID string) ([]byte, error) {
|
||||
ret := _m.Called(ctx, computationID)
|
||||
@@ -47,11 +55,68 @@ func (_m *Service) FetchAttestationPolicy(ctx context.Context, computationID str
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// Service_FetchAttestationPolicy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FetchAttestationPolicy'
|
||||
type Service_FetchAttestationPolicy_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// FetchAttestationPolicy is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - computationID string
|
||||
func (_e *Service_Expecter) FetchAttestationPolicy(ctx interface{}, computationID interface{}) *Service_FetchAttestationPolicy_Call {
|
||||
return &Service_FetchAttestationPolicy_Call{Call: _e.mock.On("FetchAttestationPolicy", ctx, computationID)}
|
||||
}
|
||||
|
||||
func (_c *Service_FetchAttestationPolicy_Call) Run(run func(ctx context.Context, computationID string)) *Service_FetchAttestationPolicy_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_FetchAttestationPolicy_Call) Return(_a0 []byte, _a1 error) *Service_FetchAttestationPolicy_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_FetchAttestationPolicy_Call) RunAndReturn(run func(context.Context, string) ([]byte, error)) *Service_FetchAttestationPolicy_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// ReportBrokenConnection provides a mock function with given fields: addr
|
||||
func (_m *Service) ReportBrokenConnection(addr string) {
|
||||
_m.Called(addr)
|
||||
}
|
||||
|
||||
// Service_ReportBrokenConnection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReportBrokenConnection'
|
||||
type Service_ReportBrokenConnection_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// ReportBrokenConnection is a helper method to define mock.On call
|
||||
// - addr string
|
||||
func (_e *Service_Expecter) ReportBrokenConnection(addr interface{}) *Service_ReportBrokenConnection_Call {
|
||||
return &Service_ReportBrokenConnection_Call{Call: _e.mock.On("ReportBrokenConnection", addr)}
|
||||
}
|
||||
|
||||
func (_c *Service_ReportBrokenConnection_Call) Run(run func(addr string)) *Service_ReportBrokenConnection_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_ReportBrokenConnection_Call) Return() *Service_ReportBrokenConnection_Call {
|
||||
_c.Call.Return()
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_ReportBrokenConnection_Call) RunAndReturn(run func(string)) *Service_ReportBrokenConnection_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// ReturnSVMInfo provides a mock function with given fields: ctx
|
||||
func (_m *Service) ReturnSVMInfo(ctx context.Context) (string, int, string, string) {
|
||||
ret := _m.Called(ctx)
|
||||
@@ -94,6 +159,34 @@ func (_m *Service) ReturnSVMInfo(ctx context.Context) (string, int, string, stri
|
||||
return r0, r1, r2, r3
|
||||
}
|
||||
|
||||
// Service_ReturnSVMInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReturnSVMInfo'
|
||||
type Service_ReturnSVMInfo_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// ReturnSVMInfo is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
func (_e *Service_Expecter) ReturnSVMInfo(ctx interface{}) *Service_ReturnSVMInfo_Call {
|
||||
return &Service_ReturnSVMInfo_Call{Call: _e.mock.On("ReturnSVMInfo", ctx)}
|
||||
}
|
||||
|
||||
func (_c *Service_ReturnSVMInfo_Call) Run(run func(ctx context.Context)) *Service_ReturnSVMInfo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_ReturnSVMInfo_Call) Return(_a0 string, _a1 int, _a2 string, _a3 string) *Service_ReturnSVMInfo_Call {
|
||||
_c.Call.Return(_a0, _a1, _a2, _a3)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_ReturnSVMInfo_Call) RunAndReturn(run func(context.Context) (string, int, string, string)) *Service_ReturnSVMInfo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Run provides a mock function with given fields: ctx, c
|
||||
func (_m *Service) Run(ctx context.Context, c *manager.ComputationRunReq) (string, error) {
|
||||
ret := _m.Called(ctx, c)
|
||||
@@ -122,6 +215,35 @@ func (_m *Service) Run(ctx context.Context, c *manager.ComputationRunReq) (strin
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// Service_Run_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Run'
|
||||
type Service_Run_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Run is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - c *manager.ComputationRunReq
|
||||
func (_e *Service_Expecter) Run(ctx interface{}, c interface{}) *Service_Run_Call {
|
||||
return &Service_Run_Call{Call: _e.mock.On("Run", ctx, c)}
|
||||
}
|
||||
|
||||
func (_c *Service_Run_Call) Run(run func(ctx context.Context, c *manager.ComputationRunReq)) *Service_Run_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(*manager.ComputationRunReq))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_Run_Call) Return(_a0 string, _a1 error) *Service_Run_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_Run_Call) RunAndReturn(run func(context.Context, *manager.ComputationRunReq) (string, error)) *Service_Run_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Stop provides a mock function with given fields: ctx, computationID
|
||||
func (_m *Service) Stop(ctx context.Context, computationID string) error {
|
||||
ret := _m.Called(ctx, computationID)
|
||||
@@ -140,6 +262,35 @@ func (_m *Service) Stop(ctx context.Context, computationID string) error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// Service_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
|
||||
type Service_Stop_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Stop is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - computationID string
|
||||
func (_e *Service_Expecter) Stop(ctx interface{}, computationID interface{}) *Service_Stop_Call {
|
||||
return &Service_Stop_Call{Call: _e.mock.On("Stop", ctx, computationID)}
|
||||
}
|
||||
|
||||
func (_c *Service_Stop_Call) Run(run func(ctx context.Context, computationID string)) *Service_Stop_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_Stop_Call) Return(_a0 error) *Service_Stop_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Service_Stop_Call) RunAndReturn(run func(context.Context, string) error) *Service_Stop_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewService creates a new instance of Service. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewService(t interface {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
// Copyright (c) Ultraviolet
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
@@ -15,6 +15,14 @@ type Persistence struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type Persistence_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *Persistence) EXPECT() *Persistence_Expecter {
|
||||
return &Persistence_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// DeleteVM provides a mock function with given fields: id
|
||||
func (_m *Persistence) DeleteVM(id string) error {
|
||||
ret := _m.Called(id)
|
||||
@@ -33,6 +41,34 @@ func (_m *Persistence) DeleteVM(id string) error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// Persistence_DeleteVM_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteVM'
|
||||
type Persistence_DeleteVM_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// DeleteVM is a helper method to define mock.On call
|
||||
// - id string
|
||||
func (_e *Persistence_Expecter) DeleteVM(id interface{}) *Persistence_DeleteVM_Call {
|
||||
return &Persistence_DeleteVM_Call{Call: _e.mock.On("DeleteVM", id)}
|
||||
}
|
||||
|
||||
func (_c *Persistence_DeleteVM_Call) Run(run func(id string)) *Persistence_DeleteVM_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Persistence_DeleteVM_Call) Return(_a0 error) *Persistence_DeleteVM_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Persistence_DeleteVM_Call) RunAndReturn(run func(string) error) *Persistence_DeleteVM_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// LoadVMs provides a mock function with given fields:
|
||||
func (_m *Persistence) LoadVMs() ([]qemu.VMState, error) {
|
||||
ret := _m.Called()
|
||||
@@ -63,6 +99,33 @@ func (_m *Persistence) LoadVMs() ([]qemu.VMState, error) {
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// Persistence_LoadVMs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoadVMs'
|
||||
type Persistence_LoadVMs_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// LoadVMs is a helper method to define mock.On call
|
||||
func (_e *Persistence_Expecter) LoadVMs() *Persistence_LoadVMs_Call {
|
||||
return &Persistence_LoadVMs_Call{Call: _e.mock.On("LoadVMs")}
|
||||
}
|
||||
|
||||
func (_c *Persistence_LoadVMs_Call) Run(run func()) *Persistence_LoadVMs_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Persistence_LoadVMs_Call) Return(_a0 []qemu.VMState, _a1 error) *Persistence_LoadVMs_Call {
|
||||
_c.Call.Return(_a0, _a1)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Persistence_LoadVMs_Call) RunAndReturn(run func() ([]qemu.VMState, error)) *Persistence_LoadVMs_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SaveVM provides a mock function with given fields: state
|
||||
func (_m *Persistence) SaveVM(state qemu.VMState) error {
|
||||
ret := _m.Called(state)
|
||||
@@ -81,6 +144,34 @@ func (_m *Persistence) SaveVM(state qemu.VMState) error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// Persistence_SaveVM_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SaveVM'
|
||||
type Persistence_SaveVM_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// SaveVM is a helper method to define mock.On call
|
||||
// - state qemu.VMState
|
||||
func (_e *Persistence_Expecter) SaveVM(state interface{}) *Persistence_SaveVM_Call {
|
||||
return &Persistence_SaveVM_Call{Call: _e.mock.On("SaveVM", state)}
|
||||
}
|
||||
|
||||
func (_c *Persistence_SaveVM_Call) Run(run func(state qemu.VMState)) *Persistence_SaveVM_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(qemu.VMState))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Persistence_SaveVM_Call) Return(_a0 error) *Persistence_SaveVM_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Persistence_SaveVM_Call) RunAndReturn(run func(qemu.VMState) error) *Persistence_SaveVM_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewPersistence creates a new instance of Persistence. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewPersistence(t interface {
|
||||
|
||||
@@ -23,8 +23,6 @@ type FilePersistence struct {
|
||||
}
|
||||
|
||||
// Persistence is an interface for saving and loading VM states.
|
||||
//
|
||||
//go:generate mockery --name Persistence --output=./mocks --filename persistence.go --quiet --note "Copyright (c) Ultraviolet \n // SPDX-License-Identifier: Apache-2.0"
|
||||
type Persistence interface {
|
||||
SaveVM(state VMState) error
|
||||
LoadVMs() ([]VMState, error)
|
||||
|
||||
@@ -53,8 +53,6 @@ var (
|
||||
|
||||
// Service specifies an API that must be fulfilled by the domain service
|
||||
// implementation, and all of its decorators (e.g. logging & metrics).
|
||||
//
|
||||
//go:generate mockery --name Service --output=./mocks --filename service.go --quiet --note "Copyright (c) Ultraviolet \n // SPDX-License-Identifier: Apache-2.0"
|
||||
type Service interface {
|
||||
// Run create a computation.
|
||||
Run(ctx context.Context, c *ComputationRunReq) (string, error)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
// Copyright (c) Ultraviolet
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
@@ -15,6 +15,14 @@ type Provider struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type Provider_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *Provider) EXPECT() *Provider_Expecter {
|
||||
return &Provider_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// Execute provides a mock function with given fields: config, eventSender, computationId
|
||||
func (_m *Provider) Execute(config interface{}, eventSender vm.EventSender, computationId string) vm.VM {
|
||||
ret := _m.Called(config, eventSender, computationId)
|
||||
@@ -35,6 +43,36 @@ func (_m *Provider) Execute(config interface{}, eventSender vm.EventSender, comp
|
||||
return r0
|
||||
}
|
||||
|
||||
// Provider_Execute_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Execute'
|
||||
type Provider_Execute_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Execute is a helper method to define mock.On call
|
||||
// - config interface{}
|
||||
// - eventSender vm.EventSender
|
||||
// - computationId string
|
||||
func (_e *Provider_Expecter) Execute(config interface{}, eventSender interface{}, computationId interface{}) *Provider_Execute_Call {
|
||||
return &Provider_Execute_Call{Call: _e.mock.On("Execute", config, eventSender, computationId)}
|
||||
}
|
||||
|
||||
func (_c *Provider_Execute_Call) Run(run func(config interface{}, eventSender vm.EventSender, computationId string)) *Provider_Execute_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(interface{}), args[1].(vm.EventSender), args[2].(string))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Provider_Execute_Call) Return(_a0 vm.VM) *Provider_Execute_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *Provider_Execute_Call) RunAndReturn(run func(interface{}, vm.EventSender, string) vm.VM) *Provider_Execute_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewProvider creates a new instance of Provider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewProvider(t interface {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// Copyright (c) Ultraviolet
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
@@ -12,6 +15,14 @@ type StateMachine struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type StateMachine_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *StateMachine) EXPECT() *StateMachine_Expecter {
|
||||
return &StateMachine_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// State provides a mock function with given fields:
|
||||
func (_m *StateMachine) State() string {
|
||||
ret := _m.Called()
|
||||
@@ -30,6 +41,33 @@ func (_m *StateMachine) State() string {
|
||||
return r0
|
||||
}
|
||||
|
||||
// StateMachine_State_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'State'
|
||||
type StateMachine_State_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// State is a helper method to define mock.On call
|
||||
func (_e *StateMachine_Expecter) State() *StateMachine_State_Call {
|
||||
return &StateMachine_State_Call{Call: _e.mock.On("State")}
|
||||
}
|
||||
|
||||
func (_c *StateMachine_State_Call) Run(run func()) *StateMachine_State_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *StateMachine_State_Call) Return(_a0 string) *StateMachine_State_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *StateMachine_State_Call) RunAndReturn(run func() string) *StateMachine_State_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Transition provides a mock function with given fields: newState
|
||||
func (_m *StateMachine) Transition(newState manager.ManagerState) error {
|
||||
ret := _m.Called(newState)
|
||||
@@ -48,6 +86,34 @@ func (_m *StateMachine) Transition(newState manager.ManagerState) error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// StateMachine_Transition_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Transition'
|
||||
type StateMachine_Transition_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Transition is a helper method to define mock.On call
|
||||
// - newState manager.ManagerState
|
||||
func (_e *StateMachine_Expecter) Transition(newState interface{}) *StateMachine_Transition_Call {
|
||||
return &StateMachine_Transition_Call{Call: _e.mock.On("Transition", newState)}
|
||||
}
|
||||
|
||||
func (_c *StateMachine_Transition_Call) Run(run func(newState manager.ManagerState)) *StateMachine_Transition_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(manager.ManagerState))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *StateMachine_Transition_Call) Return(_a0 error) *StateMachine_Transition_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *StateMachine_Transition_Call) RunAndReturn(run func(manager.ManagerState) error) *StateMachine_Transition_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewStateMachine creates a new instance of StateMachine. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewStateMachine(t interface {
|
||||
|
||||
+256
-2
@@ -1,8 +1,8 @@
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
// Copyright (c) Ultraviolet
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
@@ -17,6 +17,14 @@ type VM struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type VM_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *VM) EXPECT() *VM_Expecter {
|
||||
return &VM_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// GetCID provides a mock function with given fields:
|
||||
func (_m *VM) GetCID() int {
|
||||
ret := _m.Called()
|
||||
@@ -35,6 +43,33 @@ func (_m *VM) GetCID() int {
|
||||
return r0
|
||||
}
|
||||
|
||||
// VM_GetCID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCID'
|
||||
type VM_GetCID_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetCID is a helper method to define mock.On call
|
||||
func (_e *VM_Expecter) GetCID() *VM_GetCID_Call {
|
||||
return &VM_GetCID_Call{Call: _e.mock.On("GetCID")}
|
||||
}
|
||||
|
||||
func (_c *VM_GetCID_Call) Run(run func()) *VM_GetCID_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_GetCID_Call) Return(_a0 int) *VM_GetCID_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_GetCID_Call) RunAndReturn(run func() int) *VM_GetCID_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetConfig provides a mock function with given fields:
|
||||
func (_m *VM) GetConfig() interface{} {
|
||||
ret := _m.Called()
|
||||
@@ -55,6 +90,33 @@ func (_m *VM) GetConfig() interface{} {
|
||||
return r0
|
||||
}
|
||||
|
||||
// VM_GetConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetConfig'
|
||||
type VM_GetConfig_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetConfig is a helper method to define mock.On call
|
||||
func (_e *VM_Expecter) GetConfig() *VM_GetConfig_Call {
|
||||
return &VM_GetConfig_Call{Call: _e.mock.On("GetConfig")}
|
||||
}
|
||||
|
||||
func (_c *VM_GetConfig_Call) Run(run func()) *VM_GetConfig_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_GetConfig_Call) Return(_a0 interface{}) *VM_GetConfig_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_GetConfig_Call) RunAndReturn(run func() interface{}) *VM_GetConfig_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// GetProcess provides a mock function with given fields:
|
||||
func (_m *VM) GetProcess() int {
|
||||
ret := _m.Called()
|
||||
@@ -73,6 +135,33 @@ func (_m *VM) GetProcess() int {
|
||||
return r0
|
||||
}
|
||||
|
||||
// VM_GetProcess_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProcess'
|
||||
type VM_GetProcess_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// GetProcess is a helper method to define mock.On call
|
||||
func (_e *VM_Expecter) GetProcess() *VM_GetProcess_Call {
|
||||
return &VM_GetProcess_Call{Call: _e.mock.On("GetProcess")}
|
||||
}
|
||||
|
||||
func (_c *VM_GetProcess_Call) Run(run func()) *VM_GetProcess_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_GetProcess_Call) Return(_a0 int) *VM_GetProcess_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_GetProcess_Call) RunAndReturn(run func() int) *VM_GetProcess_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SendAgentConfig provides a mock function with given fields: ac
|
||||
func (_m *VM) SendAgentConfig(ac agent.Computation) error {
|
||||
ret := _m.Called(ac)
|
||||
@@ -91,6 +180,34 @@ func (_m *VM) SendAgentConfig(ac agent.Computation) error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// VM_SendAgentConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendAgentConfig'
|
||||
type VM_SendAgentConfig_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// SendAgentConfig is a helper method to define mock.On call
|
||||
// - ac agent.Computation
|
||||
func (_e *VM_Expecter) SendAgentConfig(ac interface{}) *VM_SendAgentConfig_Call {
|
||||
return &VM_SendAgentConfig_Call{Call: _e.mock.On("SendAgentConfig", ac)}
|
||||
}
|
||||
|
||||
func (_c *VM_SendAgentConfig_Call) Run(run func(ac agent.Computation)) *VM_SendAgentConfig_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(agent.Computation))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_SendAgentConfig_Call) Return(_a0 error) *VM_SendAgentConfig_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_SendAgentConfig_Call) RunAndReturn(run func(agent.Computation) error) *VM_SendAgentConfig_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// SetProcess provides a mock function with given fields: pid
|
||||
func (_m *VM) SetProcess(pid int) error {
|
||||
ret := _m.Called(pid)
|
||||
@@ -109,6 +226,34 @@ func (_m *VM) SetProcess(pid int) error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// VM_SetProcess_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetProcess'
|
||||
type VM_SetProcess_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// SetProcess is a helper method to define mock.On call
|
||||
// - pid int
|
||||
func (_e *VM_Expecter) SetProcess(pid interface{}) *VM_SetProcess_Call {
|
||||
return &VM_SetProcess_Call{Call: _e.mock.On("SetProcess", pid)}
|
||||
}
|
||||
|
||||
func (_c *VM_SetProcess_Call) Run(run func(pid int)) *VM_SetProcess_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(int))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_SetProcess_Call) Return(_a0 error) *VM_SetProcess_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_SetProcess_Call) RunAndReturn(run func(int) error) *VM_SetProcess_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Start provides a mock function with given fields:
|
||||
func (_m *VM) Start() error {
|
||||
ret := _m.Called()
|
||||
@@ -127,6 +272,33 @@ func (_m *VM) Start() error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// VM_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start'
|
||||
type VM_Start_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Start is a helper method to define mock.On call
|
||||
func (_e *VM_Expecter) Start() *VM_Start_Call {
|
||||
return &VM_Start_Call{Call: _e.mock.On("Start")}
|
||||
}
|
||||
|
||||
func (_c *VM_Start_Call) Run(run func()) *VM_Start_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_Start_Call) Return(_a0 error) *VM_Start_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_Start_Call) RunAndReturn(run func() error) *VM_Start_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// State provides a mock function with given fields:
|
||||
func (_m *VM) State() string {
|
||||
ret := _m.Called()
|
||||
@@ -145,6 +317,33 @@ func (_m *VM) State() string {
|
||||
return r0
|
||||
}
|
||||
|
||||
// VM_State_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'State'
|
||||
type VM_State_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// State is a helper method to define mock.On call
|
||||
func (_e *VM_Expecter) State() *VM_State_Call {
|
||||
return &VM_State_Call{Call: _e.mock.On("State")}
|
||||
}
|
||||
|
||||
func (_c *VM_State_Call) Run(run func()) *VM_State_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_State_Call) Return(_a0 string) *VM_State_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_State_Call) RunAndReturn(run func() string) *VM_State_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Stop provides a mock function with given fields:
|
||||
func (_m *VM) Stop() error {
|
||||
ret := _m.Called()
|
||||
@@ -163,6 +362,33 @@ func (_m *VM) Stop() error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// VM_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop'
|
||||
type VM_Stop_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Stop is a helper method to define mock.On call
|
||||
func (_e *VM_Expecter) Stop() *VM_Stop_Call {
|
||||
return &VM_Stop_Call{Call: _e.mock.On("Stop")}
|
||||
}
|
||||
|
||||
func (_c *VM_Stop_Call) Run(run func()) *VM_Stop_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run()
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_Stop_Call) Return(_a0 error) *VM_Stop_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_Stop_Call) RunAndReturn(run func() error) *VM_Stop_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Transition provides a mock function with given fields: newState
|
||||
func (_m *VM) Transition(newState manager.ManagerState) error {
|
||||
ret := _m.Called(newState)
|
||||
@@ -181,6 +407,34 @@ func (_m *VM) Transition(newState manager.ManagerState) error {
|
||||
return r0
|
||||
}
|
||||
|
||||
// VM_Transition_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Transition'
|
||||
type VM_Transition_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Transition is a helper method to define mock.On call
|
||||
// - newState manager.ManagerState
|
||||
func (_e *VM_Expecter) Transition(newState interface{}) *VM_Transition_Call {
|
||||
return &VM_Transition_Call{Call: _e.mock.On("Transition", newState)}
|
||||
}
|
||||
|
||||
func (_c *VM_Transition_Call) Run(run func(newState manager.ManagerState)) *VM_Transition_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(manager.ManagerState))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_Transition_Call) Return(_a0 error) *VM_Transition_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *VM_Transition_Call) RunAndReturn(run func(manager.ManagerState) error) *VM_Transition_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewVM creates a new instance of VM. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewVM(t interface {
|
||||
|
||||
@@ -14,7 +14,6 @@ type sm struct {
|
||||
state manager.ManagerState
|
||||
}
|
||||
|
||||
//go:generate mockery --name StateMachine --output=./mocks --filename state_machine.go --quiet
|
||||
type StateMachine interface {
|
||||
Transition(newState manager.ManagerState) error
|
||||
State() string
|
||||
|
||||
@@ -9,8 +9,6 @@ import (
|
||||
)
|
||||
|
||||
// VM represents a virtual machine.
|
||||
//
|
||||
//go:generate mockery --name VM --output=./mocks --filename vm.go --quiet --note "Copyright (c) Ultraviolet \n // SPDX-License-Identifier: Apache-2.0"
|
||||
type VM interface {
|
||||
Start() error
|
||||
Stop() error
|
||||
@@ -23,7 +21,6 @@ type VM interface {
|
||||
GetConfig() interface{}
|
||||
}
|
||||
|
||||
//go:generate mockery --name Provider --output=./mocks --filename provider.go --quiet --note "Copyright (c) Ultraviolet \n // SPDX-License-Identifier: Apache-2.0"
|
||||
type Provider func(config interface{}, eventSender EventSender, computationId string) VM
|
||||
|
||||
type Event struct {
|
||||
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
with-expecter: true
|
||||
filename: "{{.InterfaceName}}.go"
|
||||
outpkg: "mocks"
|
||||
boilerplate-file: "./boilerplate.txt"
|
||||
packages:
|
||||
github.com/ultravioletrs/cocos/agent:
|
||||
interfaces:
|
||||
Service:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}/mocks"
|
||||
filename: "agent.go"
|
||||
mockname: "{{.InterfaceName}}"
|
||||
AgentService_DataClient:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}/mocks"
|
||||
filename: "agent_grpc_data.go"
|
||||
mockname: "{{.InterfaceName}}"
|
||||
AgentService_AlgoClient:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}/mocks"
|
||||
filename: "agent_grpc_algo.go"
|
||||
mockname: "{{.InterfaceName}}"
|
||||
github.com/ultravioletrs/cocos/agent/auth:
|
||||
interfaces:
|
||||
Authenticator:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}/mocks"
|
||||
filename: "auth.go"
|
||||
mockname: "{{.InterfaceName}}"
|
||||
github.com/ultravioletrs/cocos/agent/events:
|
||||
interfaces:
|
||||
Service:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}/mocks"
|
||||
filename: "events.go"
|
||||
mockname: "{{.InterfaceName}}"
|
||||
github.com/ultravioletrs/cocos/agent/statemachine:
|
||||
interfaces:
|
||||
StateMachine:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}/mocks"
|
||||
filename: "state.go"
|
||||
mockname: "{{.InterfaceName}}"
|
||||
github.com/ultravioletrs/cocos/internal/logger:
|
||||
interfaces:
|
||||
io.Writer:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}/mocks"
|
||||
filename: "io_writer.go"
|
||||
mockname: "{{.InterfaceName}}"
|
||||
github.com/ultravioletrs/cocos/internal/server:
|
||||
interfaces:
|
||||
Server:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}/mocks"
|
||||
filename: "server.go"
|
||||
mockname: "{{.InterfaceName}}"
|
||||
github.com/ultravioletrs/cocos/manager:
|
||||
interfaces:
|
||||
Service:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}/mocks"
|
||||
filename: "service.go"
|
||||
mockname: "{{.InterfaceName}}"
|
||||
github.com/ultravioletrs/cocos/manager/qemu:
|
||||
interfaces:
|
||||
Persistence:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}/mocks"
|
||||
filename: "persistence.go"
|
||||
mockname: "{{.InterfaceName}}"
|
||||
github.com/ultravioletrs/cocos/manager/vm:
|
||||
interfaces:
|
||||
StateMachine:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}/mocks"
|
||||
filename: "state_machine.go"
|
||||
mockname: "{{.InterfaceName}}"
|
||||
VM:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}/mocks"
|
||||
filename: "vm.go"
|
||||
mockname: "{{.InterfaceName}}"
|
||||
Provider:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}/mocks"
|
||||
filename: "provider.go"
|
||||
mockname: "{{.InterfaceName}}"
|
||||
github.com/ultravioletrs/cocos/pkg/sdk:
|
||||
interfaces:
|
||||
SDK:
|
||||
config:
|
||||
dir: "{{.InterfaceDir}}/mocks"
|
||||
filename: "sdk.go"
|
||||
mockname: "{{.InterfaceName}}"
|
||||
@@ -22,7 +22,6 @@ import (
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
//go:generate mockery --name SDK --output=mocks --filename sdk.go --quiet --note "Copyright (c) Ultraviolet \n // SPDX-License-Identifier: Apache-2.0"
|
||||
type SDK interface {
|
||||
Algo(ctx context.Context, algorithm, requirements *os.File, privKey any) error
|
||||
Data(ctx context.Context, dataset *os.File, filename string, privKey any) error
|
||||
|
||||
+132
-2
@@ -1,8 +1,8 @@
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
// Copyright (c) Ultraviolet
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Code generated by mockery v2.43.2. DO NOT EDIT.
|
||||
|
||||
package mocks
|
||||
|
||||
import (
|
||||
@@ -17,6 +17,14 @@ type SDK struct {
|
||||
mock.Mock
|
||||
}
|
||||
|
||||
type SDK_Expecter struct {
|
||||
mock *mock.Mock
|
||||
}
|
||||
|
||||
func (_m *SDK) EXPECT() *SDK_Expecter {
|
||||
return &SDK_Expecter{mock: &_m.Mock}
|
||||
}
|
||||
|
||||
// Algo provides a mock function with given fields: ctx, algorithm, requirements, privKey
|
||||
func (_m *SDK) Algo(ctx context.Context, algorithm *os.File, requirements *os.File, privKey interface{}) error {
|
||||
ret := _m.Called(ctx, algorithm, requirements, privKey)
|
||||
@@ -35,6 +43,37 @@ func (_m *SDK) Algo(ctx context.Context, algorithm *os.File, requirements *os.Fi
|
||||
return r0
|
||||
}
|
||||
|
||||
// SDK_Algo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Algo'
|
||||
type SDK_Algo_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Algo is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - algorithm *os.File
|
||||
// - requirements *os.File
|
||||
// - privKey interface{}
|
||||
func (_e *SDK_Expecter) Algo(ctx interface{}, algorithm interface{}, requirements interface{}, privKey interface{}) *SDK_Algo_Call {
|
||||
return &SDK_Algo_Call{Call: _e.mock.On("Algo", ctx, algorithm, requirements, privKey)}
|
||||
}
|
||||
|
||||
func (_c *SDK_Algo_Call) Run(run func(ctx context.Context, algorithm *os.File, requirements *os.File, privKey interface{})) *SDK_Algo_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(*os.File), args[2].(*os.File), args[3].(interface{}))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *SDK_Algo_Call) Return(_a0 error) *SDK_Algo_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *SDK_Algo_Call) RunAndReturn(run func(context.Context, *os.File, *os.File, interface{}) error) *SDK_Algo_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Attestation provides a mock function with given fields: ctx, reportData, attestationFile
|
||||
func (_m *SDK) Attestation(ctx context.Context, reportData [64]byte, attestationFile *os.File) error {
|
||||
ret := _m.Called(ctx, reportData, attestationFile)
|
||||
@@ -53,6 +92,36 @@ func (_m *SDK) Attestation(ctx context.Context, reportData [64]byte, attestation
|
||||
return r0
|
||||
}
|
||||
|
||||
// SDK_Attestation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Attestation'
|
||||
type SDK_Attestation_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Attestation is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - reportData [64]byte
|
||||
// - attestationFile *os.File
|
||||
func (_e *SDK_Expecter) Attestation(ctx interface{}, reportData interface{}, attestationFile interface{}) *SDK_Attestation_Call {
|
||||
return &SDK_Attestation_Call{Call: _e.mock.On("Attestation", ctx, reportData, attestationFile)}
|
||||
}
|
||||
|
||||
func (_c *SDK_Attestation_Call) Run(run func(ctx context.Context, reportData [64]byte, attestationFile *os.File)) *SDK_Attestation_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].([64]byte), args[2].(*os.File))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *SDK_Attestation_Call) Return(_a0 error) *SDK_Attestation_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *SDK_Attestation_Call) RunAndReturn(run func(context.Context, [64]byte, *os.File) error) *SDK_Attestation_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Data provides a mock function with given fields: ctx, dataset, filename, privKey
|
||||
func (_m *SDK) Data(ctx context.Context, dataset *os.File, filename string, privKey interface{}) error {
|
||||
ret := _m.Called(ctx, dataset, filename, privKey)
|
||||
@@ -71,6 +140,37 @@ func (_m *SDK) Data(ctx context.Context, dataset *os.File, filename string, priv
|
||||
return r0
|
||||
}
|
||||
|
||||
// SDK_Data_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Data'
|
||||
type SDK_Data_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Data is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - dataset *os.File
|
||||
// - filename string
|
||||
// - privKey interface{}
|
||||
func (_e *SDK_Expecter) Data(ctx interface{}, dataset interface{}, filename interface{}, privKey interface{}) *SDK_Data_Call {
|
||||
return &SDK_Data_Call{Call: _e.mock.On("Data", ctx, dataset, filename, privKey)}
|
||||
}
|
||||
|
||||
func (_c *SDK_Data_Call) Run(run func(ctx context.Context, dataset *os.File, filename string, privKey interface{})) *SDK_Data_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(*os.File), args[2].(string), args[3].(interface{}))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *SDK_Data_Call) Return(_a0 error) *SDK_Data_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *SDK_Data_Call) RunAndReturn(run func(context.Context, *os.File, string, interface{}) error) *SDK_Data_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// Result provides a mock function with given fields: ctx, privKey, resultFile
|
||||
func (_m *SDK) Result(ctx context.Context, privKey interface{}, resultFile *os.File) error {
|
||||
ret := _m.Called(ctx, privKey, resultFile)
|
||||
@@ -89,6 +189,36 @@ func (_m *SDK) Result(ctx context.Context, privKey interface{}, resultFile *os.F
|
||||
return r0
|
||||
}
|
||||
|
||||
// SDK_Result_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Result'
|
||||
type SDK_Result_Call struct {
|
||||
*mock.Call
|
||||
}
|
||||
|
||||
// Result is a helper method to define mock.On call
|
||||
// - ctx context.Context
|
||||
// - privKey interface{}
|
||||
// - resultFile *os.File
|
||||
func (_e *SDK_Expecter) Result(ctx interface{}, privKey interface{}, resultFile interface{}) *SDK_Result_Call {
|
||||
return &SDK_Result_Call{Call: _e.mock.On("Result", ctx, privKey, resultFile)}
|
||||
}
|
||||
|
||||
func (_c *SDK_Result_Call) Run(run func(ctx context.Context, privKey interface{}, resultFile *os.File)) *SDK_Result_Call {
|
||||
_c.Call.Run(func(args mock.Arguments) {
|
||||
run(args[0].(context.Context), args[1].(interface{}), args[2].(*os.File))
|
||||
})
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *SDK_Result_Call) Return(_a0 error) *SDK_Result_Call {
|
||||
_c.Call.Return(_a0)
|
||||
return _c
|
||||
}
|
||||
|
||||
func (_c *SDK_Result_Call) RunAndReturn(run func(context.Context, interface{}, *os.File) error) *SDK_Result_Call {
|
||||
_c.Call.Return(run)
|
||||
return _c
|
||||
}
|
||||
|
||||
// NewSDK creates a new instance of SDK. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewSDK(t interface {
|
||||
|
||||
Reference in New Issue
Block a user