How to Run Unit Tests
Basically, we can perform unit tests as follows:
$ mvn clean install
Specifying Session Variables
You can add certain session variables to running unit tests as the following. You can see all supported session variables by executing \help set in tsql.
$ mvn clean install -D[SESSION_VAR_NAME]=[SESSION_VAR_VALUE]
Test of Byte Code Generation
Tajo uses java byte code generation on the fly. Currently, this work is experimental and optional feature. So, in order to test it, you should add one parameter to mvn as follows:
$ mvn clean install -DCODEGEN=true
TestCatalog
TestCatalog can perform unit tests for various catalog drivers. In order to specify the driver to be tested, add the following JVM options.
JVM Options for MySQLStore:
-Dtajo.catalog.store.class=org.apache.tajo.catalog.store.MySQLStore -Dtajo.catalog.connection.id=tajo -Dtajo.catalog.connection.password=password -Dtajo.catalog.uri=jdbc:mysql://localhost:3306/tajo
or
JVM Options for PostgreSQLStore
-Dtajo.catalog.store.class=org.apache.tajo.catalog.store.PostgreSQLStore -Dtajo.catalog.connection.id=hyunsik -Dtajo.catalog.connection.password=password -Dtajo.catalog.uri=jdbc:postgresql://localhost/hyunsik
Using HiveCatalogStore for integration unit tests
Tajo includes lots of query tests (call integration test) in order to verify the various query cases and the integrity of the results.
The integration test uses one of catalog store driver, and in default, it uses DerbyStore. But, you can change the catalog store as follows:
mvn clean test -Dtajo.catalog.store.class=org.apache.tajo.catalog.store.HiveCatalogStore
Printing Stacktrace of All Errors
Basically, Tajo ignores the error message caused by TajoException and TajoRuntimeException because those exceptions are passed into TajoClient. Nevertheless, you may want to see them because of debugging. If you want it, you just add the VM option -Dtajo.debug=true to your maven or IDE as follows:
mvn install -Dtajo.debug=true