fix: move experimental flag to server (#4959)

This commit is contained in:
Garrett Delfosse
2022-11-08 11:59:39 -05:00
committed by GitHub
parent b2a16d46c6
commit 2789fb7cac
11 changed files with 29 additions and 52 deletions

View File

@ -35,6 +35,7 @@ import (
"github.com/google/uuid"
"github.com/moby/moby/pkg/namesgenerator"
"github.com/spf13/afero"
"github.com/spf13/pflag"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/oauth2"
@ -49,6 +50,8 @@ import (
"cdr.dev/slog"
"cdr.dev/slog/sloggers/slogtest"
"github.com/coder/coder/cli/config"
"github.com/coder/coder/cli/deployment"
"github.com/coder/coder/coderd"
"github.com/coder/coder/coderd/audit"
"github.com/coder/coder/coderd/autobuild/executor"
@ -159,6 +162,9 @@ func NewOptions(t *testing.T, options *Options) (func(http.Handler), context.Can
if options.Database == nil {
options.Database, options.Pubsub = dbtestutil.NewDB(t)
}
if options.DeploymentConfig == nil {
options.DeploymentConfig = DeploymentConfig(t)
}
ctx, cancelFunc := context.WithCancel(context.Background())
lifecycleExecutor := executor.New(
@ -236,7 +242,6 @@ func NewOptions(t *testing.T, options *Options) (func(http.Handler), context.Can
CacheDir: t.TempDir(),
Database: options.Database,
Pubsub: options.Pubsub,
Experimental: options.Experimental,
GitAuthConfigs: options.GitAuthConfigs,
Auditor: options.Auditor,
@ -903,3 +908,13 @@ d8h4Ht09E+f3nhTEc87mODkl7WJZpHL6V2sORfeq/eIkds+H6CJ4hy5w/bSw8tjf
sz9Di8sGIaUbLZI2rd0CQQCzlVwEtRtoNCyMJTTrkgUuNufLP19RZ5FpyXxBO5/u
QastnN77KfUwdj3SJt44U/uh1jAIv4oSLBr8HYUkbnI8
-----END RSA PRIVATE KEY-----`
func DeploymentConfig(t *testing.T) *codersdk.DeploymentConfig {
vip := deployment.NewViper()
fs := pflag.NewFlagSet(randomUsername(), pflag.ContinueOnError)
fs.String(config.FlagName, randomUsername(), randomUsername())
cfg, err := deployment.Config(fs, vip)
require.NoError(t, err)
return cfg
}