mirror of
https://github.com/DeBrosOfficial/network.git
synced 2026-01-30 03:43:04 +00:00
feat: update mockFunctionRegistry methods for serverless function handling
- Modified the Register method to return a function instance and an error, enhancing its functionality. - Added a new GetLogs method to the mockFunctionRegistry for retrieving log entries, improving test coverage for serverless function logging.
This commit is contained in:
parent
4f893e08d1
commit
9ddbe945fd
@ -16,8 +16,8 @@ type mockFunctionRegistry struct {
|
||||
functions []*serverless.Function
|
||||
}
|
||||
|
||||
func (m *mockFunctionRegistry) Register(ctx context.Context, fn *serverless.FunctionDefinition, wasmBytes []byte) error {
|
||||
return nil
|
||||
func (m *mockFunctionRegistry) Register(ctx context.Context, fn *serverless.FunctionDefinition, wasmBytes []byte) (*serverless.Function, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (m *mockFunctionRegistry) Get(ctx context.Context, namespace, name string, version int) (*serverless.Function, error) {
|
||||
@ -36,6 +36,10 @@ func (m *mockFunctionRegistry) GetWASMBytes(ctx context.Context, wasmCID string)
|
||||
return []byte("wasm"), nil
|
||||
}
|
||||
|
||||
func (m *mockFunctionRegistry) GetLogs(ctx context.Context, namespace, name string, limit int) ([]serverless.LogEntry, error) {
|
||||
return []serverless.LogEntry{}, nil
|
||||
}
|
||||
|
||||
func TestServerlessHandlers_ListFunctions(t *testing.T) {
|
||||
logger := zap.NewNop()
|
||||
registry := &mockFunctionRegistry{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user