DataONEorg / bookkeeper

Bookkeeper keeps track of DataONE product subscriptions and quotas for researchers using the extended services.
Other
1 stars 2 forks source link

change tests to use Testcontainers #105

Closed mbjones closed 3 months ago

mbjones commented 3 months ago

The current tests use an embedded postgres container class that is no longer supported and does not work on modern architectures, including Apple silicon. Switch to using testcontainers.com which works across these platforms.

mbjones commented 3 months ago

Changed in sha 4ebdfef . Completed.

mbjones commented 2 months ago

Testcontainers works well, but has difficulty using Rancher Desktop on M1 and other apple silicon macs. There is a workaround, which is to set an environment variable that helps get connected to the Rancher VM. The RD workaround sets an environment variable by running:

$ export TESTCONTAINERS_HOST_OVERRIDE=$(rdctl shell ip a show rd0 | awk '/inet / {sub("/.*",""); print $2}')

Then you can run the tests successfully. Within VS Code, setting this environment variable can be accomplished by modifying the settings.json file for vscode to have the right env variable set to the IP address of the VM host (see command above to determine that IP address), like so:

{
    "java.test.config": {
        "env": {"TESTCONTAINERS_HOST_OVERRIDE": "192.168.40.34"}
    }
}