Skip to content

[v2] containerinfra: Fix wrong HTTP method and path in certificate create test - #3953

Merged
stephenfin merged 1 commit into
v2from
bp-v2-47354d2
Aug 17, 2026
Merged

stephenfin merged 1 commit into
v2from
bp-v2-47354d2

Conversation

@gophercloud-backport-bot

Copy link
Copy Markdown

Backport: #3946

The HandleCreateCertificateSuccessfully fixture registered its handler at /v1/certificates/ (with trailing slash) and asserted the request method was GET, but certificates.Create issues a POST to /v1/certificates (without trailing slash).

This worked by accident prior to Go 1.26: the ServeMux redirected requests from /v1/certificates to /v1/certificates/ via 301, and Go's HTTP client changed POST to GET when following a 301 redirect. Go 1.26 changed these trailing-slash redirects to use 307 instead, which preserves the original method, so POST now arrives at the handler unchanged and the incorrect assertion fails.

Fix by matching the actual URL (/v1/certificates, no trailing slash) and asserting the correct method (POST).

Fixes #3898

…test

The HandleCreateCertificateSuccessfully fixture registered its handler
at "/v1/certificates/" (with trailing slash) and asserted the request
method was GET, but certificates.Create issues a POST to
"/v1/certificates" (without trailing slash).

This worked by accident prior to Go 1.26: the ServeMux redirected
requests from "/v1/certificates" to "/v1/certificates/" via 301, and
Go's HTTP client changed POST to GET when following a 301 redirect. Go
1.26 changed these trailing-slash redirects to use 307 instead [1],
which preserves the original method, so POST now arrives at the handler
unchanged and the incorrect assertion fails.

Fix by matching the actual URL ("/v1/certificates", no trailing slash)
and asserting the correct method (POST).

[1] https://go.dev/doc/go1.26

Signed-off-by: Stephen Finucane <[email protected]>
Assisted-By: Claude Opus 4.6 <[email protected]>
@github-actions github-actions Bot added v2 This PR targets v2 edit:containerinfra This PR updates containerinfra code semver:patch No API change labels Aug 17, 2026
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 63.865%. remained the same — bp-v2-47354d2 into v2

@stephenfin
stephenfin merged commit aeaf405 into v2 Aug 17, 2026
22 of 25 checks passed
@stephenfin
stephenfin deleted the bp-v2-47354d2 branch August 17, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

edit:containerinfra This PR updates containerinfra code semver:patch No API change v2 This PR targets v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants