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:
authorSami Hiltunen <shiltunen@gitlab.com>2022-07-06 15:48:35 +0300
committerSami Hiltunen <shiltunen@gitlab.com>2022-07-06 15:48:35 +0300
commit1f20b94a3862bf070794390d40b6c91f80648f8f (patch)
tree9cf0198c899089ba7713036036af5fc0e1f6bc75
parentac72695adc90343b7255869818376f505bde8315 (diff)
parenta0a6909272c900ee0a67a1ee0624638ef5fd3b46 (diff)
Merge branch 'pks-go-v1.17-infrastructure' into 'master'
Adjust infrastructure to use Go v1.17 See merge request gitlab-org/gitaly!4684
-rw-r--r--.gitlab-ci.yml10
-rw-r--r--.golangci.yml6
-rw-r--r--.tool-versions2
-rw-r--r--internal/git/command_factory_test.go5
-rw-r--r--internal/gitaly/service/repository/create_fork_test.go2
-rw-r--r--internal/log/log_test.go6
-rw-r--r--internal/testhelper/testhelper.go15
7 files changed, 22 insertions, 24 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f14361e56..786ae3200 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,7 +4,7 @@ stages:
- qa
default:
- image: registry.gitlab.com/gitlab-org/gitlab-build-images:debian-${DEBIAN_VERSION}-ruby-${RUBY_VERSION}-golang-${GO_VERSION}-git-2.33-postgresql-11
+ image: registry.gitlab.com/gitlab-org/gitlab-build-images/debian-${DEBIAN_VERSION}-ruby-${RUBY_VERSION}-golang-${GO_VERSION}-postgresql-11:git-2.33
tags:
- gitlab-org
@@ -14,7 +14,7 @@ variables:
DEBIAN_VERSION: "bullseye"
# We use Gitaly's Git version by default.
GIT_VERSION: "default"
- GO_VERSION: "1.17"
+ GO_VERSION: "1.18"
RUBY_VERSION: "2.7"
POSTGRES_VERSION: "12.6-alpine"
PGBOUNCER_VERSION: "1.16.1"
@@ -145,7 +145,7 @@ build:
- _support/test-boot . ${TEST_BOOT_ARGS}
parallel:
matrix:
- - GO_VERSION: [ "1.16", "1.17" ]
+ - GO_VERSION: [ "1.17", "1.18" ]
TEST_BOOT_ARGS: "--bundled-git"
- GIT_VERSION: "v2.33.0"
@@ -170,7 +170,7 @@ build:binaries:
expire_in: 6 months
parallel:
matrix:
- - GO_VERSION: [ "1.16", "1.17" ]
+ - GO_VERSION: [ "1.17", "1.18" ]
test:
<<: *test_definition
@@ -178,7 +178,7 @@ test:
matrix:
# The following jobs all test with our default Git version, which is
# using bundled Git binaries.
- - GO_VERSION: [ "1.16", "1.17" ]
+ - GO_VERSION: [ "1.17", "1.18" ]
TEST_TARGET: test
- TEST_TARGET: [ test-with-proxies, test-with-praefect, race-go ]
# We also verify that things work as expected with a non-bundled Git
diff --git a/.golangci.yml b/.golangci.yml
index 4ef4e7da7..db6ed2d7e 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -58,6 +58,12 @@ linters-settings:
# they're tested as expected.
- ^context.Background$
- ^context.TODO$
+ # Tests should not set the bare environment functions, but instead use
+ # `testhelper.ModifyEnvironment()`. This function has sanity checks to
+ # verify we don't use `t.Parallel()` when setting envvars by using the
+ # `t.Setenv()` helper.
+ - ^os.Setenv$
+ - ^os.Unsetenv$
stylecheck:
# ST1000 checks for missing package comments. We don't use these for most
# packages, so let's disable this check.
diff --git a/.tool-versions b/.tool-versions
index 7929518f8..687c9652e 100644
--- a/.tool-versions
+++ b/.tool-versions
@@ -1,3 +1,3 @@
# Versions of Gitaly dependencies managed by asdf.
-golang 1.17.7 1.16.14
+golang 1.18.3 1.17.9
ruby 2.7.5
diff --git a/internal/git/command_factory_test.go b/internal/git/command_factory_test.go
index d709dd130..ede45c745 100644
--- a/internal/git/command_factory_test.go
+++ b/internal/git/command_factory_test.go
@@ -33,9 +33,8 @@ func TestGitCommandProxy(t *testing.T) {
}))
defer ts.Close()
- oldHTTPProxy := os.Getenv("http_proxy")
- defer require.NoError(t, os.Setenv("http_proxy", oldHTTPProxy))
- require.NoError(t, os.Setenv("http_proxy", ts.URL))
+ testhelper.ModifyEnvironment(t, "http_proxy", ts.URL)
+
ctx := testhelper.Context(t)
dir := testhelper.TempDir(t)
diff --git a/internal/gitaly/service/repository/create_fork_test.go b/internal/gitaly/service/repository/create_fork_test.go
index b23b85bc3..53651c408 100644
--- a/internal/gitaly/service/repository/create_fork_test.go
+++ b/internal/gitaly/service/repository/create_fork_test.go
@@ -43,8 +43,6 @@ import (
)
func TestCreateFork_successful(t *testing.T) {
- t.Parallel()
-
// We need to inject this once across all tests given that crypto/x509 only initializes
// certificates once. Changing injected certs during our tests is thus not going to fly well
// and would cause failure. We should eventually address this and provide better testing
diff --git a/internal/log/log_test.go b/internal/log/log_test.go
index f6bfa3a0a..1d0a70122 100644
--- a/internal/log/log_test.go
+++ b/internal/log/log_test.go
@@ -491,10 +491,8 @@ func TestLogDeciderOption_logByRegexpMatch(t *testing.T) {
},
} {
t.Run(tc.desc, func(t *testing.T) {
- require.NoError(t, os.Setenv("GITALY_LOG_REQUEST_METHOD_DENY_PATTERN", tc.skip))
- defer func() { require.NoError(t, os.Unsetenv("GITALY_LOG_REQUEST_METHOD_DENY_PATTERN")) }()
- require.NoError(t, os.Setenv("GITALY_LOG_REQUEST_METHOD_ALLOW_PATTERN", tc.only))
- defer func() { require.NoError(t, os.Unsetenv("GITALY_LOG_REQUEST_METHOD_ALLOW_PATTERN")) }()
+ t.Setenv("GITALY_LOG_REQUEST_METHOD_DENY_PATTERN", tc.skip)
+ t.Setenv("GITALY_LOG_REQUEST_METHOD_ALLOW_PATTERN", tc.only)
logger, hook := test.NewNullLogger()
interceptor := grpcmwlogrus.UnaryServerInterceptor(logrus.NewEntry(logger), DeciderOption())
diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go
index db65feeb3..dacf805b3 100644
--- a/internal/testhelper/testhelper.go
+++ b/internal/testhelper/testhelper.go
@@ -274,17 +274,14 @@ func ModifyEnvironment(t testing.TB, key string, value string) {
oldValue, hasOldValue := os.LookupEnv(key)
if value == "" {
require.NoError(t, os.Unsetenv(key))
+ t.Cleanup(func() {
+ if hasOldValue {
+ require.NoError(t, os.Setenv(key, oldValue))
+ }
+ })
} else {
- require.NoError(t, os.Setenv(key, value))
+ t.Setenv(key, value)
}
-
- t.Cleanup(func() {
- if hasOldValue {
- require.NoError(t, os.Setenv(key, oldValue))
- } else {
- require.NoError(t, os.Unsetenv(key))
- }
- })
}
// GenerateCerts creates a certificate that can be used to establish TLS protected TCP connection.