From in /localenv run:
mage test:up
This command will delete minikube if it is running, start a new cluster. Then load up the images.
To speed things up for development you can re-use the cluster if it is already running and manually run localenv commands as needed.
Run all tests with
mage Test
To run a single test you can provide the path a test folder.
mage RunTest scenarios/basic
Steps to debug a test:
# Start the cluster
cd test/localenv
mage test:up
# Go to the test folder
cd ../test/integration/scenarios/basic
# Run setup to prepare the cluster
mage Setup
# Run the tests
mage Verify
If a test is failing you can debug it in VS Code.
- open the
test/integration
folder in VS Code. - set breakpoints in the test
- Click debug test above the test function name
Compare the test with the state of the cluster using k9s of kubectl to track down the problem.
Copy an existing test such as scenarios/basic
and modify it to test your scenario.
Make sure the folder is under scenarios/
so it will get picked up automatically.
Tests MUST have:
- A
magefile.go
with aTest
target that deploys and runs the entire test.
Tests SHOULD have:
Setup
,Verify
, andCleanup
targets to make it possible to get the cluster into the same state using console commands.