Repository navigation
[type:test] prefer prefixed swagger document when both api-docs URLs return 200 - #8512
Conversation
Follow-up test for merged apache#8480 / apache#8410. When the registered context path and the backend root both serve /v3/api-docs, import the prefixed document and do not request the root. Co-authored-by: markxu <[email protected]>
wy471x
left a comment
There was a problem hiding this comment.
Standards
- No checkstyle concerns: the new method needs no imports and
@Testmethods are exempt fromJavadocMethod. - Minor: the
ROOT_SWAGGER_URLstub branch returnsROOT_DOCbut is unreachable by construction, since the prefixed URL answers 200 first. A short comment stating that the root document must never be probed would make the intent obvious instead of looking like a copy of the 404-retry test.
Spec
- The test locks in the merged #8480 order (prefixed first, root only after a 404), which is the opposite of the order proposed in the closed issue #8410. That is consistent with the PR description and with the contract documented in
PullSwaggerDocServiceImpl.openSwaggerResponse("the registered context path is requested first… the backend root is tried once only after HTTP 404"), so I read this as pinning a deliberate decision, not enshrining a defect. If the deviation from #8410 is intentional, one line of rationale in the test would stop the next reader from "fixing" it back. - Some assertions are not discriminating:
assertTrue(tagVO.getTagExt().getRefreshTime() > 1000L)only proves that some pull happened, andverify(docManager, never()).addDocInfo(any(), eq(ROOT_DOC), ...)cannot fail once the positivePREFIXED_DOCverification passes. Theurlsassertion is the meaningful one and it is correct: it proves the root URL is never requested when the prefixed document answers 200.
Verdict
Merge. The test documents current, intentional behaviour and does not touch production code; the notes above are optional nits.
Aias00
left a comment
There was a problem hiding this comment.
Stream Agent analysis
Test-only follow-up to #8480 adding one JUnit test (testPullApiDocumentPrefersPrefixedSwaggerWhenBothUrlsSucceed) to SwaggerDocManagerImplTest, asserting that when both the prefixed and root api-docs URLs return 200 only /mcp/v3/api-docs is requested and the prefixed document is imported. No production code changed and no blocking defect found; verdict is INCONCLUSIVE because CI is still pending.
Evidence: ["Attachment reports complete_diff=true: exactly one file changed, shenyu-admin/src/test/java/org/apache/shenyu/admin/service/manager/impl/SwaggerDocManagerImplTest.java (+22/-0), with the full added test method shown; no production code touched, no concrete defect identified.","CI metadata: 11 checks all status=queued with conclusion=null, failed_checks=[], passed=false, pending=true, diagnosis=CI_PENDING — no passing CI result available.","Coverage note states only captured patches/check metadata were supplied and no local tests were executed; the passing-test and checkstyle claims in the PR body are the author's, not independently verified here."]
Next steps: ["Wait for all 11 CI checks to finish and confirm a passing conclusion before issuing a PASS verdict.","Re-review if any newly completed CI check reports a failure tied to this test."]
Verdict: INCONCLUSIVE; publication: COMMENT (INCONCLUSIVE_REVIEW)
Findings: []
Scope: captured GitHub evidence only; no local tests were executed.
Task: 73cd10e7-b1ad-4701-a4db-1416346d441a Commit: f6945eed56a79c83883d9c9d992c979fe1a6bfaa
Follow-up to #8480. Related to #8410.
Why
Merged #8480 keeps the prefixed-first order on purpose. When both
http://ip:port{contextPath}/v3/api-docsandhttp://ip:port/v3/api-docsreturn 200, Admin should import the registered context-path document and should not request the root URL. This test locks that in.Tests
./mvnw -pl shenyu-admin -am test -Dtest=SwaggerDocManagerImplTest -Dsurefire.failIfNoSpecifiedTests=falseSwaggerDocManagerImplTest: 13 tests, 0 failures. Checkstyle reported 0 violations.
./mvnw -pl shenyu-admin apache-rat:checkpassed (unapproved 0).testPullApiDocumentPrefersPrefixedSwaggerWhenBothUrlsSucceed: both URLs answer 200 with different bodies, the only request is/mcp/v3/api-docs, and the imported body is the prefixed document.This change was made with AI assistance and reviewed.