get.porter.sh/porter@v1.3.0/pkg/runtime/helpers.go (about) 1 package runtime 2 3 import ( 4 "testing" 5 6 "get.porter.sh/porter/pkg/config" 7 "get.porter.sh/porter/pkg/mixin" 8 "get.porter.sh/porter/pkg/portercontext" 9 ) 10 11 type TestPorterRuntime struct { 12 *PorterRuntime 13 TestContext *portercontext.TestContext 14 } 15 16 func NewTestPorterRuntime(t *testing.T) *TestPorterRuntime { 17 testConfig := config.NewTestConfig(t) 18 testConfig.Setenv("PORTER_DEBUG", "true") 19 20 mixins := mixin.NewTestMixinProvider() 21 cfg := NewConfigFor(testConfig.Config) 22 pr := NewPorterRuntime(cfg, mixins) 23 24 return &TestPorterRuntime{ 25 TestContext: testConfig.TestContext, 26 PorterRuntime: pr, 27 } 28 } 29 30 type TestRuntimeConfig struct { 31 RuntimeConfig 32 TestContext *portercontext.TestContext 33 } 34 35 func NewTestRuntimeConfig(t *testing.T) TestRuntimeConfig { 36 testConfig := config.NewTestConfig(t) 37 testConfig.Setenv("PORTER_DEBUG", "true") 38 runtimeCfg := NewConfigFor(testConfig.Config) 39 return TestRuntimeConfig{ 40 RuntimeConfig: runtimeCfg, 41 TestContext: testConfig.TestContext, 42 } 43 }