45 lines
1.5 KiB
Markdown
45 lines
1.5 KiB
Markdown
# 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.
|
|
|
|
```
|
|
cd go
|
|
go test -run Foo ./daemon
|
|
go test ./... # Test everything
|
|
```
|
|
|
|
## Integration Tests
|
|
|
|
NOTE: before running integration tests you will want to make sure you can [build
|
|
Isle][building] in the first place.
|
|
|
|
[building]: ./building.md
|
|
|
|
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.
|
|
|
|
```
|
|
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
|