mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-10 09:08:52 +00:00
Bundle N.A/B-extended CI follow-up: QF1002 tagged-switch fix in digicert
CI's golangci-lint flagged 3 staticcheck QF1002 hits on
internal/connector/issuer/digicert/digicert_failure_test.go at
lines 32, 51, 70 — 'could use tagged switch on r.URL.Path'.
Fix: convert each 'switch { case r.URL.Path == "/user/me": ... }'
to 'switch r.URL.Path { case "/user/me": ... }'. Same shape as
the Bundle J QF1002 fix-up.
Why digicert and not sectigo: sectigo's switches mix literal path
checks (case r.URL.Path == "/ssl/v1/types") with prefix checks
(case strings.HasPrefix(r.URL.Path, "/ssl/v1/collect/")), which
can't be expressed as a tagged switch. CI didn't flag sectigo.
Verification
=================
- go test -short -count=1 ./internal/connector/issuer/digicert/...:
PASS in 0.6s
- go vet ./internal/connector/issuer/digicert/...: clean
- staticcheck -checks=QF1002 across all extension test files:
clean (0 hits)
Bundle: N.AB-ci-fix
This commit is contained in:
@@ -29,8 +29,8 @@ func buildDigicertConnector(t *testing.T, baseURL string) *digicert.Connector {
|
|||||||
|
|
||||||
func TestDigicert_GetOrderStatus_404_ReturnsError(t *testing.T) {
|
func TestDigicert_GetOrderStatus_404_ReturnsError(t *testing.T) {
|
||||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
switch {
|
switch r.URL.Path {
|
||||||
case r.URL.Path == "/user/me":
|
case "/user/me":
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
_, _ = w.Write([]byte(`{"id":1}`))
|
_, _ = w.Write([]byte(`{"id":1}`))
|
||||||
default:
|
default:
|
||||||
@@ -48,8 +48,8 @@ func TestDigicert_GetOrderStatus_404_ReturnsError(t *testing.T) {
|
|||||||
|
|
||||||
func TestDigicert_GetOrderStatus_MalformedJSON_ReturnsError(t *testing.T) {
|
func TestDigicert_GetOrderStatus_MalformedJSON_ReturnsError(t *testing.T) {
|
||||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
switch {
|
switch r.URL.Path {
|
||||||
case r.URL.Path == "/user/me":
|
case "/user/me":
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
_, _ = w.Write([]byte(`{"id":1}`))
|
_, _ = w.Write([]byte(`{"id":1}`))
|
||||||
default:
|
default:
|
||||||
@@ -67,8 +67,8 @@ func TestDigicert_GetOrderStatus_MalformedJSON_ReturnsError(t *testing.T) {
|
|||||||
|
|
||||||
func TestDigicert_GetOrderStatus_IssuedButCertIDMissing(t *testing.T) {
|
func TestDigicert_GetOrderStatus_IssuedButCertIDMissing(t *testing.T) {
|
||||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
switch {
|
switch r.URL.Path {
|
||||||
case r.URL.Path == "/user/me":
|
case "/user/me":
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
_, _ = w.Write([]byte(`{"id":1}`))
|
_, _ = w.Write([]byte(`{"id":1}`))
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user