By default unit tests use MySQL database but PostgreSQL, Oracle and SQL Server databases are supported as well. Set MONDRIAN_DRIVER environment variable to “mysql” (default), “postgresql”, “oracle”, “sqlserver” (Microsoft JDBC), “vertica”, “snowflake”, “clickhouse”, “mariadb” to specify database driver that should be used.
If using a MySQL, PostgreSQL or MS SQL Server database then create database user mondrian_test with password mondrian_test, create database mondrian_test and grant full access to this database for mondrian_test user. By default it is assumed that database is located on localhost (can be overridden with DATABASE_HOST environment variable).
If using Oracle database then create database user mondrian_test with password mondrian_test. By default it is assumed that database orcl is located on localhost (can be overridden with DATABASE_NAME and DATABASE_HOST environment variables).
if using Vertica then specify environment variables VERTICA_DATABASE_HOST, VERTICA_DATABASE_NAME, VERTICA_DATABASE_USER, VERTICA_DATABASE_PASSWORD and create the “mondrian_test” schema.
If using Snowflake then create MONDRIAN_TEST user, database and schema and specify environment variables SNOWFLAKE_DATABASE_HOST and SNOWFLAKE_DATABASE_PASSWORD.
If using ClickHouse then create database user mondrian_test with password mondrian_test, create database mondrian_test and grant full access to this database for mondrian_test user. Specify environment variable CLICKHOUSE_DATABASE_HOST. Download the latest clickhouse-jdbc-*-shaded.jar and copy to spec/support/jars.
If using MariaDB ColumnStore then create database user mondrian_test with password mondrian_test, create database mondrian_test and grant full access to this database for mondrian_test user. Specify environment variable MARIADB_DATABASE_HOST. Download mariadb-java-client-*.jar and copy to spec/support/jars.
See spec/spec_helper.rb for details of default connection parameters and how to override them.
Install necessary gems with
bundle install
Create tables with test data using
rake db:create_data
or specify which database driver to use
rake db:create_data MONDRIAN_DRIVER=mysql rake db:create_data MONDRIAN_DRIVER=postgresql rake db:create_data MONDRIAN_DRIVER=oracle rake db:create_data MONDRIAN_DRIVER=sqlserver
In case of Vertica, Snowflake, ClickHouse, MariaDB ColumnStore at first create test data in MySQL and export test data into CSV files and then import CSV files into the analytical database (because inserting individual records into these analytical databases is very slow):
rake db:export_data MONDRIAN_DRIVER=mysql rake db:create_data MONDRIAN_DRIVER=vertica rake db:create_data MONDRIAN_DRIVER=snowflake rake db:create_data MONDRIAN_DRIVER=clickhouse rake db:create_data MONDRIAN_DRIVER=mariadb
Run tests with
rake spec
or specify which database driver to use
rake spec MONDRIAN_DRIVER=mysql rake spec MONDRIAN_DRIVER=postgresql rake spec MONDRIAN_DRIVER=oracle rake spec MONDRIAN_DRIVER=sqlserver rake spec MONDRIAN_DRIVER=vertica rake spec MONDRIAN_DRIVER=snowflake rake spec MONDRIAN_DRIVER=clickhouse rake spec MONDRIAN_DRIVER=mariadb
or also alternatively with
rake spec:mysql rake spec:postgresql rake spec:oracle rake spec:sqlserver rake spec:vertica rake spec:snowflake rake spec:clickhouse rake spec:mariadb
You can also run all tests on all standard databases (mysql jdbc_mysql postgresql oracle sqlserver) with
rake spec:all
It is recommended to use RVM (rvm.beginrescueend.com) to run tests with different JRuby implementations. mondrian-olap is being tested with latest versions of JRuby 9.3 and 9.4 on JVM 8, 11, and 17.