summaryrefslogtreecommitdiff
path: root/go/internal
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2018-08-28 10:37:07 +0200
committerNick Thomas <nick@gitlab.com>2018-09-28 04:24:52 +0100
commit1f8556b2f86d7954f86f4a9a58f586a838f8ae21 (patch)
tree79fd8ba537a8073b0b9b32cabc39dcd4cafe258f /go/internal
parent1cc2993f357c4467e4d45c54c01d2307103efb3e (diff)
downloadgitlab-shell-1f8556b2f86d7954f86f4a9a58f586a838f8ae21.tar.gz
Initial feature-flagged go/ruby switch
Diffstat (limited to 'go/internal')
-rw-r--r--go/internal/config/config.go7
-rw-r--r--go/internal/config/config_test.go12
2 files changed, 13 insertions, 6 deletions
diff --git a/go/internal/config/config.go b/go/internal/config/config.go
index 7d521f5..64822c7 100644
--- a/go/internal/config/config.go
+++ b/go/internal/config/config.go
@@ -14,9 +14,10 @@ const (
)
type Config struct {
- RootDir string
- LogFile string `yaml:"log_file"`
- LogFormat string `yaml:"log_format"`
+ RootDir string
+ LogFile string `yaml:"log_file"`
+ LogFormat string `yaml:"log_format"`
+ Experimental bool `yaml:"experimental"`
}
func New() (*Config, error) {
diff --git a/go/internal/config/config_test.go b/go/internal/config/config_test.go
index 0a5c842..552a600 100644
--- a/go/internal/config/config_test.go
+++ b/go/internal/config/config_test.go
@@ -8,14 +8,16 @@ import (
func TestConfigLogFile(t *testing.T) {
testRoot := "/foo/bar"
testCases := []struct {
- yaml string
- path string
- format string
+ yaml string
+ path string
+ format string
+ experimental bool
}{
{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: "experimental: true", path: "/foo/bar/gitlab-shell.log", format: "text", experimental: true},
}
for _, tc := range testCases {
@@ -25,6 +27,10 @@ func TestConfigLogFile(t *testing.T) {
t.Fatal(err)
}
+ if cfg.Experimental != tc.experimental {
+ t.Fatalf("expected %v, got %v", tc.experimental, cfg.Experimental)
+ }
+
if cfg.LogFile != tc.path {
t.Fatalf("expected %q, got %q", tc.path, cfg.LogFile)
}