@@ -35,6 +35,7 @@ import (
35
35
"github.com/google/uuid"
36
36
"github.com/moby/moby/pkg/namesgenerator"
37
37
"github.com/spf13/afero"
38
+ "github.com/spf13/pflag"
38
39
"github.com/stretchr/testify/assert"
39
40
"github.com/stretchr/testify/require"
40
41
"golang.org/x/oauth2"
@@ -49,6 +50,8 @@ import (
49
50
50
51
"cdr.dev/slog"
51
52
"cdr.dev/slog/sloggers/slogtest"
53
+ "github.com/coder/coder/cli/config"
54
+ "github.com/coder/coder/cli/deployment"
52
55
"github.com/coder/coder/coderd"
53
56
"github.com/coder/coder/coderd/audit"
54
57
"github.com/coder/coder/coderd/autobuild/executor"
@@ -159,6 +162,9 @@ func NewOptions(t *testing.T, options *Options) (func(http.Handler), context.Can
159
162
if options .Database == nil {
160
163
options .Database , options .Pubsub = dbtestutil .NewDB (t )
161
164
}
165
+ if options .DeploymentConfig == nil {
166
+ options .DeploymentConfig = DeploymentConfig (t )
167
+ }
162
168
163
169
ctx , cancelFunc := context .WithCancel (context .Background ())
164
170
lifecycleExecutor := executor .New (
@@ -236,7 +242,6 @@ func NewOptions(t *testing.T, options *Options) (func(http.Handler), context.Can
236
242
CacheDir : t .TempDir (),
237
243
Database : options .Database ,
238
244
Pubsub : options .Pubsub ,
239
- Experimental : options .Experimental ,
240
245
GitAuthConfigs : options .GitAuthConfigs ,
241
246
242
247
Auditor : options .Auditor ,
@@ -903,3 +908,13 @@ d8h4Ht09E+f3nhTEc87mODkl7WJZpHL6V2sORfeq/eIkds+H6CJ4hy5w/bSw8tjf
903
908
sz9Di8sGIaUbLZI2rd0CQQCzlVwEtRtoNCyMJTTrkgUuNufLP19RZ5FpyXxBO5/u
904
909
QastnN77KfUwdj3SJt44U/uh1jAIv4oSLBr8HYUkbnI8
905
910
-----END RSA PRIVATE KEY-----`
911
+
912
+ func DeploymentConfig (t * testing.T ) * codersdk.DeploymentConfig {
913
+ vip := deployment .NewViper ()
914
+ fs := pflag .NewFlagSet (randomUsername (), pflag .ContinueOnError )
915
+ fs .String (config .FlagName , randomUsername (), randomUsername ())
916
+ cfg , err := deployment .Config (fs , vip )
917
+ require .NoError (t , err )
918
+
919
+ return cfg
920
+ }
0 commit comments