diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-01-10 11:52:51 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-01-12 12:56:15 +0300 |
commit | 077fe1a8996e3ee6ef0e288491962154cb89e0af (patch) | |
tree | de0416cae1fbf35a617980210f0b3effbaf4b7b3 /internal/gitaly/server | |
parent | 863ea5eccf9b0f4e2de290b7cf04ec5e8f8ddf45 (diff) |
testcfg: Convert callers of `BuildWithRepo()`
The `BuildWithRepo()` function builds a Gitaly configuration and at the
same time creates a seed repository. There's two issues with this:
- It is a layering violation as the configuration-related code
should not depend on the repository-related logic. This means that
e.g. the `gittest` package cannot depend on the `testcfg` package
even though it is at a conceptually higher level.
- It hides away the parameters used to create the repository. This
means that we use seed repositories by default, but also that we
skip creation via the Repository service. Both are bad and should
require the caller to explicitly state that they want this.
Convert callers of `BuildWithRepo()` to instead use `Build()` to build
the configuration and `gittest.CreateRepository()` to create the
repository. Remove the now-unused `BuildWithRepo()` function.
Diffstat (limited to 'internal/gitaly/server')
-rw-r--r-- | internal/gitaly/server/auth_test.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/internal/gitaly/server/auth_test.go b/internal/gitaly/server/auth_test.go index b0322c6f6..2c008077e 100644 --- a/internal/gitaly/server/auth_test.go +++ b/internal/gitaly/server/auth_test.go @@ -306,7 +306,8 @@ func TestStreamingNoAuth(t *testing.T) { } func TestAuthBeforeLimit(t *testing.T) { - cfg, repo, repoPath := testcfg.BuildWithRepo(t, testcfg.WithBase(config.Cfg{ + ctx := testhelper.Context(t) + cfg := testcfg.Build(t, testcfg.WithBase(config.Cfg{ Auth: auth.Config{Token: "abc123"}, Concurrency: []config.Concurrency{{ RPC: "/gitaly.OperationService/UserCreateTag", @@ -315,6 +316,11 @@ func TestAuthBeforeLimit(t *testing.T) { }, )) + repo, repoPath := gittest.CreateRepository(t, ctx, cfg, gittest.CreateRepositoryConfig{ + SkipCreationViaService: true, + Seed: gittest.SeedGitLabTest, + }) + gitlabURL, cleanup := gitlab.SetupAndStartGitlabServer(t, cfg.GitlabShell.Dir, &gitlab.TestServerOptions{ SecretToken: "secretToken", GLID: gittest.GlID, @@ -328,7 +334,6 @@ func TestAuthBeforeLimit(t *testing.T) { serverSocketPath := runServer(t, cfg) client, conn := newOperationClient(t, cfg.Auth.Token, serverSocketPath) t.Cleanup(func() { conn.Close() }) - ctx := testhelper.Context(t) defer func(d time.Duration) { gitalyauth.SetTokenValidityDuration(d) |