From 9ddbe945fd4eb7bf58d16dd270bf2324bdeca248 Mon Sep 17 00:00:00 2001 From: anonpenguin23 Date: Fri, 2 Jan 2026 08:41:54 +0200 Subject: [PATCH] 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. --- pkg/gateway/serverless_handlers_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/gateway/serverless_handlers_test.go b/pkg/gateway/serverless_handlers_test.go index aacf655..9d97d78 100644 --- a/pkg/gateway/serverless_handlers_test.go +++ b/pkg/gateway/serverless_handlers_test.go @@ -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{