Add Testcontainers integration tests for SAML newslist flow#161
Draft
Copilot wants to merge 2 commits into
Draft
Add Testcontainers integration tests for SAML newslist flow#161Copilot wants to merge 2 commits into
Copilot wants to merge 2 commits into
Conversation
Agent-Logs-Url: https://github.com/kit-sdq/newslist/sessions/81c37c84-b1a4-40a3-9004-8a528f0d3210 Co-authored-by: dfuchss <22198798+dfuchss@users.noreply.github.com>
Agent-Logs-Url: https://github.com/kit-sdq/newslist/sessions/81c37c84-b1a4-40a3-9004-8a528f0d3210 Co-authored-by: dfuchss <22198798+dfuchss@users.noreply.github.com>
|
Copilot created this pull request from a session on behalf of
dfuchss
May 14, 2026 08:25
View session
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Adds end-to-end integration tests using Testcontainers and HtmlUnit that exercise the full SAML 2.0 SSO login flow of the newslist application.
A real SimpleSAMLphp IdP is started in Docker (
jamedjo/test-saml-idp, the same image used in the demodocker-compose.yml) alongside the Spring Boot application. HtmlUnit drives a headless browser through the complete SSO flow.Changes
build.gradlenet.sourceforge.htmlunit:htmlunit(legacy, unmaintained) withorg.htmlunit:htmlunitmanaged by the Spring Boot 4 BOM (version 4.17.0).org.testcontainers:testcontainersandorg.testcontainers:testcontainers-junit-jupiter(version 2.0.5, managed by the Spring Boot 4 BOM).src/test/resources/news/Two minimal CSV news files are added:
News Item 1.csv1News Item 2.csv1Both entries use key
1, which matches theuidattribute of user1 in the test IdP. user2 (uid2) has no entries and sees an empty list.src/test/java/…/NewsListIntegrationTest.javaFive test cases covering the main flows:
unauthenticatedUserIsRedirectedToSamlLogin/is redirected to the SimpleSAMLphp login pageauthenticatedUserWithMatchingNewsSeesTheirItemsauthenticatedUserWithoutMatchingNewsSeesEmptyListemailAddressFromSamlAttributeIsDisplayedemailSAML attribute is shown on the index pagenewsItemTitleIsDisplayedCorrectlyHow the chicken-and-egg port problem is solved: A free port is pre-allocated via
ServerSocket(0)in a static initialiser before the Testcontainers@Containeris created. The IdP is configured with the SP ACS URL using that port, and@DynamicPropertySourceinjectsserver.portso Spring Boot binds to the same port..github/workflows/build.ymlAdds a
gradle teststep so the new tests run in CI.