Add functional tests for the CLI and fix minor bugs writing the tests revealed:
When running kit remove, we were logging placeholder registry/repo values (i.e. localhost/test:test instead of test:test)
The unpack subcommand had a flag --config (to unpack only the Kitfile) which conflicted with the global --config flag. This flag was renamed to --kitfile
Unpacking would break if a Kitfile path had a trailing slash, unpacking files one directory higher in the tree
Updated the output package to use the command's output/error channels instead of hardcoding stdout/stderr.
The way the tests work is by
Setting up a temporary directory
Configuring Kit to do everything within that directory (i.e. storage is within the directory, etc.)
Running Kit commands directly within that directory and verifying behaviour
For testing pack/unpack and ignoring, each test generates a Kitfile, a .kitignore and files representing a model kit. It then packs those files, unpacks them to a separate directory, and verifies that all expected files are present (and no unexpected ones are)
For testing kit remove, each test packs one or more modelkits and verifies that kit remove cleans them up as expected
Each test also incidentally tests other commands, e.g. kit tag or kit list as required. Test logging is fairly verbose, so in test failures are relatively easy to diagnose (add the -test.v flag to see all output).
Description
Add functional tests for the CLI and fix minor bugs writing the tests revealed:
kit remove
, we were logging placeholder registry/repo values (i.e.localhost/test:test
instead oftest:test
)unpack
subcommand had a flag--config
(to unpack only the Kitfile) which conflicted with the global--config
flag. This flag was renamed to--kitfile
The way the tests work is by
For testing pack/unpack and ignoring, each test generates a Kitfile, a
.kitignore
and files representing a model kit. It then packs those files, unpacks them to a separate directory, and verifies that all expected files are present (and no unexpected ones are)For testing
kit remove
, each test packs one or more modelkits and verifies thatkit remove
cleans them up as expectedEach test also incidentally tests other commands, e.g.
kit tag
orkit list
as required. Test logging is fairly verbose, so in test failures are relatively easy to diagnose (add the-test.v
flag to see all output).Linked issues
Related: #119, #85