Add more unit tests + enable unit testing in CI#3
Conversation
Adds 18 isolated unit tests (Mockito only, no live OIDC/DB/Spring context): - PkceAuthorizationCodeAccessTokenProviderTest (7): authorization-redirect parameter building, S256 code_challenge = BASE64URL(SHA-256(verifier)), PKCE-disabled path, CSRF rejection on missing state, code_verifier replay at the token endpoint, and configurable state-key length. - OpenIdConnectUserDetailsTest (6): username-pattern resolution (default, custom multi-claim, missing-claim error) and email/name claim mapping. - OpenIdLoginExtensionTest (5): one-shot error-message display/clear and the blank/absent/no-data/exception short-circuits. Raises coverage from 46%/26% to 57%/37% (instruction/branch); the three targeted classes reach 95%/94%/100% instruction coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Covers the filter's pure logic that previously had no direct tests, all without an OAuth2 exchange, database, or servlet container (filter built with mocked collaborators; private methods exercised via reflection): - Email-domain whitelisting (isAllowedEmailDomain / shouldFilterEmailDomains): filtering disabled, on/off whitelist, case-insensitive match, "*" wildcard, malformed address with no domain, unknown provider, and default-off config. - Login-page error mapping (getUserMessage): usernamePattern config error vs. generic retry message for other failures. - ID-token encryption detection (isIdTokenEncrypted): 5-part JWE vs 3-part JWS. Raises OpenIdConnectFilter coverage from 38%/24% to 56%/54% (instruction/branch) and overall coverage to 63%/46%. The static-XNAT paths (Users.createUser, TurbineUtils redirects) remain for integration testing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Runs `./gradlew test jacocoTestReport` on a Temurin JDK 21 runner for pushes and PRs to main, with Gradle dependency caching. Uploads JUnit results and the JaCoCo HTML report as build artifacts. JDK 21 matches the build's sourceCompatibility/targetCompatibility (the Java 21 / XNAT 1.10.0 migration). The legacy .circleci/config.yml is pinned to JDK 8 and cannot compile the current codebase. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The CircleCI pipeline was pinned to JDK 8 (circleci/openjdk:8-jdk-buster), which cannot compile the Java 21 codebase, and the circleci/* image namespace is deprecated. It is superseded by the GitHub Actions workflow added in the previous commit. Also removes the CircleCI-only Maven settings.xml (env-var placeholders, no secrets) that was used solely by the removed publish step. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
actions/setup-java writes a default ~/.m2/settings.xml whose server credentials the net.linguica.maven-settings plugin fails to decrypt at configuration time, breaking the test-only CI job. Remove the file before invoking Gradle. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Updates checkout v4->v6, setup-java v4->v5, and upload-artifact v4->v7 to clear the Node.js 20 deprecation warning and run on Node.js 24. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the push trigger on all branches so opening a PR no longer runs CI twice against the same commit. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Scoped to main/develop so merges get a post-merge run without double-running on PR branches. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
It'd be nice to get more detail about the test results in the Actions log without having to download the artifacts - you can do this by having gradle print more info (some examples of this in Scout), or presumably there's a marketplace action that'd render a report from the XML...
|
This is probably out of scope, but while you're working on CI/removing circleCI, should there be a job to publish to Jfrog on merge? |
I did consider this, but I do think that's a separate thing. It might be nice if there were a standard way to do this for all the plugin repos; I'll start a conversation about that. |
Add test-summary/action to read Gradle's JUnit XML and display a results table on the workflow run summary page. Matches the setup in the scout repo (same action, same pinned v2.6 SHA). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Gradle's test task is silent by default. Add a testLogging block so CI shows live pass/skip/fail progress and full stack traces on failure, and forwards test stdout/stderr to the build output. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This repo has no automation to bump pinned action SHAs, so track the v2 major tag to pick up fixes automatically. Drop the Scout reference from the rationale comment. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mainanddevelop