Skip to content

Fix TestCreateTempURL flaky test by removing hardcoded port dependency - #3662

Merged
stephenfin merged 2 commits into
gophercloud:mainfrom
shiftstack:fix-unittest-crash
Mar 26, 2026
Merged

stephenfin merged 2 commits into
gophercloud:mainfrom
shiftstack:fix-unittest-crash

Conversation

@mandre

@mandre mandre commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

SetupPersistentPortHTTP used t.Errorf on bind failure, which didn't stop
execution and caused a nil pointer panic on server.Start(). Changed to
t.Fatalf to fail cleanly.

Replaced SetupPersistentPortHTTP with SetupHTTP in objectstorage temp URL
tests since the HMAC signature only covers the path, not the host:port.
This eliminates the flaky port-already-in-use failures in CI.

Fixes #3661.

mandre added 2 commits March 26, 2026 08:11
SetupPersistentPortHTTP used t.Errorf on bind failure, which didn't stop
execution and caused a nil pointer panic on server.Start(). Changed to
t.Fatalf to fail cleanly.

Replaced SetupPersistentPortHTTP with SetupHTTP in objectstorage temp URL
tests since the HMAC signature only covers the path, not the host:port.
This eliminates the flaky port-already-in-use failures in CI.

Fixes gophercloud#3661.
… tests

Several tests used t.Errorf after fallible operations, which logs the
error but doesn't stop execution. This caused nil pointer dereferences
when subsequent code accessed the result. Replace with th.AssertNoErr
which calls t.Fatal internally, stopping the test immediately on error.
@github-actions github-actions Bot added edit:objectstorage This PR updates objectstorage code edit:sharedfilesystems This PR updates sharedfilesystems code edit:identity This PR updates identity code edit:testinfra This PR updates testing infrastructure code labels Mar 26, 2026
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 63.859%. remained the same
when pulling 2254df1 on shiftstack:fix-unittest-crash
into 8d07d46 on gophercloud:main.

@mandre mandre added the semver:patch No API change label Mar 26, 2026

@stephenfin stephenfin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess #3398 didn't do enough

@stephenfin
stephenfin added this pull request to the merge queue Mar 26, 2026
Merged via the queue into gophercloud:main with commit b6cb117 Mar 26, 2026
66 checks passed
@stephenfin
stephenfin deleted the fix-unittest-crash branch March 26, 2026 10:17
@mandre mandre added the backport-v2 This PR will be backported to v2 label Apr 7, 2026
@github-actions

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

Failed to backport PR to v2 branch. See logs for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-v2 This PR will be backported to v2 edit:identity This PR updates identity code edit:objectstorage This PR updates objectstorage code edit:sharedfilesystems This PR updates sharedfilesystems code edit:testinfra This PR updates testing infrastructure code semver:patch No API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] Port in use causes panic in unit tests

3 participants