8000 [OID4VCI] Migrate OID4VCJWTIssuerEndpointTest by graziang · Pull Request #46945 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

[OID4VCI] Migrate OID4VCJWTIssuerEndpointTest - #46945

Merged
mposolda merged 1 commit into
keycloak:mainfrom
graziang:issue-46925
Mar 16, 2026
Merged

mposolda merged 1 commit into
keycloak:mainfrom
graziang:issue-46925

Conversation

@graziang
@graziang graziang commented Mar 6, 2026 •
Copy link
Copy Markdown
Contributor

Closes #46925

PR to migrate OID4VCJWTIssuerEndpointTest and OID4VCIssuerEndpointTest to the new test suite.

I tried to convert the configurations inside OID4VCIssuerTestBase as much as possible to make them compliant with the new test suite.

@mposolda
mposolda commented Mar 9, 2026
Copy link
Copy Markdown
Contributor

@graziang Thanks for the PR! Could you please rebase to latest main and double-check if your PR matches with recently merged b2dbdd3 ? It is possible that other PR introduced some "generic pieces", which are handled in your PR to different way (but not 100% sure as did not checked the details).

@graziang
graziang commented Mar 9, 2026
Copy link
Copy Markdown
Contributor 8000 Author

@mposolda thanks! I rebased the PR and updated the "common parts".

@keycloak-github-bot keycloak-github-bot Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreported flaky test detected, please review

@keycloak-github-bot
Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.broker.KcOidcBrokerTest#loginWithExistingUserWithBruteForceEnabled

Keycloak CI - Java Distribution IT (windows-latest - temurin - 21)

org.openqa.selenium.TimeoutException: 
Expected condition failed: waiting for value to contain (ignoring case) "sign in to". Current value: "AUTH_RESPONSE" (tried for 5 second(s) with 500 milliseconds interval)
Build info: version: '4.28.1', revision: '73f5ad48a2'
System info: os.name: 'Windows Server 2025', os.arch: 'amd64', os.version: '10.0', java.version: '21.0.10'
Driver info: org.jboss.arquillian.drone.webdriver.htmlunit.DroneHtmlUnitDriver_ByGraphene
...

Report flaky test

@mposolda
Copy link
Copy Markdown
Contributor

@graziang It should be OK to restore the work on this PR when you have a chance. The related refactoring was already done.

@mposolda mposolda self-assigned this Mar 13, 2026
@graziang
graziang force-pushed the issue-46925 branch 4 times, most recently from 83c94cb to 5c42cb9 Compare March 16, 2026 08:34
@graziang
Copy link
Copy Markdown
Contributor Author

@mposolda Thanks, rebased and integrated the changes.

@VinodAnandan
Copy link
Copy Markdown
Contributor

@graziang Thank you very much for the PR! Could you please add the "[OID4VCI]" prefix to the PR title? Including it will help ensure the PR is properly captured in our tracking search.

@Ogenbertrand Ogenbertrand left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @graziang !
Thanks for this PR, i have some minor request, could you check them!

Closes keycloak#46925

Signed-off-by: Giuseppe Graziano <g.graziano94@gmail.com>
@graziang graziang changed the title Migrate OID4VCJWTIssuerEndpointTest [OID4VCI] Migrate OID4VCJWTIssuerEndpointTest Mar 16, 2026
@mposolda mposolda left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@graziang @Ogenbertrand Thanks for the PR and review!

@mposolda
mposolda merged commit 5db69ae into keycloak:main Mar 16, 2026
84 checks passed

protected ClientScopeRepresentation sdJwtTypeCredentialClientScope;
protected ClientScopeRepresentation jwtTypeCredentialClientScope;
protected ClientScopeRepresentation minimalJwtTypeCredentialClientScope;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These seem to be duplicates of OID4VCIssuerTestBase

protected ClientScopeRepresentation jwtTypeCredentialClientScope;
protected ClientScopeRepresentation minimalJwtTypeCredentialClientScope;

protected CloseableHttpClient httpClient;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this low level httpClient really needed? We have a good OAuth2Client.oid4vci() API that should be used for client side requests.

protected ClientScopeRepresentation minimalJwtTypeCredentialClientScope;

protected CloseableHttpClient httpClient;
protected ClientRepresentation client;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also a duplicate

minimalJwtTypeCredentialClientScope = requireExistingClientScope(minimalJwtTypeCredentialScopeName);
}

protected static OAuth2CodeEntry prepareSessionCode(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAICS, this does need to be static. Generally could you please review all usages of 'static'? Many of those seem to be "bad habits" that were simply carried over from the old test suite.

The most likely reason they were static is because the old tests were serialized by ARQ and ran on the server side. The new tests are client side tests and do not need to be serialized anymore to run "in-container". We can stick to standard junit with injected stuff and managed lifecycle.

}

CredentialScopeRepresentation createCredentialScope(
public static CredentialScopeRepresentation createCredentialScope(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its nice that you moved most of the realm setup to VCTestRealmConfig - this method should move as well.
Again, static usage is like not needed - we don't want calls from VCTestRealmConfig to OID4VCIssuerTestBase (unless there is a good reason that I failed to see)

}

CredentialScopeRepresentation requireExistingCredentialScope(String scopeName) {
return Optional.ofNullable(getExistingCredentialScope(scopeName))
.orElseThrow(() -> new IllegalStateException("No such credential scope: " + scopeName));
}

ProtocolMapperRepresentation getIssuedAtTimeMapper(String subjectProperty, String truncateToTimeUnit, String valueSource) {
public static ProtocolMapperRepresentation getIssuedAtTimeMapper(String subjectProperty, String truncateToTimeUnit, String valueSource) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stuff that is only used for realm setup should live there (no static call needed)
Generally, please review the call hierarchy from VCTestRealmConfig - its good to have it all were it belongs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[OID4VCI] Migrate OID4VCJWTIssuerEndpointTest

5 participants

0