Skip to content

Commit

Permalink
Test overlay overlays files in bats
Browse files Browse the repository at this point in the history
Bats runs functional tests, lets ensure the repo is cloned
and extracted to the desired location.  The unit tests mock
RunCommand, which prevents any git commands from actually
executing.
  • Loading branch information
retr0h committed Aug 6, 2018
1 parent d2bd771 commit 13fc48f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/integration/test_cli.bats
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.

setup() {
GILT_CLONED_ETCD_REPO=~/.gilt/clone/cache/https---github.com-retr0h-ansible-etcd.git-77a95b7
GILT_DST_ETCD_REPO=/tmp/retr0h.ansible-etcd

rm -rf ${GILT_CLONED_ETCD_REPO}
rm -rf ${GILT_DST_ETCD_REPO}
}

@test "invoke gilt without arguments prints usage" {
run go run main.go

Expand All @@ -40,6 +48,14 @@
run bash -c 'cd test; go run ../main.go overlay'

[ "$status" -eq 0 ]

run stat ${GILT_CLONED_ETCD_REPO}

[ "$status" = 0 ]

run stat ${GILT_DST_ETCD_REPO}

[ "$status" = 0 ]
}

@test "invoke gilt overlay subcommand with filename flag" {
Expand Down

0 comments on commit 13fc48f

Please sign in to comment.