summaryrefslogtreecommitdiff
path: root/go/internal/config/config_test.go
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-09-28 15:46:09 +0000
committerDouwe Maan <douwe@gitlab.com>2018-09-28 15:46:09 +0000
commit3cf936123cda48a8856fb6cd534331f2dabe9e15 (patch)
treec4b4754790e619082ca935cef0bb489f3a6470b6 /go/internal/config/config_test.go
parent1cc2993f357c4467e4d45c54c01d2307103efb3e (diff)
parentf435c4644abc167cdfe6bfe3d320ff840f468c09 (diff)
downloadgitlab-shell-3cf936123cda48a8856fb6cd534331f2dabe9e15.tar.gz
Merge branch '74-go-go-go-go-go' into 'master'
Feature flag for go/ruby gitlab-shell implementations Closes #74 See merge request gitlab-org/gitlab-shell!233
Diffstat (limited to 'go/internal/config/config_test.go')
-rw-r--r--go/internal/config/config_test.go24
1 files changed, 20 insertions, 4 deletions
diff --git a/go/internal/config/config_test.go b/go/internal/config/config_test.go
index 0a5c842..87a582f 100644
--- a/go/internal/config/config_test.go
+++ b/go/internal/config/config_test.go
@@ -2,20 +2,28 @@ package config
import (
"fmt"
+ "strings"
"testing"
)
-func TestConfigLogFile(t *testing.T) {
+func TestParseConfig(t *testing.T) {
testRoot := "/foo/bar"
testCases := []struct {
- yaml string
- path string
- format string
+ yaml string
+ path string
+ format string
+ migration MigrationConfig
}{
{path: "/foo/bar/gitlab-shell.log", format: "text"},
{yaml: "log_file: my-log.log", path: "/foo/bar/my-log.log", format: "text"},
{yaml: "log_file: /qux/my-log.log", path: "/qux/my-log.log", format: "text"},
{yaml: "log_format: json", path: "/foo/bar/gitlab-shell.log", format: "json"},
+ {
+ yaml: "migration:\n enabled: true\n features:\n - foo\n - bar",
+ path: "/foo/bar/gitlab-shell.log",
+ format: "text",
+ migration: MigrationConfig{Enabled: true, Features: []string{"foo", "bar"}},
+ },
}
for _, tc := range testCases {
@@ -25,6 +33,14 @@ func TestConfigLogFile(t *testing.T) {
t.Fatal(err)
}
+ if cfg.Migration.Enabled != tc.migration.Enabled {
+ t.Fatalf("migration.enabled: expected %v, got %v", tc.migration.Enabled, cfg.Migration.Enabled)
+ }
+
+ if strings.Join(cfg.Migration.Features, ":") != strings.Join(tc.migration.Features, ":") {
+ t.Fatalf("migration.features: expected %#v, got %#v", tc.migration.Features, cfg.Migration.Features)
+ }
+
if cfg.LogFile != tc.path {
t.Fatalf("expected %q, got %q", tc.path, cfg.LogFile)
}