2019-09-11 09:13:02 +00:00
|
|
|
#!/usr/bin/env bats -t
|
|
|
|
|
2019-09-19 09:57:02 +00:00
|
|
|
load helpers
|
|
|
|
|
2019-09-11 09:13:02 +00:00
|
|
|
@test "Help" {
|
2019-09-19 09:57:02 +00:00
|
|
|
run_ctr $CTR_IMAGE -h
|
2019-09-11 14:25:47 +00:00
|
|
|
[ "$status" -eq 0 ]
|
2019-09-11 09:13:02 +00:00
|
|
|
[[ ${lines[0]} =~ "BuildSourceImage.sh version " ]]
|
|
|
|
[[ ${lines[1]} =~ "Usage: BuildSourceImage.sh " ]]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "Version" {
|
2019-09-19 09:57:02 +00:00
|
|
|
run_ctr $CTR_IMAGE -v
|
2019-09-11 09:13:02 +00:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[[ ${lines[0]} =~ "BuildSourceImage.sh version " ]]
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "List Drivers" {
|
2019-09-19 09:57:02 +00:00
|
|
|
run_ctr $CTR_IMAGE -l
|
2019-09-11 09:13:02 +00:00
|
|
|
[ "$status" -eq 0 ]
|
|
|
|
[[ ${lines[0]} =~ "sourcedriver_context_dir" ]]
|
|
|
|
[[ ${lines[1]} =~ "sourcedriver_extra_src_dir" ]]
|
|
|
|
[[ ${lines[2]} =~ "sourcedriver_rpm_dir" ]]
|
|
|
|
[[ ${lines[3]} =~ "sourcedriver_rpm_fetch" ]]
|
|
|
|
}
|
2019-09-19 09:57:02 +00:00
|
|
|
|
|
|
|
@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/ )" ]]
|
|
|
|
}
|