Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <psteinhardt@gitlab.com>2023-08-17 10:43:26 +0300
committerPatrick Steinhardt <psteinhardt@gitlab.com>2023-08-17 10:46:16 +0300
commitd83327df2f9c35c0cc46268d068c673341d7a4dc (patch)
treefa992712f3186d662427727caa2f7fc8d6ba987b /internal/gitaly/server/auth_test.go
parentb3d63188f0d22232335bf973f3a236c388816942 (diff)
Revert introduction of adaptive pack-objects limiter
In 023c2a7d0 (Merge branch 'qmnguyen0711/add-adaptive-limit-to-pack-objects-limit' into 'master', 2023-08-09), we have introduced new code to add an adaptive limit to pack-objects. This new limiter is seemingly creating a memory leak that causes issues in production systems. Revert this merge request. Changelog: fixed
Diffstat (limited to 'internal/gitaly/server/auth_test.go')
-rw-r--r--internal/gitaly/server/auth_test.go31
1 files changed, 15 insertions, 16 deletions
diff --git a/internal/gitaly/server/auth_test.go b/internal/gitaly/server/auth_test.go
index c845bd68f..6333b5942 100644
--- a/internal/gitaly/server/auth_test.go
+++ b/internal/gitaly/server/auth_test.go
@@ -1,7 +1,7 @@
package server
import (
- "context"
+ netctx "context"
"crypto/tls"
"crypto/x509"
"fmt"
@@ -44,7 +44,7 @@ func TestMain(m *testing.M) {
}
func TestSanity(t *testing.T) {
- serverSocketPath := runServer(t, testhelper.Context(t), testcfg.Build(t))
+ serverSocketPath := runServer(t, testcfg.Build(t))
conn, err := dial(serverSocketPath, []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())})
require.NoError(t, err)
@@ -55,8 +55,7 @@ func TestSanity(t *testing.T) {
func TestTLSSanity(t *testing.T) {
cfg := testcfg.Build(t)
- ctx := testhelper.Context(t)
- addr := runSecureServer(t, ctx, cfg)
+ addr := runSecureServer(t, cfg)
certPool, err := x509.SystemCertPool()
require.NoError(t, err)
@@ -103,7 +102,7 @@ func TestAuthFailures(t *testing.T) {
Auth: auth.Config{Token: "quxbaz"},
}))
- serverSocketPath := runServer(t, testhelper.Context(t), cfg)
+ serverSocketPath := runServer(t, cfg)
connOpts := append(tc.opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := dial(serverSocketPath, connOpts)
require.NoError(t, err, tc.desc)
@@ -146,7 +145,7 @@ func TestAuthSuccess(t *testing.T) {
Auth: auth.Config{Token: tc.token, Transitioning: !tc.required},
}))
- serverSocketPath := runServer(t, testhelper.Context(t), cfg)
+ serverSocketPath := runServer(t, cfg)
connOpts := append(tc.opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
conn, err := dial(serverSocketPath, connOpts)
require.NoError(t, err, tc.desc)
@@ -159,7 +158,7 @@ func TestAuthSuccess(t *testing.T) {
type brokenAuth struct{}
func (brokenAuth) RequireTransportSecurity() bool { return false }
-func (brokenAuth) GetRequestMetadata(context.Context, ...string) (map[string]string, error) {
+func (brokenAuth) GetRequestMetadata(netctx.Context, ...string) (map[string]string, error) {
return map[string]string{"authorization": "Bearer blablabla"}, nil
}
@@ -187,7 +186,7 @@ func newOperationClient(t *testing.T, token, serverSocketPath string) (gitalypb.
return gitalypb.NewOperationServiceClient(conn), conn
}
-func runServer(t *testing.T, ctx context.Context, cfg config.Cfg) string {
+func runServer(t *testing.T, cfg config.Cfg) string {
t.Helper()
registry := backchannel.NewRegistry()
@@ -202,7 +201,7 @@ func runServer(t *testing.T, ctx context.Context, cfg config.Cfg) string {
catfileCache := catfile.NewCache(cfg)
t.Cleanup(catfileCache.Stop)
diskCache := cache.New(cfg, locator)
- limitHandler := limithandler.New(cfg, limithandler.LimitConcurrencyByRepo, limithandler.WithConcurrencyLimiters(ctx))
+ limitHandler := limithandler.New(cfg, limithandler.LimitConcurrencyByRepo, limithandler.WithConcurrencyLimiters)
updaterWithHooks := updateref.NewUpdaterWithHooks(cfg, locator, hookManager, gitCmdFactory, catfileCache)
srv, err := NewGitalyServerFactory(cfg, testhelper.NewDiscardingLogEntry(t), registry, diskCache, []*limithandler.LimiterMiddleware{limitHandler}).New(false)
@@ -229,7 +228,7 @@ func runServer(t *testing.T, ctx context.Context, cfg config.Cfg) string {
}
//go:generate openssl req -newkey rsa:4096 -new -nodes -x509 -days 3650 -out testdata/gitalycert.pem -keyout testdata/gitalykey.pem -subj "/C=US/ST=California/L=San Francisco/O=GitLab/OU=GitLab-Shell/CN=localhost" -addext "subjectAltName = IP:127.0.0.1, DNS:localhost"
-func runSecureServer(t *testing.T, ctx context.Context, cfg config.Cfg) string {
+func runSecureServer(t *testing.T, cfg config.Cfg) string {
t.Helper()
cfg.TLS = config.TLS{
@@ -245,7 +244,7 @@ func runSecureServer(t *testing.T, ctx context.Context, cfg config.Cfg) string {
testhelper.NewDiscardingLogEntry(t),
backchannel.NewRegistry(),
cache.New(cfg, config.NewLocator(cfg)),
- []*limithandler.LimiterMiddleware{limithandler.New(cfg, limithandler.LimitConcurrencyByRepo, limithandler.WithConcurrencyLimiters(ctx))},
+ []*limithandler.LimiterMiddleware{limithandler.New(cfg, limithandler.LimitConcurrencyByRepo, limithandler.WithConcurrencyLimiters)},
).New(true)
require.NoError(t, err)
@@ -260,12 +259,12 @@ func runSecureServer(t *testing.T, ctx context.Context, cfg config.Cfg) string {
func TestUnaryNoAuth(t *testing.T) {
cfg := testcfg.Build(t, testcfg.WithBase(config.Cfg{Auth: auth.Config{Token: "testtoken"}}))
- ctx := testhelper.Context(t)
- path := runServer(t, ctx, cfg)
+ path := runServer(t, cfg)
conn, err := grpc.Dial(path, grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err)
defer testhelper.MustClose(t, conn)
+ ctx := testhelper.Context(t)
client := gitalypb.NewRepositoryServiceClient(conn)
_, err = client.CreateRepository(ctx, &gitalypb.CreateRepositoryRequest{
@@ -281,12 +280,12 @@ func TestUnaryNoAuth(t *testing.T) {
func TestStreamingNoAuth(t *testing.T) {
cfg := testcfg.Build(t, testcfg.WithBase(config.Cfg{Auth: auth.Config{Token: "testtoken"}}))
- ctx := testhelper.Context(t)
- path := runServer(t, ctx, cfg)
+ path := runServer(t, cfg)
conn, err := dial(path, []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())})
require.NoError(t, err)
t.Cleanup(func() { conn.Close() })
+ ctx := testhelper.Context(t)
client := gitalypb.NewRepositoryServiceClient(conn)
stream, err := client.GetInfoAttributes(ctx, &gitalypb.GetInfoAttributesRequest{
@@ -331,7 +330,7 @@ func TestAuthBeforeLimit(t *testing.T) {
t.Cleanup(cleanup)
cfg.Gitlab.URL = gitlabURL
- serverSocketPath := runServer(t, ctx, cfg)
+ serverSocketPath := runServer(t, cfg)
client, conn := newOperationClient(t, cfg.Auth.Token, serverSocketPath)
t.Cleanup(func() { conn.Close() })