Azure Test Failure without environment variable

Running go test fails since v4.15.0 because of registry/storage/driver/azure/azure_test.go not specifying a fallback/default version driverVersion = os.Getenv(common.EnvDriverVersion).

I believe the appropriate way would be test both driver versions when running go test and not depending on externally supplied variables.

This makes packaging more difficult https://github.com/NixOS/nixpkgs/issues/379071

Workaround:

export AZURE_DRIVER_VERSION=azure_v2
go test -count 1 -run TestAzureDriver_parseParameters_Bool ./...
--- FAIL: TestAzureDriver_parseParameters_Bool (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xbf8302]

goroutine 10 [running]:
testing.tRunner.func1.2({0xf0ad20, 0x1940000})
	/usr/local/go/src/testing/testing.go:1632 +0x230
testing.tRunner.func1()
	/usr/local/go/src/testing/testing.go:1635 +0x35e
panic({0xf0ad20?, 0x1940000?})
	/usr/local/go/src/runtime/panic.go:785 +0x132
github.com/docker/distribution/registry/storage/driver/internal/testutil.TestBoolValue(0xc00039e680, {{0xeaafa0, 0x18f3d28}, 0x0, 0x0, 0x0, 0x0, {0x1084a4d, 0x14}, {0x1084a89, ...}, ...})
	/app/registry/storage/driver/internal/testutil/testutil.go:37 +0x102
github.com/docker/distribution/registry/storage/driver/internal/testutil.AssertByDefaultType(0x604?, {{0xeaafa0, 0x18f3d28}, 0x0, 0x0, 0x0, 0x0, {0x1084a4d, 0x14}, {0x1084a89, ...}, ...})
	/app/registry/storage/driver/internal/testutil/testutil.go:25 +0xe5
github.com/docker/distribution/registry/storage/driver/azure.TestAzureDriver_parseParameters_Bool(0xc00039e680)
	/app/registry/storage/driver/azure/azure_test.go:558 +0x1bb
testing.tRunner(0xc00039e680, 0x10d7e20)
	/usr/local/go/src/testing/testing.go:1690 +0xf4
created by testing.(*T).Run in goroutine 1
	/usr/local/go/src/testing/testing.go:1743 +0x390
Edited Feb 03, 2025 by Phileas Lebada
Assignee Loading
Time tracking Loading