From f8253a12524ec97ee2b8e07d119126cbd343ed22 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Fri, 26 Nov 2021 15:32:11 +0100 Subject: [PATCH] add ebean-test properties for various containers and adjusted documentation --- .../testconfig/ebean-clickhouse.properties | 5 + .../testconfig/ebean-cockroach.properties | 4 + ebean-test/testconfig/ebean-db2.properties | 4 + ebean-test/testconfig/ebean-h2.properties | 3 + .../testconfig/ebean-mariadb-10.3.properties | 8 + .../testconfig/ebean-mariadb.properties | 5 + ebean-test/testconfig/ebean-mysql.properties | 6 + ebean-test/testconfig/ebean-nuodb.properties | 3 + ebean-test/testconfig/ebean-oracle.properties | 3 + .../testconfig/ebean-postgres.properties | 3 + ebean-test/testconfig/ebean-sqlite.properties | 4 + .../testconfig/ebean-sqlserver.properties | 6 + .../testconfig/ebean-sqlserver17.properties | 7 + howto-test.md | 149 ++---------------- 14 files changed, 74 insertions(+), 136 deletions(-) create mode 100644 ebean-test/testconfig/ebean-clickhouse.properties create mode 100644 ebean-test/testconfig/ebean-cockroach.properties create mode 100644 ebean-test/testconfig/ebean-db2.properties create mode 100644 ebean-test/testconfig/ebean-h2.properties create mode 100644 ebean-test/testconfig/ebean-mariadb-10.3.properties create mode 100644 ebean-test/testconfig/ebean-mariadb.properties create mode 100644 ebean-test/testconfig/ebean-mysql.properties create mode 100644 ebean-test/testconfig/ebean-nuodb.properties create mode 100644 ebean-test/testconfig/ebean-oracle.properties create mode 100644 ebean-test/testconfig/ebean-postgres.properties create mode 100644 ebean-test/testconfig/ebean-sqlite.properties create mode 100644 ebean-test/testconfig/ebean-sqlserver.properties create mode 100644 ebean-test/testconfig/ebean-sqlserver17.properties diff --git a/ebean-test/testconfig/ebean-clickhouse.properties b/ebean-test/testconfig/ebean-clickhouse.properties new file mode 100644 index 000000000..46ba2256e --- /dev/null +++ b/ebean-test/testconfig/ebean-clickhouse.properties @@ -0,0 +1,5 @@ +ebean.test.platform=clickhouse +ebean.test.dbName=clickhouse +datasource.default=clickhouse +datasource.clickhouse.autocommit=true + diff --git a/ebean-test/testconfig/ebean-cockroach.properties b/ebean-test/testconfig/ebean-cockroach.properties new file mode 100644 index 000000000..2604e7dcf --- /dev/null +++ b/ebean-test/testconfig/ebean-cockroach.properties @@ -0,0 +1,4 @@ +ebean.test.platform=cockroach +ebean.test.dbName=unit +datasource.default=cockroach + diff --git a/ebean-test/testconfig/ebean-db2.properties b/ebean-test/testconfig/ebean-db2.properties new file mode 100644 index 000000000..2aa2944dd --- /dev/null +++ b/ebean-test/testconfig/ebean-db2.properties @@ -0,0 +1,4 @@ +ebean.test.platform=db2 +ebean.test.dbName=unit +ebean.test.dbPassword=unit +datasource.default=db2-11 diff --git a/ebean-test/testconfig/ebean-h2.properties b/ebean-test/testconfig/ebean-h2.properties new file mode 100644 index 000000000..9d0f47268 --- /dev/null +++ b/ebean-test/testconfig/ebean-h2.properties @@ -0,0 +1,3 @@ +ebean.test.platform=h2 +datasource.default=h2-local +ebean.test.dbName=test \ No newline at end of file diff --git a/ebean-test/testconfig/ebean-mariadb-10.3.properties b/ebean-test/testconfig/ebean-mariadb-10.3.properties new file mode 100644 index 000000000..c7ef279e4 --- /dev/null +++ b/ebean-test/testconfig/ebean-mariadb-10.3.properties @@ -0,0 +1,8 @@ +# This starts an alternative mariadb version on port 7306 +ebean.test.platform=mariadb +ebean.test.dbName=test_ebean +ebean.test.dbPassword=unit +ebean.test.mariadb.version=10.3 +ebean.test.mariadb.containerName=ut_mariadb-10-3 +ebean.test.sqlserver.port = 7306 +datasource.default=mariadb-103 diff --git a/ebean-test/testconfig/ebean-mariadb.properties b/ebean-test/testconfig/ebean-mariadb.properties new file mode 100644 index 000000000..165032895 --- /dev/null +++ b/ebean-test/testconfig/ebean-mariadb.properties @@ -0,0 +1,5 @@ +ebean.test.platform=mariadb +ebean.test.dbName=test_ebean +ebean.test.mariadb.version=10.6 +ebean.test.mariadb.containerName=ut_mariadb-10-6 +datasource.default=mariadb-106 diff --git a/ebean-test/testconfig/ebean-mysql.properties b/ebean-test/testconfig/ebean-mysql.properties new file mode 100644 index 000000000..dfd960fd2 --- /dev/null +++ b/ebean-test/testconfig/ebean-mysql.properties @@ -0,0 +1,6 @@ +# this starts a mysql instance on port 13306 +ebean.test.platform=mysql +ebean.test.dbName=test_ebean +# note: do not conflict with mariadb port +ebean.test.sqlserver.port = 13306 +datasource.default=mysql-docker diff --git a/ebean-test/testconfig/ebean-nuodb.properties b/ebean-test/testconfig/ebean-nuodb.properties new file mode 100644 index 000000000..9bc26267b --- /dev/null +++ b/ebean-test/testconfig/ebean-nuodb.properties @@ -0,0 +1,3 @@ +ebean.test.platform=nuodb +ebean.test.dbName=testdb +ebean.test.nuodb.version=latest \ No newline at end of file diff --git a/ebean-test/testconfig/ebean-oracle.properties b/ebean-test/testconfig/ebean-oracle.properties new file mode 100644 index 000000000..e9d4bf55b --- /dev/null +++ b/ebean-test/testconfig/ebean-oracle.properties @@ -0,0 +1,3 @@ +ebean.test.platform=oracle +ebean.test.dbName=oracle +datasource.default=oracle-docker \ No newline at end of file diff --git a/ebean-test/testconfig/ebean-postgres.properties b/ebean-test/testconfig/ebean-postgres.properties new file mode 100644 index 000000000..09f2dc676 --- /dev/null +++ b/ebean-test/testconfig/ebean-postgres.properties @@ -0,0 +1,3 @@ +ebean.test.platform=postgres +datasource.default=postgres +ebean.test.dbName=unit diff --git a/ebean-test/testconfig/ebean-sqlite.properties b/ebean-test/testconfig/ebean-sqlite.properties new file mode 100644 index 000000000..a59835972 --- /dev/null +++ b/ebean-test/testconfig/ebean-sqlite.properties @@ -0,0 +1,4 @@ +ebean.test.platform=sqlite +datasource.default=sqlite-local +ebean.test.dbName=test.sqlite +ebean.autoReadOnlyDataSource=false \ No newline at end of file diff --git a/ebean-test/testconfig/ebean-sqlserver.properties b/ebean-test/testconfig/ebean-sqlserver.properties new file mode 100644 index 000000000..f754250af --- /dev/null +++ b/ebean-test/testconfig/ebean-sqlserver.properties @@ -0,0 +1,6 @@ +ebean.test.platform=sqlserver +ebean.test.dbName=test_ebean +ebean.test.sqlserver.version=2019-latest +ebean.test.sqlserver.containerName=ut_sqlserver2019 +datasource.default=sqlserver2019 +ebean.sqlserver2019.databasePlatformName=sqlserver17 \ No newline at end of file diff --git a/ebean-test/testconfig/ebean-sqlserver17.properties b/ebean-test/testconfig/ebean-sqlserver17.properties new file mode 100644 index 000000000..6da4dacc3 --- /dev/null +++ b/ebean-test/testconfig/ebean-sqlserver17.properties @@ -0,0 +1,7 @@ +ebean.test.platform=sqlserver +ebean.test.dbName=test_ebean +ebean.test.sqlserver.version=2017-latest +ebean.test.sqlserver.containerName=ut_sqlserver2017 +ebean.test.sqlserver.port=1434 +datasource.default=sqlserver2017 +ebean.sqlserver2017.databasePlatformName=sqlserver17 \ No newline at end of file diff --git a/howto-test.md b/howto-test.md index ed159cac2..2913b24a9 100644 --- a/howto-test.md +++ b/howto-test.md @@ -24,145 +24,22 @@ your run configuration: Platform Tests ============== -By default, the `h2` platform is used. To test a different platform, add -`-Ddatasource.default=xxx` to your maven command or JVM arguments. - -'h2' platform -------------- - -Reqires no setup - -run: `mvn clean test` - -Current status: PASS -Tests run: 1986, Failures: 0, Errors: 0, Skipped: 16 - -'pg' platform -------------- - -Reqirements -- a locally installed PostgreSQL server with PostGis. -- Create a user "unit" with password "unit" and a database "unit" -- Give the user all permissions to that db - -run: `mvn clean test -Ddatasource.default=pg` - -Current status: PASS -Tests run: 2166, Failures: 0, Errors: 0, Skipped: 25 +By default, the `h2` platform is used. To test a different platform, you can change the +`datasource.default` in the `ebean.properties` file. +Docker +------ +Ebean 12 provides preconfigured docker containers now. To start a docker container, +you can use the starters in `src/test/java/main` or specify one of the starter +properties in the `testconfig` directory with `-Dprops.file=testconfig/ebean-XXX.properties` -'mysql' platform -------------- +Note: You will have to install docker on your system. +- For debian, you can use `apt install docker.io` +- For windows, install docker for windows https://docs.docker.com/desktop/windows/install/ -Reqirements -- a locally installed MySQL server. -- Create a user "unit" with password "unit" and a database "unit" -- Give the user all permissions to that db - -run: `mvn clean test -Ddatasource.default=mysql` - -Current status: PASS -Tests run: 2166, Failures: 0, Errors: 0, Skipped: 33 - - - -'sqlserver' platform --------------------- - -Reqires an installed sqlserver - e.g. https://hub.docker.com/r/microsoft/mssql-server-linux/ - -- Create a user "ebean" with password "ebean" and a database "ebean_unittest" -- Adjust the connection string and/or username in ebean.properties - -run: `mvn clean test -Ddatasource.default=mssql` - -Current status: PASS -Tests run: 2166, Failures: 0, Errors: 0, Skipped: 39 - - - -'oracle' platform ------------------ - -Reqires a locally installed Oracle server. -- Create a user "unit" with password "unit" with all permissions -- The test wirtes directly to the "xe" SID - so do not use a productive server! -- As the Oracle JDBC driver is only available on an oracle repository, - you need a special maven setup as described [here](http://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9010) - -run: `mvn clean test -Ddatasource.default=ora -Poracle` - -Current status: FAIL -Tests run: 1986, Failures: 17, Errors: 34, Skipped: 16 - - - -'db2' platform --------------- - -Reqires a locally installed DB2 Express-C server. -- Create a user "unit" with password "unit" with all permissions -- Install the db2jcc4 driver (see pom.xml) - -run: `mvn clean test -Ddatasource.default=db2 -Pdb2` - -Current status: FAIL -Tests run: 2166, Failures: 29, Errors: 58, Skipped: 30 - - -'sqlite' platform ------------------ - -Reqires no setup - -run: `mvn clean test -Ddatasource.default=sqlite` - -Current status: FAIL -Tests run: 1986, Failures: 24, Errors: 86, Skipped: 16 - -After some time, the db locks up, every test takes 3 seconds and fails with -"the database file is locked" - - - -'hsqldb' platform ------------------ - -Reqires no setup - -run: `mvn clean test -Ddatasource.default=hsqldb` - -Current status: FAIL -Tests run: 1980, Failures: 3, Errors: 657, Skipped: 16 - - -@Rob FYI -The problem is https://sourceforge.net/p/hsqldb/bugs/1364/ -In `InsertHandler.getPstmt` the `meta.getIdentityDbColumns()` contains -'id' in lowercase. Changing that to uppercase gives me this result: -`Tests run: 1986, Failures: 2, Errors: 18, Skipped: 16` -(as quick hack I added temporary a toUpperCase to BindableIdScalar.getIdentityColumn) - - -'sqlanywhere' platform ----------------------- - -TODO: not yet tested - - - -'hana' platform --------------------- - -Requires an installed SAP HANA server - e.g. https://store.docker.com/images/sap-hana-express-edition - -- Create a user `EBEAN_TEST` with password `Eb3an_test` in the tenant database `HXE` -- Adjust the connection string and/or username in `ebean.properties` - -run: `mvn clean test -Ddatasource.default=hana` - -Current status: PASS -Tests run: 2486, Failures: 0, Errors: 0, Skipped: 84 +Maven +----- +Use the `-Dprops.file` parameter to start the test cases for a certain platform.