Skip to content

[TT-14494] improve error logging for JWKS URL handling - comments

4246b5b
Select commit
Loading
Failed to load commit list.
Merged

[TT-14494] improve error logging for JWKS URL handling #7593

[TT-14494] improve error logging for JWKS URL handling - comments
4246b5b
Select commit
Loading
Failed to load commit list.
probelabs / Visor: quality succeeded Dec 17, 2025 in 1m 22s

✅ Check Passed (Warnings Found)

quality check passed. Found 1 warning, but fail_if condition was not met.

Details

📊 Summary

  • Total Issues: 1
  • Warning Issues: 1

🔍 Failure Condition Results

Passed Conditions

  • global_fail_if: Condition passed

Issues by Category

Architecture (1)

  • ⚠️ gateway/mw_jwt_test.go:3960 - A test case modifies the package-level function variable GetJWK for mocking but does not restore its original value. This creates a leaky mock that can affect other tests in the package, leading to flaky or incorrect test results.

Powered by Visor from Probelabs

💡 TIP: You can chat with Visor using /visor ask <your question>

Annotations

Check warning on line 3963 in gateway/mw_jwt_test.go

See this annotation in the file changed.

@probelabs probelabs / Visor: quality

architecture Issue

A test case modifies the package-level function variable `GetJWK` for mocking but does not restore its original value. This creates a leaky mock that can affect other tests in the package, leading to flaky or incorrect test results.
Raw output
Restore the original value of `GetJWK` after the test completes. The preferred method is to use `t.Cleanup` to ensure restoration even if the test panics. This ensures test isolation and prevents side effects between tests.

Example using `t.Cleanup`:
```go
// In the setup function, which would need to accept `t *testing.T`
originalGetJWK := GetJWK
t.Cleanup(func() { GetJWK = originalGetJWK })
GetJWK = func(_ string, _ bool) (*jose.JSONWebKeySet, error) {
    return nil, errors.New("factory client failed")
}
```