isle/docs/dev/testing.md

1.5 KiB

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 in the first place.

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 to be installed on the system.

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 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.