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:
anonpenguin23 2026-01-02 08:41:54 +02:00
parent 4f893e08d1
commit 9ddbe945fd

View File

@ -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{