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 <dev@leona.is>
This commit is contained in:
Phileas Lebada 2025-02-03 12:52:39 +00:00 committed by Leona Maroni
parent e522ddbc51
commit b441f2e55d
No known key found for this signature in database
GPG Key ID: D5B08ADFC75E3605

View File

@ -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; {