From b869dffd8709e37c4102e144b7d1f3131af95acb Mon Sep 17 00:00:00 2001 From: Alec Thomas Date: Mon, 4 Mar 2024 20:26:20 +1100 Subject: [PATCH] fix: include secrets/config managers in ftltest context --- go-runtime/ftl/ftltest/ftltest.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/go-runtime/ftl/ftltest/ftltest.go b/go-runtime/ftl/ftltest/ftltest.go index 4fd382473..ea8ef2d46 100644 --- a/go-runtime/ftl/ftltest/ftltest.go +++ b/go-runtime/ftl/ftltest/ftltest.go @@ -4,10 +4,22 @@ package ftltest import ( "context" + "github.com/TBD54566975/ftl/common/configuration" "github.com/TBD54566975/ftl/internal/log" ) // Context suitable for use in testing FTL verbs. func Context() context.Context { - return log.ContextWithNewDefaultLogger(context.Background()) + ctx := log.ContextWithNewDefaultLogger(context.Background()) + cm, err := configuration.DefaultConfigMixin{}.NewConfigurationManager(ctx) + if err != nil { + panic(err) + } + ctx = configuration.ContextWithConfig(ctx, cm) + sm, err := configuration.DefaultSecretsMixin{}.NewSecretsManager(ctx) + if err != nil { + panic(err) + } + ctx = configuration.ContextWithSecrets(ctx, sm) + return ctx }