From b441f2e55d489756ad875659f8b6ac6410bdbaf3 Mon Sep 17 00:00:00 2001 From: Phileas Lebada Date: Mon, 3 Feb 2025 12:52:39 +0000 Subject: [PATCH] gitlab-container-registry: Add workaround for failing upstream tests This fixes multiple test failures: - TestListUnprefixed test doesn't work in filesystem driver without root permissions / writeable /var. Fixed in 268689a2 upstream - TestRegulatorEnterExit asserts a wrong return type - multiple azure tests segfault without the AZURE_DRIVER_VERSION env Co-Authored-By: Leona Maroni --- .../gi/gitlab-container-registry/package.nix | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/pkgs/by-name/gi/gitlab-container-registry/package.nix b/pkgs/by-name/gi/gitlab-container-registry/package.nix index 59b2d5db0d55..af8551f02883 100644 --- a/pkgs/by-name/gi/gitlab-container-registry/package.nix +++ b/pkgs/by-name/gi/gitlab-container-registry/package.nix @@ -2,6 +2,7 @@ lib, buildGoModule, fetchFromGitLab, + fetchpatch, }: buildGoModule rec { @@ -19,14 +20,35 @@ buildGoModule rec { vendorHash = "sha256-aKE/yr2Sh+4yw4TmpaVF84rJOI6cjs0DKY326+aXO1o="; + env = { + # required for multiple azure tests + # https://gitlab.com/gitlab-org/container-registry/-/issues/1494 + AZURE_DRIVER_VERSION = "azure_v2"; + }; + + patches = [ + # remove with >= 4.15.3 + (fetchpatch { + url = "https://gitlab.com/gitlab-org/container-registry/-/commit/268689a2f30880b7d122469a4260ca46cbc55ccd.patch"; + hash = "sha256-RslK4qvcqCaG7ju2LgN/tI9cImrTj3Nry+mCv3zoWiA="; + }) + ]; + postPatch = '' # Disable flaky inmemory storage driver test rm registry/storage/driver/inmemory/driver_test.go substituteInPlace health/checks/checks_test.go \ - --replace \ + --replace-fail \ 'func TestHTTPChecker(t *testing.T) {' \ 'func TestHTTPChecker(t *testing.T) { t.Skip("Test requires network connection")' + + # Add workaround for failing test due to function type mismatch (args vs return) by upstream + # https://gitlab.com/gitlab-org/container-registry/-/issues/1495 + substituteInPlace registry/storage/driver/base/regulator_test.go \ + --replace-fail \ + 'require.Equal(t, limit, r.available, "r.available")' \ + 'require.Equal(t, limit, int(r.available), "r.available")' ''; meta = with lib; {