Uh oh!
There was an error while loading. Please reload this page.
Add TemporaryRequestContext unit tests - #11798
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| assertNotNull(ctx); | ||
| assertEquals(mockAppSecContext, ctx.getData(RequestContextSlot.APPSEC)); | ||
| assertNull(ctx.getData(RequestContextSlot.CI_VISIBILITY)); |
There was a problem hiding this comment.
nit: consider also testing a slot beyond CI_VISIBILITY (e.g. IAST) and the edge case where appSecContext is null — in that case getData(APPSEC) should also return null, which is currently not covered.
| } | ||
| @Test | ||
| void temporaryRequestContextNoOpMethodsReturnExpectedDefaults() throws Exception { |
There was a problem hiding this comment.
nit: throws Exception is unnecessary here — none of the no-op methods actually throw a checked exception. The comment "verify no-op methods don't throw" makes the intent clear, but the throws clause sends the opposite signal. Removing it makes the method signature self-documenting.
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
/merge |
View all feedbacks in Devflow UI.
The expected merge time in
|
Uh oh!
There was an error while loading. Please reload this page.
d9b0bfe
into
masterUh oh!
There was an error while loading. Please reload this page.
What Does This Do
Adds unit tests for the
TemporaryRequestContextprivate static class insideLambdaAppSecHandler, covering:getData()returns the stored AppSec context for theAPPSECslot andnullfor other slotsgetTraceSegment,getBlockResponseFunction,getOrCreateMetaStructTop,getClientIpAddressData, setters,close) return expected defaults and do not throwSince
TemporaryRequestContextis private, tests capture an instance by intercepting therequestMethodUriRawcallback during aprocessRequestStartinvocation with a mocked tracer.Motivation
Improve test coverage for
TemporaryRequestContext.Additional Notes
tag: no release note
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issue/merge.Jira ticket: [PROJ-IDENT]