Rewrites

Specsheet lets you rewrite certain parameters uniformly across the entirety of the checks. This can be used to have the same set of check files serve multiple environments that are slightly different but generally the same.

If you are checking a web service, you may want to test that it works both development and in production, running the same set of tests against each environment. You could do this by having two check files, but then you’d have to keep the checks in sync.

A better way would be to specify a rewrite on the command-line. For example, if you had this HTTP check:

[[http]]
url = "https://specsheet.software/docs/rewrites"
status = 200

You could test in development by running it using the -R command-line option, pointing the URL to localhost instead:

$ specsheet checks.toml -R 'https://specsheet.software->http://localhost:8080'
 HTTP request to ‘https://specsheet.software/docs/rewrites’ has status ‘200’
1/1 successful

Specsheet sends the requests to port 8080 on the local machine using HTTP, rather than to the actual machine using HTTPS, but makes the same assertions.

The command-line option takes two parameters separated by an ASCII -> arrow.

Overriding paths

Paths to files on disk can be rewritten to have a different prefix.

/mnt/nas->../fake-nas

Overriding commands

The basenames of external programs to execute can be rewritten to point to a different program.

specsheet->target/debug/specsheet

Overriding URLs

The host, port, and protocol of a URL can be rewritten.

https://example.com->http://localhost:3000

Overriding interfaces

Network interfaces can be rewritten.

%eth1->en0