Repository navigation
Migrate url package to new test framework - #48212
Conversation
4866c14 to
ead0338
Compare
|
|
||
| @Test | ||
| @Launch({"start", "--db=dev-file", "--http-enabled=true", "--hostname=htt://localtest.me"}) | ||
| public void testInvalidHostnameUrl(LaunchResult result) { |
There was a problem hiding this comment.
@vmuzikar and others - just a general question on the role of the quarkus integration tests moving forward. Do we even want to keep most of what exists separate from the new test suite? I'd be fine with removing most of our quarkus integration tests in favor of Picocli test cases and the new test suite. Maybe start with converting enough such that we only need a single CI test run, instead of the two we currently have.
There was a problem hiding this comment.
Potentially yes, but not sure it's worth the effort to rewrite it to the new testsuite. We don't see many specific downsides of the current Quarkus testsuite.
There was a problem hiding this comment.
We don't see many specific downsides of the current Quarkus testsuite.
We've had to optimize things several times, and introduce a split into two test runs. If we keep adding to it, we'll need to add a third. Seems better to work towards shifting to unit tests and the general test suite so that we can be less on the hook for optimization / splitting test runs.
There was a problem hiding this comment.
So rather than a question whether we should migrate to the new test framework, it's a question whether we should migrate some of the Quarkus integration tests to unit tests?
There was a problem hiding this comment.
So rather than a question whether we should migrate to the new test framework, it's a question whether we should migrate some of the Quarkus integration tests to unit tests?
That's down to the individual test.
We absolutely need coverage of our scripts - but we have removed command / option specific logic (dealing with --optimized, help, etc.) from kc.sh and kc.bat, so I think we can streamline what we're covering. I'd at least say anything that is marked as DryRun which is not specifically for exercising a script should just be a unit test.
If a test is actually starting the server and is something that is expressable in the new test framework, I would be in favor of migrating it or identifying why it can't.
There was a problem hiding this comment.
@shawkins Can you please create a discussion with the proposal for migrating the Quarkus tests? This is not the correct place to discuss it as it will probably require more thought.
It'd be good to have a summarization of the specific proposal and the expected benefits.
ead0338 to
49ed722
Compare
|
Resolved merge conflicts. |
49ed722 to
5a7f722
Compare
|
I don't think the CI failure is related. I'll just leave it as is, I presume there will be more pushes and merge conflicts over time anyway. |
5a7f722 to
2774a6d
Compare
|
Resolved merge conflicts and addressed refactoring done by Stian (that renaming of builders). |
2774a6d to
72a52e5
Compare
Unreported flaky test detectedIf 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.authz.PolicyEvaluationTest# |
There was a problem hiding this comment.
@michalvavrik Thank you for the PR, LGTM.
| @@ -27,6 +27,8 @@ | |||
| "org.keycloak.tests.session", | |||
| "org.keycloak.tests.tracing", | |||
| "org.keycloak.tests.transactions", | |||
| "org.keycloak.tests.ssl", | |||
There was a problem hiding this comment.
Why are we adding the ssl package here in this PR?
There was a problem hiding this comment.
Why are we adding the ssl package here in this PR?
I was fixing merge conflicts after working on ssl and I probably missed some uncommitted changes. I'll fix it.
|
|
||
| static void assertAdminUrls(SimpleHttp simpleHttp, String serverBaseUrl, String realm, | ||
| String expectedFrontendUrl, String expectedAdminUrl) throws IOException { | ||
| final String adminConsoleUrl = serverBaseUrl + "/admin/" + realm + "/console"; |
There was a problem hiding this comment.
Isn't serverBaseUrl always keycloakUrls.getBase(), hence this parameter is not needed?
There was a problem hiding this comment.
Isn't
serverBaseUrlalwayskeycloakUrls.getBase(), hence this parameter is not needed?
I have switched to keycloakUrls. I hope that is what you meant. We still need to construct the adminConsoleUrl manually as there is more than one realm. I checked and SimpleHttp doesn't seem to have a base url, so we need it. Hope its better now.
|
The added comments are not blocking, let me know if you want to merge as is. |
* Closes: keycloak#47813 * I kept the default `hostname-strict` as setting it makes no difference. It only enforces that a hostname must be provided — when one is set, it has no effect on URL resolution (the new framework uses `start-dev` which defaults to `false`) * I didn't see a way to test "restart with a different options" so I simply used a separate test classes with following mapping: | Old `HostnameV2Test` method | New counterpart | |--------------------------------------------------|--------------------------------------------------------------------------------------------------| | `testFixedFrontendHostname` | `HostnameV2FixedHostnameTest.testMasterRealmFrontendAndBackendUrls` + `testMasterRealmAdminUrls` | | `testFixedFrontendHostnameUrl` | `HostnameV2FixedUrlTest.testFrontendAndBackendUrls` + `testAdminUrls` | | `testFixedFrontendAndAdminHostnameUrl` | `HostnameV2FrontendAndAdminTest.testFrontendAndBackendUrls` + `testAdminUrls` | | `testFixedFrontendHostnameUrlWithDefaultPort` | `HostnameV2DefaultPortTest.testFrontendAndBackendUrls` + `testAdminUrls` | | `testDynamicBackend` | `HostnameV2BackchannelDynamicTest.testFrontendAndBackendUrls` + `testAdminUrls` | | `testDynamicEverything` | `HostnameV2NoHostnameConfiguredTest.testFrontendAndBackendUrls` + `testAdminUrls` | | `testRealmFrontendUrlWithOtherUrlsSet` | `HostnameV2RealmFrontendUrlOverrideTest.testFrontendAndBackendUrls` + `testAdminUrls` | | `testRealmFrontendUrl` | `HostnameV2FixedHostnameTest.testCustomRealmFrontendAndBackendUrls` + `testCustomRealmAdminUrls` | | `testStrictMode` | `HostnameV2DistTest.testServerFailsToStartWithoutHostnameSpecified` (already existed) | | `testStrictModeMustBeDisabledWhenHostnameIsSpecified` (commented out) | Not migrated — validation was relaxed to a log message in `HostnameV2ProviderFactory` (line 61) | | `testInvalidHostnameUrl` | `HostnameV2DistTest.testInvalidHostnameUrl` | | `testInvalidAdminUrl` | `HostnameV2DistTest.testInvalidAdminUrl` | | `testBackchannelDynamicRequiresHostname` | `HostnameV2DistTest.testBackchannelDynamicRequiresHostname` | | `testBackchannelDynamicRequiresFullHostnameUrl` | `HostnameV2DistTest.testBackchannelDynamicRequiresFullHostnameUrl` | Signed-off-by: Michal Vavřík <michal.vavrik@aol.com>
72a52e5 to
fe7aa78
Compare
Unreported flaky test detectedIf 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.authz.PolicyEvaluationTest# |
* Closes: keycloak#47813 * I kept the default `hostname-strict` as setting it makes no difference. It only enforces that a hostname must be provided — when one is set, it has no effect on URL resolution (the new framework uses `start-dev` which defaults to `false`) * I didn't see a way to test "restart with a different options" so I simply used a separate test classes with following mapping: | Old `HostnameV2Test` method | New counterpart | |--------------------------------------------------|--------------------------------------------------------------------------------------------------| | `testFixedFrontendHostname` | `HostnameV2FixedHostnameTest.testMasterRealmFrontendAndBackendUrls` + `testMasterRealmAdminUrls` | | `testFixedFrontendHostnameUrl` | `HostnameV2FixedUrlTest.testFrontendAndBackendUrls` + `testAdminUrls` | | `testFixedFrontendAndAdminHostnameUrl` | `HostnameV2FrontendAndAdminTest.testFrontendAndBackendUrls` + `testAdminUrls` | | `testFixedFrontendHostnameUrlWithDefaultPort` | `HostnameV2DefaultPortTest.testFrontendAndBackendUrls` + `testAdminUrls` | | `testDynamicBackend` | `HostnameV2BackchannelDynamicTest.testFrontendAndBackendUrls` + `testAdminUrls` | | `testDynamicEverything` | `HostnameV2NoHostnameConfiguredTest.testFrontendAndBackendUrls` + `testAdminUrls` | | `testRealmFrontendUrlWithOtherUrlsSet` | `HostnameV2RealmFrontendUrlOverrideTest.testFrontendAndBackendUrls` + `testAdminUrls` | | `testRealmFrontendUrl` | `HostnameV2FixedHostnameTest.testCustomRealmFrontendAndBackendUrls` + `testCustomRealmAdminUrls` | | `testStrictMode` | `HostnameV2DistTest.testServerFailsToStartWithoutHostnameSpecified` (already existed) | | `testStrictModeMustBeDisabledWhenHostnameIsSpecified` (commented out) | Not migrated — validation was relaxed to a log message in `HostnameV2ProviderFactory` (line 61) | | `testInvalidHostnameUrl` | `HostnameV2DistTest.testInvalidHostnameUrl` | | `testInvalidAdminUrl` | `HostnameV2DistTest.testInvalidAdminUrl` | | `testBackchannelDynamicRequiresHostname` | `HostnameV2DistTest.testBackchannelDynamicRequiresHostname` | | `testBackchannelDynamicRequiresFullHostnameUrl` | `HostnameV2DistTest.testBackchannelDynamicRequiresFullHostnameUrl` | Signed-off-by: Michal Vavřík <michal.vavrik@aol.com>
hostname-strictas setting it makes no difference. It only enforces that a hostname must be provided — when one is set, it has no effect on URL resolution (the new framework usesstart-devwhich defaults tofalse)HostnameV2TestmethodtestFixedFrontendHostnameHostnameV2FixedHostnameTest.testMasterRealmFrontendAndBackendUrls+testMasterRealmAdminUrlstestFixedFrontendHostnameUrlHostnameV2FixedUrlTest.testFrontendAndBackendUrls+testAdminUrlstestFixedFrontendAndAdminHostnameUrlHostnameV2FrontendAndAdminTest.testFrontendAndBackendUrls+testAdminUrlstestFixedFrontendHostnameUrlWithDefaultPortHostnameV2DefaultPortTest.testFrontendAndBackendUrls+testAdminUrlstestDynamicBackendHostnameV2BackchannelDynamicTest.testFrontendAndBackendUrls+testAdminUrlstestDynamicEverythingHostnameV2NoHostnameConfiguredTest.testFrontendAndBackendUrls+testAdminUrlstestRealmFrontendUrlWithOtherUrlsSetHostnameV2RealmFrontendUrlOverrideTest.testFrontendAndBackendUrls+testAdminUrlstestRealmFrontendUrlHostnameV2FixedHostnameTest.testCustomRealmFrontendAndBackendUrls+testCustomRealmAdminUrlstestStrictModeHostnameV2DistTest.testServerFailsToStartWithoutHostnameSpecified(already existed)testStrictModeMustBeDisabledWhenHostnameIsSpecified(commented out)HostnameV2ProviderFactory(line 61)testInvalidHostnameUrlHostnameV2DistTest.testInvalidHostnameUrltestInvalidAdminUrlHostnameV2DistTest.testInvalidAdminUrltestBackchannelDynamicRequiresHostnameHostnameV2DistTest.testBackchannelDynamicRequiresHostnametestBackchannelDynamicRequiresFullHostnameUrlHostnameV2DistTest.testBackchannelDynamicRequiresFullHostnameUrl