From 6f0edffaf9a12aad8695f3163baaca3536fa0caf Mon Sep 17 00:00:00 2001 From: Chris Randles Date: Thu, 29 Aug 2024 15:09:06 -0400 Subject: [PATCH] feat: allow accessing the test environments env config --- pkg/env/env.go | 6 ++++++ pkg/types/types.go | 3 +++ 2 files changed, 9 insertions(+) diff --git a/pkg/env/env.go b/pkg/env/env.go index b8ff5e98..df5c4523 100644 --- a/pkg/env/env.go +++ b/pkg/env/env.go @@ -363,6 +363,12 @@ func (e *testEnv) Finish(funcs ...Func) types.Environment { return e } +// EnvConf returns the test environment's environment configuration +func (e *testEnv) EnvConf() *envconf.Config { + cfg := *e.cfg + return &cfg +} + // Run is to launch the test suite from a TestMain function. // It will run m.Run() and exercise all test functions in the // package. This method will all Env.Setup operations prior to diff --git a/pkg/types/types.go b/pkg/types/types.go index f0f710c8..f921d86a 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -85,6 +85,9 @@ type Environment interface { // Run Launches the test suite from within a TestMain Run(*testing.M) int + + // EnvConf returns the test environment's environment configuration + EnvConf() *envconf.Config } type Labels = flags.LabelsMap