2024-11-05 22:47:44 +00:00
|
|
|
# Testing Isle
|
|
|
|
|
|
|
|
All tests are currently written as go tests, and as such can be run from the
|
|
|
|
`go` directory using the normal go testing tool.
|
|
|
|
|
2024-12-18 20:54:15 +00:00
|
|
|
```bash
|
2024-11-05 22:47:44 +00:00
|
|
|
cd go
|
|
|
|
go test -run Foo ./daemon
|
|
|
|
go test ./... # Test everything
|
|
|
|
```
|
|
|
|
|
|
|
|
## Integration Tests
|
|
|
|
|
2024-12-17 10:33:19 +00:00
|
|
|
NOTE: before running integration tests you will want to make sure you can [build
|
|
|
|
Isle][building] in the first place.
|
|
|
|
|
|
|
|
[building]: ./building.md
|
|
|
|
|
2024-11-05 22:47:44 +00:00
|
|
|
Integration tests are those which require processes or state external to the
|
|
|
|
test itself. Integration tests are marked using the
|
|
|
|
`toolkit.MarkIntegrationTest` function, which will cause them to be skipped
|
|
|
|
unless being run in the integration test environment.
|
|
|
|
|
|
|
|
Besides a normal nix installation (like all Isle development needs), integration
|
|
|
|
tests also require `sudo` and [capsh][capsh] to be installed on the system.
|
|
|
|
|
|
|
|
[capsh]: https://www.man7.org/linux/man-pages/man1/capsh.1.html
|
|
|
|
|
|
|
|
By running tests using the `go/integration_test.sh` script the tests will be
|
|
|
|
automatically run in the integration test environment. All arguments will be
|
|
|
|
passed directly to the go testing tool.
|
|
|
|
|
2024-12-18 20:54:15 +00:00
|
|
|
```bash
|
2024-11-05 22:47:44 +00:00
|
|
|
cd go
|
|
|
|
./integration_test.sh -run Foo ./daemon
|
|
|
|
```
|
|
|
|
|
|
|
|
`integration_test.sh` wraps a call to `go test` in a bash shell which has all
|
|
|
|
required binaries available to it, and which has acquired necessary
|
|
|
|
[capabilities][capabilities] to use the binaries as needed. Acquiring
|
|
|
|
capabilities is done by elevating the user to root using `sudo`, and then
|
|
|
|
dropping them back down to a shell of the original user with capabilities set.
|
|
|
|
|
|
|
|
[capabilities]: https://wiki.archlinux.org/title/Capabilities
|