2017-06-22 23:47:20 +08:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
|
|
load helpers
|
|
|
|
|
|
|
|
|
|
@test "buildah version test" {
|
2019-04-02 05:56:29 +08:00
|
|
|
run_buildah version
|
2017-07-22 01:18:56 +08:00
|
|
|
}
|
2017-06-22 23:47:20 +08:00
|
|
|
|
2018-05-12 01:23:14 +08:00
|
|
|
@test "buildah version current in .spec file Version" {
|
2022-04-26 22:03:44 +08:00
|
|
|
if [ ! -d "${TEST_SOURCES}/../contrib/rpm" ]; then
|
2019-04-02 05:56:29 +08:00
|
|
|
skip "No source dir available"
|
|
|
|
|
fi
|
2019-12-12 07:21:51 +08:00
|
|
|
run_buildah version
|
|
|
|
|
bversion=$(awk '/^Version:/ { print $NF }' <<< "$output")
|
2022-04-26 22:03:44 +08:00
|
|
|
rversion=$(awk '/^Version:/ { print $NF }' < ${TEST_SOURCES}/../contrib/rpm/buildah.spec)
|
2019-12-12 07:21:51 +08:00
|
|
|
echo "bversion=${bversion}"
|
|
|
|
|
echo "rversion=${rversion}"
|
2019-10-19 00:10:48 +08:00
|
|
|
test "${bversion}" = "${rversion}" -o "${bversion}" = "${rversion}-dev"
|
2018-05-12 01:23:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@test "buildah version current in .spec file changelog" {
|
2022-04-26 22:03:44 +08:00
|
|
|
if [ ! -d "${TEST_SOURCES}/../contrib/rpm" ]; then
|
2019-04-02 05:56:29 +08:00
|
|
|
skip "No source dir available"
|
|
|
|
|
fi
|
2019-12-12 07:21:51 +08:00
|
|
|
run_buildah version
|
|
|
|
|
bversion=$(awk '/^Version:/ { print $NF }' <<< "$output")
|
2022-04-26 22:03:44 +08:00
|
|
|
grep -A1 ^%changelog ${TEST_SOURCES}/../contrib/rpm/buildah.spec | grep -q " ${bversion}-"
|
2017-06-22 23:47:20 +08:00
|
|
|
}
|
2021-04-16 09:09:14 +08:00
|
|
|
|
|
|
|
|
@test "buildah version current in package" {
|
|
|
|
|
if [ -n "$(command -v rpm)" ]; then
|
|
|
|
|
run rpm -qfi ${BUILDAH_BINARY}
|
|
|
|
|
[ $status -eq 0 ] || skip "buildah binary is not owned by package"
|
|
|
|
|
rversion=$(awk '/^Version/ { print $NF }' <<< "$output")
|
|
|
|
|
elif [ -n "$(command -v dpkg)" ]; then
|
|
|
|
|
run dpkg --search ${BUILDAH_BINARY}
|
|
|
|
|
[ $status -eq 0 ] || skip "buildah binary is not owned by package"
|
|
|
|
|
package=$(awk -F : '{ print $1 }' <<< "${output}")
|
|
|
|
|
run dpkg --status $package
|
|
|
|
|
[ $status -eq 0 ] || skip "buildah binary is not owned by package"
|
|
|
|
|
rversion=$(awk '/^Version/ { print $NF }' <<< "$output")
|
|
|
|
|
rversion=${rversion%%-*}
|
|
|
|
|
else
|
|
|
|
|
skip "No supported package manager"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
run_buildah version
|
|
|
|
|
bversion=$(awk '/^Version:/ { print $NF }' <<< "$output")
|
|
|
|
|
echo "bversion=${bversion}"
|
|
|
|
|
echo "rversion=${rversion}"
|
|
|
|
|
test "${bversion}" = "${rversion}" -o "${bversion}" = "${rversion}-dev"
|
|
|
|
|
}
|