mikelangelo-project / capstan

Capstan, a tool for packaging and running your application on OSv.
http://osv.io/capstan/
Other
19 stars 7 forks source link

Support lambda for DirEquals and TarGzEquals checkers #42

Closed miha-plesko closed 7 years ago

miha-plesko commented 7 years ago

Currently, DirEquals/TarGzEquals checkers are only able to check whether directory structure and file content is EXACTLY the same as expected. This brings a problem when we can't tell EXACLTY what the content will be, e.g. because Capstan prepends --env prefix to bootcommands in random order.

With this commit we extend DirEquals/TarGzEquals so that it now accepts map of expectations that can either contain expected string (EXACT match) or lambda function (more extensible match).

To reuse same logic for DirEquals and TarGzEquals checkers we quickly recaftor the code by introducing loadDir() and loadTarGz() auxilary functions.

This PR depends on https://github.com/mikelangelo-project/capstan/pull/40 to be merged.

miha-plesko commented 7 years ago

Closing the PR for now, will reopen after vacations.