» Command: test

The sentinel test command runs policies against the Sentinel test framework.

To learn more about testing, see the testing policies page.

» Usage

Usage: sentinel test [options] [PATH] ...

This command runs the defined test cases against a set of policies.

The test cases are expected to live at the path test//*.json relative to the policy being tested. should be the name of the policy excluding the file extension. The JSON files should be in the apply configuration file structure. The test key is used for assertions.

The PATH arguments specified may be a list of zero or more files or directories. When no arguments are given, it defaults to the current directory. When a directory is given, all policies ending with the extension .sentinel are tested.

The command-line flags are all optional. The list of available flags are:

  • -run=regexp - Run only tests matching the regular expression pattern. A / splits policy name and test case name.

  • -verbose - Show tracing and log output for tests that succeed in addition to tests that fail. By default, traces and logs are only shown for tests that fail.