diff options
author | Pavlo Strokov <pstrokov@gitlab.com> | 2023-02-21 11:15:01 +0300 |
---|---|---|
committer | Pavlo Strokov <pstrokov@gitlab.com> | 2023-03-21 00:43:19 +0300 |
commit | ecc62f2b68562c69a3df2c4d71dc464e89fa432f (patch) | |
tree | 8bc1af5d3f2c8da828a0de45aaed48484705210c /internal/testhelper | |
parent | 61795ab20da3e4ff4fba506f033861b529c6dc80 (diff) |
gitaly: Sub-command 'configuration' with 'validate' sub-command
In order to improve developers experience in using Gitaly
the new 'configuration' sub-command is added. Now it has only
one sub-command which is 'validate'. The purpose of
it to validate provided configuration before starting
the service. The output lists all the problems of the
configuration in JSON format into STDOUT. The structure
of object includes 'key' which is a path to the field
where the problem detected and the 'message' with an
explanation of the problem.
Changelog: added
Part of: #4650
Diffstat (limited to 'internal/testhelper')
-rw-r--r-- | internal/testhelper/testcfg/gitaly.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/testhelper/testcfg/gitaly.go b/internal/testhelper/testcfg/gitaly.go index e3bbf3823..d55161cd4 100644 --- a/internal/testhelper/testcfg/gitaly.go +++ b/internal/testhelper/testcfg/gitaly.go @@ -135,6 +135,18 @@ func (gc *GitalyCfgBuilder) Build(tb testing.TB) config.Cfg { // to have lying around. cfg.Git.IgnoreGitconfig = true + // The tests don't require GitLab API to be accessible, but as it is required to pass + // validation, so the artificial values are set to pass. + if cfg.Gitlab.URL == "" { + cfg.Gitlab.URL = "https://test.stub.gitlab.com" + } + + if cfg.Gitlab.SecretFile == "" { + cfg.Gitlab.SecretFile = filepath.Join(root, "gitlab", "http.secret") + require.NoError(tb, os.MkdirAll(filepath.Dir(cfg.Gitlab.SecretFile), perm.SharedDir)) + require.NoError(tb, os.WriteFile(cfg.Gitlab.SecretFile, nil, perm.PublicFile)) + } + require.NoError(tb, cfg.Validate()) return cfg |