This repository defines a standardized interface for accessing an Exasol database for testing.
That allows you to write tests where you can switch the test-backend. For example you can switch between an Exasol cluster in the cloud or a local docker-db.
In addition, it contains implementations for this interface for the following test-backends:
class MyTest {
private static final ExasolTestSetup EXASOL = new ExasolTestSetupFactory("cloudSetup/generated/testConfig.json").getTestSetup();
@Test
void test() {
var sqlConnection = EXASOL.createConnection();
//...
}
@AfterAll
static void afterAll() {
EXASOL.close();
}
}
The ExasolTestSetupFactory
in the example returns a test setup for an AWS cluster if the specified config file (cloudSetup/generated/testConfig.json
) exists. Otherwise, it returns a test setup based on a local running Exasol-Testcontainer.
Usually you generate the testConfig.json
using the Terraform module terraform-aws-exasol-test-setup >= 1.0.0. For details see the guide for setting up a project with cloud resources.
You can also select a specific test-setup in code. For that simply replace new ExasolTestSetupFactory().getTestSetup()
by new ExasolTestcontainerTestSetup()
.
To change the Exasol Docker DB version being used you can define the com.exasol.dockerdb.image
system property, e.g: mvn verify -Dcom.exasol.dockerdb.image=${{ matrix.docker_db_version }}
.