diff options
author | Jacob Vosmaer (GitLab) <jacob@gitlab.com> | 2017-12-11 13:18:20 +0300 |
---|---|---|
committer | Jacob Vosmaer (GitLab) <jacob@gitlab.com> | 2017-12-11 13:18:20 +0300 |
commit | 39da1024940421558119a01bd7c7585c666cab7b (patch) | |
tree | 08c9e59e7bd260d66ed48fe8d68e1baba28d1657 | |
parent | 6e23039cfa784f836e60ef47e17e9a97fc47a1ac (diff) |
Set balancer timeouts in test
-rw-r--r-- | internal/config/config.go | 2 | ||||
-rw-r--r-- | internal/config/config_test.go | 4 | ||||
-rw-r--r-- | internal/config/ruby.go | 3 | ||||
-rw-r--r-- | internal/testhelper/testhelper.go | 4 |
4 files changed, 9 insertions, 4 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index db2205b91..e12dbc476 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -91,7 +91,7 @@ func Validate() error { validateToken(), SetGitPath(), validateShell(), - validateRuby(), + ConfigureRuby(), validateBinDir(), } { if err != nil { diff --git a/internal/config/config_test.go b/internal/config/config_test.go index dd2fa6ed7..3e50a8e64 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -344,7 +344,7 @@ func TestValidateShellPath(t *testing.T) { } } -func TestValidateRuby(t *testing.T) { +func TestConfigureRuby(t *testing.T) { defer func(oldRuby Ruby) { Config.Ruby = oldRuby }(Config.Ruby) @@ -371,7 +371,7 @@ func TestValidateRuby(t *testing.T) { t.Run(tc.desc, func(t *testing.T) { Config.Ruby = Ruby{Dir: tc.dir} - err := validateRuby() + err := ConfigureRuby() if tc.ok { require.NoError(t, err) } else { diff --git a/internal/config/ruby.go b/internal/config/ruby.go index dbafae1f3..4d65939b2 100644 --- a/internal/config/ruby.go +++ b/internal/config/ruby.go @@ -26,7 +26,8 @@ func (d *duration) UnmarshalText(text []byte) error { return err } -func validateRuby() error { +// ConfigureRuby validates the gitaly-ruby configuration and sets default values. +func ConfigureRuby() error { Config.Ruby.GracefulRestartTimeout = Config.Ruby.GracefulRestartTimeoutToml.Duration if Config.Ruby.GracefulRestartTimeout == 0 { Config.Ruby.GracefulRestartTimeout = 10 * time.Minute diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go index e2b69b1e3..62dc44cd1 100644 --- a/internal/testhelper/testhelper.go +++ b/internal/testhelper/testhelper.go @@ -253,6 +253,10 @@ func ConfigureRuby() { log.Fatal("Could not get caller info") } config.Config.Ruby.Dir = path.Join(path.Dir(currentFile), "../../ruby") + + if err := config.ConfigureRuby(); err != nil { + log.Fatal("validate ruby config: %v", err) + } } // NewTestGrpcServer creates a GRPC Server for testing purposes |