containers-bsi/test/00-simple.bats
Valentin Rothberg 66ac3195c8 test: add helpers.bash to reduce boilerplate
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2019-09-19 11:58:44 +02:00

31 lines
773 B
Bash

#!/usr/bin/env bats -t
load helpers
@test "Help" {
run_ctr $CTR_IMAGE -h
[ "$status" -eq 0 ]
[[ ${lines[0]} =~ "BuildSourceImage.sh version " ]]
[[ ${lines[1]} =~ "Usage: BuildSourceImage.sh " ]]
}
@test "Version" {
run_ctr $CTR_IMAGE -v
[ "$status" -eq 0 ]
[[ ${lines[0]} =~ "BuildSourceImage.sh version " ]]
}
@test "List Drivers" {
run_ctr $CTR_IMAGE -l
[ "$status" -eq 0 ]
[[ ${lines[0]} =~ "sourcedriver_context_dir" ]]
[[ ${lines[1]} =~ "sourcedriver_extra_src_dir" ]]
[[ ${lines[2]} =~ "sourcedriver_rpm_dir" ]]
[[ ${lines[3]} =~ "sourcedriver_rpm_fetch" ]]
}
@test "No input" {
run_ctr $CTR_IMAGE
[ "$status" -eq 1 ]
[[ ${lines[0]} =~ "[SrcImg][ERROR] provide an input (example: BuildSourceImage.sh -i docker.io/centos -e ./my-sources/ )" ]]
}