mirror of
https://github.com/ultravioletrs/cocos.git
synced 2026-08-07 07:14:50 +00:00
5377dd4d7f
* Refactor mock interfaces to use 'any' instead of 'interface{}' for improved type safety and readability across multiple files in the manager and pkg directories.
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
* Update Go version to 1.25.x in CI workflows and remove obsolete Go package files
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
* Add mock implementations for various components in the attestation and SDK packages
- Created mock for MeasurementProvider in pkg/attestation/cmdconfig/mocks/mocks_test.go
- Created mock for Provider in pkg/attestation/mocks/mocks_test.go
- Created mock for Client in pkg/clients/grpc/mocks/mocks_test.go
- Created mock for SDK in pkg/sdk/mocks/mocks_test.go
These mocks are generated using mockery and are intended for unit testing purposes.
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
* Remove autogenerated mock files and update mock usage in tests
- Deleted mocks for gRPC clients in pkg/clients/grpc/mocks/mocks_test.go and pkg/sdk/mocks/mocks_test.go.
- Updated test files in pkg/progressbar/progress_test.go to use the new mock structure without type parameters for gRPC client interfaces.
- Refactored mock generation in pkg/sdk/mocks/sdk.go to streamline the mock creation process and ensure consistency across mock methods.
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
* Update protobuf generated files for events and manager
- Bump protoc-gen-go version from v1.36.5 to v1.36.8 in events.pb.go and manager.pb.go.
- Refactor raw descriptor definitions in events.pb.go and manager.pb.go to use string concatenation for better readability and maintainability.
- Ensure compatibility with the latest protobuf specifications and improve code generation consistency.
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
* Update test commands to use GOTOOLCHAIN for consistent Go version handling
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
* Fix GOTOOLCHAIN usage in test command for consistency
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
---------
Signed-off-by: Sammy Oina <sammyoina@gmail.com>
356 lines
9.6 KiB
Go
356 lines
9.6 KiB
Go
// Copyright (c) Ultraviolet
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// Code generated by mockery; DO NOT EDIT.
|
|
// github.com/vektra/mockery
|
|
// template: testify
|
|
|
|
package mocks
|
|
|
|
import (
|
|
"context"
|
|
|
|
mock "github.com/stretchr/testify/mock"
|
|
"github.com/ultravioletrs/cocos/manager"
|
|
)
|
|
|
|
// 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 {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *Service {
|
|
mock := &Service{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|
|
|
|
// Service is an autogenerated mock type for the Service type
|
|
type Service struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type Service_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *Service) EXPECT() *Service_Expecter {
|
|
return &Service_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// CreateVM provides a mock function for the type Service
|
|
func (_mock *Service) CreateVM(ctx context.Context, req *manager.CreateReq) (string, string, error) {
|
|
ret := _mock.Called(ctx, req)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for CreateVM")
|
|
}
|
|
|
|
var r0 string
|
|
var r1 string
|
|
var r2 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, *manager.CreateReq) (string, string, error)); ok {
|
|
return returnFunc(ctx, req)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, *manager.CreateReq) string); ok {
|
|
r0 = returnFunc(ctx, req)
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(context.Context, *manager.CreateReq) string); ok {
|
|
r1 = returnFunc(ctx, req)
|
|
} else {
|
|
r1 = ret.Get(1).(string)
|
|
}
|
|
if returnFunc, ok := ret.Get(2).(func(context.Context, *manager.CreateReq) error); ok {
|
|
r2 = returnFunc(ctx, req)
|
|
} else {
|
|
r2 = ret.Error(2)
|
|
}
|
|
return r0, r1, r2
|
|
}
|
|
|
|
// Service_CreateVM_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateVM'
|
|
type Service_CreateVM_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// CreateVM is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - req *manager.CreateReq
|
|
func (_e *Service_Expecter) CreateVM(ctx interface{}, req interface{}) *Service_CreateVM_Call {
|
|
return &Service_CreateVM_Call{Call: _e.mock.On("CreateVM", ctx, req)}
|
|
}
|
|
|
|
func (_c *Service_CreateVM_Call) Run(run func(ctx context.Context, req *manager.CreateReq)) *Service_CreateVM_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 *manager.CreateReq
|
|
if args[1] != nil {
|
|
arg1 = args[1].(*manager.CreateReq)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Service_CreateVM_Call) Return(s string, s1 string, err error) *Service_CreateVM_Call {
|
|
_c.Call.Return(s, s1, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Service_CreateVM_Call) RunAndReturn(run func(ctx context.Context, req *manager.CreateReq) (string, string, error)) *Service_CreateVM_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// FetchAttestationPolicy provides a mock function for the type Service
|
|
func (_mock *Service) FetchAttestationPolicy(ctx context.Context, computationID string) ([]byte, error) {
|
|
ret := _mock.Called(ctx, computationID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for FetchAttestationPolicy")
|
|
}
|
|
|
|
var r0 []byte
|
|
var r1 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string) ([]byte, error)); ok {
|
|
return returnFunc(ctx, computationID)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string) []byte); ok {
|
|
r0 = returnFunc(ctx, computationID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]byte)
|
|
}
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(context.Context, string) error); ok {
|
|
r1 = returnFunc(ctx, computationID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
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) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Service_FetchAttestationPolicy_Call) Return(bytes []byte, err error) *Service_FetchAttestationPolicy_Call {
|
|
_c.Call.Return(bytes, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Service_FetchAttestationPolicy_Call) RunAndReturn(run func(ctx context.Context, computationID string) ([]byte, error)) *Service_FetchAttestationPolicy_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// RemoveVM provides a mock function for the type Service
|
|
func (_mock *Service) RemoveVM(ctx context.Context, computationID string) error {
|
|
ret := _mock.Called(ctx, computationID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for RemoveVM")
|
|
}
|
|
|
|
var r0 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, string) error); ok {
|
|
r0 = returnFunc(ctx, computationID)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// Service_RemoveVM_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveVM'
|
|
type Service_RemoveVM_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// RemoveVM is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - computationID string
|
|
func (_e *Service_Expecter) RemoveVM(ctx interface{}, computationID interface{}) *Service_RemoveVM_Call {
|
|
return &Service_RemoveVM_Call{Call: _e.mock.On("RemoveVM", ctx, computationID)}
|
|
}
|
|
|
|
func (_c *Service_RemoveVM_Call) Run(run func(ctx context.Context, computationID string)) *Service_RemoveVM_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 string
|
|
if args[1] != nil {
|
|
arg1 = args[1].(string)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Service_RemoveVM_Call) Return(err error) *Service_RemoveVM_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Service_RemoveVM_Call) RunAndReturn(run func(ctx context.Context, computationID string) error) *Service_RemoveVM_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// ReturnCVMInfo provides a mock function for the type Service
|
|
func (_mock *Service) ReturnCVMInfo(ctx context.Context) (string, int, string, string) {
|
|
ret := _mock.Called(ctx)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for ReturnCVMInfo")
|
|
}
|
|
|
|
var r0 string
|
|
var r1 int
|
|
var r2 string
|
|
var r3 string
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context) (string, int, string, string)); ok {
|
|
return returnFunc(ctx)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context) string); ok {
|
|
r0 = returnFunc(ctx)
|
|
} else {
|
|
r0 = ret.Get(0).(string)
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(context.Context) int); ok {
|
|
r1 = returnFunc(ctx)
|
|
} else {
|
|
r1 = ret.Get(1).(int)
|
|
}
|
|
if returnFunc, ok := ret.Get(2).(func(context.Context) string); ok {
|
|
r2 = returnFunc(ctx)
|
|
} else {
|
|
r2 = ret.Get(2).(string)
|
|
}
|
|
if returnFunc, ok := ret.Get(3).(func(context.Context) string); ok {
|
|
r3 = returnFunc(ctx)
|
|
} else {
|
|
r3 = ret.Get(3).(string)
|
|
}
|
|
return r0, r1, r2, r3
|
|
}
|
|
|
|
// Service_ReturnCVMInfo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReturnCVMInfo'
|
|
type Service_ReturnCVMInfo_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// ReturnCVMInfo is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
func (_e *Service_Expecter) ReturnCVMInfo(ctx interface{}) *Service_ReturnCVMInfo_Call {
|
|
return &Service_ReturnCVMInfo_Call{Call: _e.mock.On("ReturnCVMInfo", ctx)}
|
|
}
|
|
|
|
func (_c *Service_ReturnCVMInfo_Call) Run(run func(ctx context.Context)) *Service_ReturnCVMInfo_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
run(
|
|
arg0,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Service_ReturnCVMInfo_Call) Return(s string, n int, s1 string, s2 string) *Service_ReturnCVMInfo_Call {
|
|
_c.Call.Return(s, n, s1, s2)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Service_ReturnCVMInfo_Call) RunAndReturn(run func(ctx context.Context) (string, int, string, string)) *Service_ReturnCVMInfo_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Shutdown provides a mock function for the type Service
|
|
func (_mock *Service) Shutdown() error {
|
|
ret := _mock.Called()
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Shutdown")
|
|
}
|
|
|
|
var r0 error
|
|
if returnFunc, ok := ret.Get(0).(func() error); ok {
|
|
r0 = returnFunc()
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
return r0
|
|
}
|
|
|
|
// Service_Shutdown_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Shutdown'
|
|
type Service_Shutdown_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Shutdown is a helper method to define mock.On call
|
|
func (_e *Service_Expecter) Shutdown() *Service_Shutdown_Call {
|
|
return &Service_Shutdown_Call{Call: _e.mock.On("Shutdown")}
|
|
}
|
|
|
|
func (_c *Service_Shutdown_Call) Run(run func()) *Service_Shutdown_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
run()
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *Service_Shutdown_Call) Return(err error) *Service_Shutdown_Call {
|
|
_c.Call.Return(err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *Service_Shutdown_Call) RunAndReturn(run func() error) *Service_Shutdown_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|