To set up VSCode to run the tests locally, follow these steps:
-
Create a
.vscodedirectory in the root of your project if it doesn't already exist. -
Inside the
.vscodedirectory, create asettings.jsonfile. -
Add the following configuration to the
settings.jsonfile:{ "go.testTimeout": "300s", "go.testEnvVars": { "TF_ACC": "1" } }
This configuration will enable verbose test output, set a test timeout of 30 seconds, run tests on save, and set the necessary environment variables for acceptance tests.
Add INCUS_REMOTE to go.testEnvVars to use a different Incus Remote instead of local.
{
"go.testTimeout": "300s",
"go.testEnvVars": {
"TF_ACC": "1",
"INCUS_REMOTE": "incus-dev"
}
}The easiest way to get an Incus cluster for the clustered acceptance tests is to use incus-deploy.
Follow the instructions in the incus-deploy repository to set up your cluster
using terraform (or tofu) and ansible. As a precondition, you have to install
Incus on your machine, e.g. by following the instructions on
zabbly/incus.
With the cluster up and running, the acceptance tests can be executed using the following command:
TF_ACC=1 go test ./... -vIf the cluster is not the default remote (local), you can specify the remote
by setting the INCUS_REMOTE environment variable:
INCUS_REMOTE=your-remote TF_ACC=1 go test ./... -v