diff options
author | Nick Thomas <nick@gitlab.com> | 2019-09-18 17:42:19 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-09-20 11:41:38 +0100 |
commit | 9237ac094a060dbb31c1ee4d37ad7ef38e17e878 (patch) | |
tree | 78f94a4db3f94f95d17974845b37aca984227a20 /go/internal/config/config_test.go | |
parent | 996b2e1d44cc671cc60fd4ddacd2c5750b72a025 (diff) | |
download | gitlab-shell-9237ac094a060dbb31c1ee4d37ad7ef38e17e878.tar.gz |
Remove feature flags and the fallback command
Diffstat (limited to 'go/internal/config/config_test.go')
-rw-r--r-- | go/internal/config/config_test.go | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/go/internal/config/config_test.go b/go/internal/config/config_test.go index aefc145..e31ff70 100644 --- a/go/internal/config/config_test.go +++ b/go/internal/config/config_test.go @@ -28,7 +28,6 @@ func TestParseConfig(t *testing.T) { path string format string gitlabUrl string - migration MigrationConfig secret string httpSettings HttpSettingsConfig }{ @@ -56,13 +55,6 @@ func TestParseConfig(t *testing.T) { secret: "default-secret-content", }, { - yaml: "migration:\n enabled: true\n features:\n - foo\n - bar", - path: path.Join(testRoot, "gitlab-shell.log"), - format: "text", - migration: MigrationConfig{Enabled: true, Features: []string{"foo", "bar"}}, - secret: "default-secret-content", - }, - { yaml: "gitlab_url: http+unix://%2Fpath%2Fto%2Fgitlab%2Fgitlab.socket", path: path.Join(testRoot, "gitlab-shell.log"), format: "text", @@ -110,8 +102,6 @@ func TestParseConfig(t *testing.T) { err := parseConfig([]byte(tc.yaml), &cfg) require.NoError(t, err) - assert.Equal(t, tc.migration.Enabled, cfg.Migration.Enabled, "migration.enabled not equal") - assert.Equal(t, tc.migration.Features, cfg.Migration.Features, "migration.features not equal") assert.Equal(t, tc.path, cfg.LogFile) assert.Equal(t, tc.format, cfg.LogFormat) assert.Equal(t, tc.gitlabUrl, cfg.GitlabUrl) @@ -120,64 +110,3 @@ func TestParseConfig(t *testing.T) { }) } } - -func TestFeatureEnabled(t *testing.T) { - testCases := []struct { - desc string - config *Config - feature string - expectEnabled bool - }{ - { - desc: "When the protocol is supported and the feature enabled", - config: &Config{ - GitlabUrl: "http+unix://gitlab.socket", - Migration: MigrationConfig{Enabled: true, Features: []string{"discover"}}, - }, - feature: "discover", - expectEnabled: true, - }, - { - desc: "When the protocol is supported and the feature is not enabled", - config: &Config{ - GitlabUrl: "http+unix://gitlab.socket", - Migration: MigrationConfig{Enabled: true, Features: []string{}}, - }, - feature: "discover", - expectEnabled: false, - }, - { - desc: "When the protocol is supported and all features are disabled", - config: &Config{ - GitlabUrl: "http+unix://gitlab.socket", - Migration: MigrationConfig{Enabled: false, Features: []string{"discover"}}, - }, - feature: "discover", - expectEnabled: false, - }, - { - desc: "When the protocol is http and the feature enabled", - config: &Config{ - GitlabUrl: "http://localhost:3000", - Migration: MigrationConfig{Enabled: true, Features: []string{"discover"}}, - }, - feature: "discover", - expectEnabled: true, - }, - { - desc: "When the protocol is https and the feature enabled", - config: &Config{ - GitlabUrl: "https://localhost:3000", - Migration: MigrationConfig{Enabled: true, Features: []string{"discover"}}, - }, - feature: "discover", - expectEnabled: true, - }, - } - - for _, tc := range testCases { - t.Run(tc.desc, func(t *testing.T) { - assert.Equal(t, tc.expectEnabled, tc.config.FeatureEnabled(string(tc.feature))) - }) - } -} |