-
Notifications
You must be signed in to change notification settings - Fork 7.4k
[KEYCLOAK-10735] implement search and filter for count endpoint #6140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
looks like the testsuite that runs on travis isn't really stable. ran it twice and failed on 4 different tasks but also succeeded on every task at least once 😄 |
Thanks for the PR. Can you please remove formatting changes as it is making it significantly more work to review the PR? |
Hi @stianst I just noticed how many auto format changes there were 😄 the update should be easier to review. we tried to do the /count endpoint analogous to the users endpoint |
4b02825
to
d6bd395
Compare
d6bd395
to
2a3acc9
Compare
2a3acc9
to
df660fd
Compare
Hi @stianst I rebased the PR and the tests keep on failing but it doesn't seem to be related to the changes made in this PR. Can someone have a look at this PR? |
@unly crossdc-server tests are screwed up so you can ignore those. Will try to get someone to review this asap, but we do have a bit of a backlog of reviews to get through, so please bear with us. |
@vramik Could you please have a look at this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@unly thank you very much for the PR. Overall it looks good to me, there can be used assertThat
instread of assertEquals
and assertTrue
in UsersTest
. assertThat
has much more readable output.
There are SQLExceptions when using the new endpoints:
MariaDB/MySQL
...
Caused by: java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB/MySQL server version for the right syntax to use near '))' at line 1
Query is: select count(usergroupm0_.USER_ID) as col_0_0_ from USER_GROUP_MEMBERSHIP usergroupm0_ cross join USER_ENTITY userentity1_ where usergroupm0_.USER_ID=userentity1_.ID and userentity1_.REALM_ID=? and (userentity1_.SERVICE_ACCOUNT_CLIENT_LINK is null) and (lower(userentity1_.USERNAME) like ? or lower(concat(userentity1_.FIRST_NAME, ' ', userentity1_.LAST_NAME)) like ? or userentity1_.EMAIL like ?) and (usergroupm0_.GROUP_ID in ()), parameters ['admin-client-test','%user%','%user%','%user%']
MSSQL
...
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near ')'.
Postgresql
...
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near ")"
Oracle
...
Caused by: Error : 936, Position : 223, Sql = select count(usergroupm0_.USER_ID) as col_0_0_ from USER_GROUP_MEMBERSHIP usergroupm0_ cross join USER_ENTITY userentity1_ where usergroupm0_.USER_ID=userentity1_.ID and userentity1_.REALM_ID=:1 and (usergroupm0_.GROUP_ID in ()), OriginalSql = select count(usergroupm0_.USER_ID) as col_0_0_ from USER_GROUP_MEMBERSHIP usergroupm0_ cross join USER_ENTITY userentity1_ where usergroupm0_.USER_ID=userentity1_.ID and userentity1_.REALM_ID=? and (usergroupm0_.GROUP_ID in ()), Error Msg = ORA-00936: missing expression
hey @vramik I updated the PR but it's been a while since I originally raised it and therefore I'm not a 100% sure. Can you please have another look? Also how can I efficiently test it with all those different implementations? So far I mostly tested the unit tests |
@unly thanks for the update and for the patience for this PR. Unfortunately I still get the SQLExceptions. There is link to https://github.com/keycloak/keycloak/blob/master/docs/tests-db.md where you can find useful information about DB testing. Especially in section "Using built-in profiles to run database tests using docker containers" Following command should show the issue in your environment with MySQL.
Let me know if you need anything. Thanks |
Hey @vramik I tried to run those tests but nothing seems to work for me. First, I tried https://github.com/keycloak/keycloak/blob/master/docs/tests-db.md#mysql to get started. But all I got is an error in When I run |
@unly Please note you should have keycloak-server-dist built. When I perform following steps I get the issue:
Together it takes ~10 minutes in my environment.
|
Hi @vramik thank you so much for the exact commands. This is a life saver. Now I was able to reproduce the errors for MySql. Based on this I updated the commit and ran the tests again for MySql and Postgres and it succeeded on both databases. Can you have another look? |
Another thing I was wondering is what this about the complicated commands to run tests. Often I just rely on travis to run tests for me as I can't make them run locally. When I check out a repo from GitHub I would expect |
@unly thank you for the fix, I can confirm it behaves correctly now. Regarding complicated testsuite: You're right, it's a complicated thing, especially for people which are not familiar with it. We're not testing everything when you run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hmlnarik it's ready to be merged imo.
https://keycloak-jenkins.com/job/universal-test-pipeline-server/1230/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Travis errors are irrelevant |
This PR relates to https://issues.jboss.org/browse/KEYCLOAK-10735