Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@miquelsi
Copy link
Contributor

Closes #31311

Copy link
Contributor

@lhanusov lhanusov left a comment

Choose a reason for hiding this comment

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

@miquelsi good job, LGTM
I agree with Stian, please consider Junit4 workaround and moving the license to test base directory.

Copy link
Contributor

@stianst stianst Jul 17, 2024

Choose a reason for hiding this comment

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

MySQL worked for me, but took forever (nearly 3 min to run a single test) and there was a bunch of warnings (we can fix this in a follow-up, but should create an issue for it):

2024-07-17 10:16:32,295 INFO  [tc.mysql:latest] (main) Image mysql:latest pull took PT10.421908536S
2024-07-17 10:16:32,322 INFO  [tc.mysql:latest] (main) Creating container for image: mysql:latest
2024-07-17 10:16:34,359 INFO  [tc.mysql:latest] (main) Container mysql:latest is starting: 6ce1dbecb0212d167b28719fe0d4d5994e511ec23443c92d90617e64067b506f
2024-07-17 10:16:34,665 INFO  [tc.mysql:latest] (main) Waiting for database connection to become available at jdbc:mysql://localhost:45175/keycloak using query 'SELECT 1'
2024-07-17 10:16:52,280 INFO  [tc.mysql:latest] (main) Container mysql:latest started in PT19.957927139S
2024-07-17 10:16:52,280 INFO  [tc.mysql:latest] (main) Container is started (JDBC URL: jdbc:mysql://localhost:45175/keycloak)
2024-07-17 10:16:52,280 TRACE [org.keycloak.test.framework.injection.Registry] (main) Injecting un-configured dependency MySQLDatabaseSupplier into EmbeddedKeycloakTestServerSupplier
2024-07-17 10:16:54,686 INFO  [org.jboss.threads] (main) JBoss Threads version 3.5.1.Final
2024-07-17 10:17:01,020 INFO  [org.keycloak.quarkus.runtime.storage.legacy.infinispan.CacheManagerFactory] (Quarkus Main Thread) Starting Infinispan embedded cache manager
2024-07-17 10:17:01,446 INFO  [org.infinispan.CONTAINER] (ForkJoinPool.commonPool-worker-15) ISPN000556: Starting user marshaller 'org.infinispan.commons.marshall.ImmutableProtoStreamMarshaller'
2024-07-17 10:17:02,034 INFO  [org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory] (Quarkus Main Thread) Node name: node_210327, Site name: null
2024-07-17 10:17:02,038 INFO  [org.keycloak.broker.provider.AbstractIdentityProviderMapper] (Quarkus Main Thread) Registering class org.keycloak.broker.provider.mappersync.ConfigSyncEventListener
2024-07-17 10:17:02,634 WARN  [liquibase.changelog.DatabaseChangeLog] (Quarkus Main Thread) Due to mysql SQL limitations, modifyDataType will lose primary key/autoincrement/not null/comment settings explicitly redefined in the change. Use <sql> or <modifySql> to re-specify all configuration if this is the case
2024-07-17 10:17:02,634 WARN  [liquibase.changelog.DatabaseChangeLog] (Quarkus Main Thread) Due to mysql SQL limitations, setNullable will lose primary key/autoincrement/not null/comment settings explicitly redefined in the change. Use <sql> or <modifySql> to re-specify all configuration if this is the case
2024-07-17 10:17:02,842 INFO  [org.keycloak.quarkus.runtime.storage.legacy.liquibase.QuarkusJpaUpdaterProvider] (Quarkus Main Thread) Initializing database schema. Using changelog META-INF/jpa-changelog-master.xml
2024-07-17 10:17:03,176 WARN  [liquibase.changelog.DatabaseChangeLog] (Quarkus Main Thread) Due to mysql SQL limitations, modifyDataType will lose primary key/autoincrement/not null/comment settings explicitly redefined in the change. Use <sql> or <modifySql> to re-specify all configuration if this is the case
2024-07-17 10:17:03,177 WARN  [liquibase.changelog.DatabaseChangeLog] (Quarkus Main Thread) Due to mysql SQL limitations, setNullable will lose primary key/autoincrement/not null/comment settings explicitly redefined in the change. Use <sql> or <modifySql> to re-specify all configuration if this is the case
2024-07-17 10:17:03,221 WARN  [liquibase.changelog.DatabaseChangeLog] (Quarkus Main Thread) Due to mysql SQL limitations, modifyDataType will lose primary key/autoincrement/not null/comment settings explicitly redefined in the change. Use <sql> or <modifySql> to re-specify all configuration if this is the case
2024-07-17 10:17:03,221 WARN  [liquibase.changelog.DatabaseChangeLog] (Quarkus Main Thread) Due to mysql SQL limitations, setNullable will lose primary key/autoincrement/not null/comment settings explicitly redefined in the change. Use <sql> or <modifySql> to re-specify all configuration if this is the case
2024-07-17 10:18:13,648 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:13,914 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:14,219 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:14,669 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:14,948 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:15,347 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:15,632 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:15,986 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:16,558 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:16,782 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:17,266 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:17,534 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:17,849 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:18,120 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:18,493 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:18,854 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:19,221 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:18:50,176 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) NATIONAL/NCHAR/NVARCHAR implies the character set UTF8MB3, which will be replaced by UTF8MB4 in a future release. Please consider using CHAR(x) CHARACTER SET UTF8MB4 in order to be unambiguous.
2024-07-17 10:19:00,028 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2024-07-17 10:19:00,199 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2024-07-17 10:19:00,839 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2024-07-17 10:19:00,970 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2024-07-17 10:19:01,161 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2024-07-17 10:19:01,644 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2024-07-17 10:19:01,940 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2024-07-17 10:19:03,007 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2024-07-17 10:19:03,145 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2024-07-17 10:19:03,221 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2024-07-17 10:19:03,374 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2024-07-17 10:19:03,449 WARN  [liquibase.executor.jvm.JdbcExecutor] (Quarkus Main Thread) 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.

UPDATE SUMMARY
Run:                        137
Previously run:               0
Filtered out:                 0
-------------------------------
Total change sets:          137

2024-07-17 10:19:06,457 INFO  [org.keycloak.services] (Quarkus Main Thread) KC-SERVICES0050: Initializing master realm
2024-07-17 10:19:07,546 INFO  [org.keycloak.services] (Quarkus Main Thread) KC-SERVICES0077: Created temporary admin user with username admin
2024-07-17 10:19:07,658 INFO  [io.quarkus] (Quarkus Main Thread) Keycloak 1 on JVM (powered by Quarkus 3.8.5) started in 128.400s. Listening on: http://0.0.0.0:8080. Management interface listening on http://0.0.0.0:9001.
2024-07-17 10:19:07,659 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. 

Copy link
Contributor

Choose a reason for hiding this comment

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

Same problems as with MySQL. Long time to start and warnings in the log.

<artifactId>mssqlserver</artifactId>
</dependency>
<!-- JDBC Drivers -->
<dependency>
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move to test-poc/base as the license for this driver is a bit problematic, so we shouldn't add it to the framework.

Copy link
Contributor

@stianst stianst left a comment

Choose a reason for hiding this comment

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

LGTM, two quick things remaining:

  • Move com.microsoft.sqlserver:mssql-jdbc dependency to test-poc/base/pom.xml - the license for this means we shouldn't distribute it really, and should be something users install themselves when using the framework
  • We should create an issue for the problems with MySQL and MariaDB, as currently these are pretty much unusable

@sschu
Copy link
Contributor

sschu commented Jul 17, 2024

One remark about MS SQL: the test container uses READ_COMMITTED as default isolation level. Azure SQL uses READ_COMMITTED_SNAPSHOT as default isolation level and there are some subtle differences between the two. Since we run on Azure, we change the isolation level in our testcontainers for MS SQL to READ_COMMITTED_SNAPSHOT. I am not sure what is used more often, MS SQL Server or Azure SQL but depending on our assumptions we might a) leave it as it is b) switch to the Azure SQL default c) use both options.

@miquelsi
Copy link
Contributor Author

Draft follow up issue for MariaDB and MySQL slow startup times: https://github.com/orgs/keycloak/projects/42/views/1?pane=issue&itemId=71240039

@stianst stianst merged commit def6ea3 into keycloak:main Jul 17, 2024
stianst pushed a commit to stianst/keycloak that referenced this pull request Jul 25, 2024
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.

Testsuite PoC - Supply test databases provisioned with Testcontainers

4 participants