Skip to content

Commit 4c0bcf1

Browse files
author
Andrew Farries
committed
Remove duplication from test setup function
1 parent 5eafb9b commit 4c0bcf1

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

install/installer/pkg/components/usage/objects_test.go

+6-26
Original file line numberDiff line numberDiff line change
@@ -63,32 +63,12 @@ func renderContextWithUsageEnabled(t *testing.T) *common.RenderContext {
6363
}
6464

6565
func renderContextWithStripeSecretSet(t *testing.T) *common.RenderContext {
66-
ctx, err := common.NewRenderContext(config.Config{
67-
Domain: "test.domain.everything.awesome.is",
68-
Experimental: &experimental.Config{
69-
WebApp: &experimental.WebAppConfig{
70-
Server: &experimental.ServerConfig{StripeSecret: "some-stripe-secret"},
71-
Usage: &experimental.UsageConfig{Enabled: true},
72-
},
73-
},
74-
Database: config.Database{
75-
CloudSQL: &config.DatabaseCloudSQL{
76-
ServiceAccount: config.ObjectRef{
77-
Name: "gcp-db-creds-service-account-name",
78-
},
79-
},
80-
},
81-
}, versions.Manifest{
82-
Components: versions.Components{
83-
Usage: versions.Versioned{
84-
Version: "commit-test-latest",
85-
},
86-
ServiceWaiter: versions.Versioned{
87-
Version: "commit-test-latest",
88-
},
89-
},
90-
}, "test-namespace")
91-
require.NoError(t, err)
66+
ctx := renderContextWithUsageEnabled(t)
67+
68+
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
69+
cfg.WebApp.Server = &experimental.ServerConfig{StripeSecret: "some-stripe-secret"}
70+
return nil
71+
})
9272

9373
return ctx
9474
}

0 commit comments

Comments
 (0)