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:
authorKarthik Nayak <knayak@gitlab.com>2024-01-23 01:36:12 +0300
committerKarthik Nayak <knayak@gitlab.com>2024-01-23 01:53:52 +0300
commit4e4b3916042d4513dd08d94b1b31443c4e1946ef (patch)
treeaf0b86483cdd1f95ed21e82f01775ca0cfad9237
parent92f15bbbd89062e4cb82c07769b97f453f20e18f (diff)
-rw-r--r--.gitlab-ci.yml7
-rw-r--r--Makefile5
-rw-r--r--internal/git/gittest/repo.go27
-rw-r--r--internal/testhelper/testhelper.go6
4 files changed, 43 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ef608ef89..974549704 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -275,6 +275,13 @@ test:pgbouncer:
# can reach Postgres.
TEST_TARGET: "test-with-praefect"
+test:reftable:
+ <<: *test_definition
+ variables:
+ <<: *test_variables
+ GIT_VERSION: "pks-reftables-initial-baseline"
+ TEST_TARGET: test-with-reftable
+
test:nightly:
<<: *test_definition
variables:
diff --git a/Makefile b/Makefile
index ba51a9acc..58a6fe5d9 100644
--- a/Makefile
+++ b/Makefile
@@ -367,6 +367,11 @@ bench: override TEST_OPTIONS := -bench=. -run=^$ ${TEST_OPTIONS}
bench: ${BENCHMARK_REPO} prepare-tests
${Q}$(call run_go_tests)
+.PHONY: test-with-reftable
+## Run Go tests with git's reftable backend.
+test-with-reftable: export GITALY_TEST_WITH_REFTABLE = YesPlease
+test-with-reftable: test-go
+
.PHONY: test-with-praefect
## Run Go tests with Praefect.
test-with-praefect: export GITALY_TEST_WITH_PRAEFECT = YesPlease
diff --git a/internal/git/gittest/repo.go b/internal/git/gittest/repo.go
index b283ba6ca..b84883677 100644
--- a/internal/git/gittest/repo.go
+++ b/internal/git/gittest/repo.go
@@ -200,8 +200,23 @@ func CreateRepository(tb testing.TB, ctx context.Context, cfg config.Cfg, config
} else {
repoPath = filepath.Join(storage.Path, repository.RelativePath)
+ extraFlags := []string{}
+ if testhelper.IsReftableEnabled() {
+ extraFlags = append(extraFlags, "--ref-format=reftable")
+ }
+
if opts.Seed != "" {
- Exec(tb, cfg, "clone", "--no-hardlinks", "--dissociate", "--bare", testRepositoryPath(tb, opts.Seed), repoPath)
+ args := []string{
+ "clone",
+ "--no-hardlinks",
+ "--dissociate",
+ "--bare",
+ testRepositoryPath(tb, opts.Seed),
+ repoPath,
+ }
+ args = append(args, extraFlags...)
+
+ Exec(tb, cfg, args...)
Exec(tb, cfg, "-C", repoPath, "remote", "remove", "origin")
} else {
objectFormat := opts.ObjectFormat
@@ -209,7 +224,15 @@ func CreateRepository(tb testing.TB, ctx context.Context, cfg config.Cfg, config
objectFormat = DefaultObjectHash.Format
}
- Exec(tb, cfg, "init", "--bare", "--object-format="+objectFormat, repoPath)
+ args := []string{
+ "init",
+ "--bare",
+ "--object-format=" + objectFormat,
+ repoPath,
+ }
+ args = append(args, extraFlags...)
+
+ Exec(tb, cfg, args...)
}
tb.Cleanup(func() { require.NoError(tb, os.RemoveAll(repoPath)) })
diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go
index 59663b0ab..78cf8b25a 100644
--- a/internal/testhelper/testhelper.go
+++ b/internal/testhelper/testhelper.go
@@ -33,6 +33,12 @@ const (
DefaultStorageName = "default"
)
+// IsReftableEnabled returns whether the git reftable is enabled
+func IsReftableEnabled() bool {
+ _, ok := os.LookupEnv("GITALY_TEST_WITH_REFTABLE")
+ return ok
+}
+
// IsWALEnabled returns whether write-ahead logging is enabled in this testing run.
func IsWALEnabled() bool {
_, ok := os.LookupEnv("GITALY_TEST_WAL")