#!/bin/sh

set -e

. ./helpers.sh

# When the current version was already uploaded to unstable, the first
# operation must bump the version with dch -i, and the remaining
# operations must append their bullets to the new entry.

set_stub_rmadison "openstack-pkg-tools | 1.0.0-1 | unstable | source, all" 0
make_fixture "1.0.0-1" unstable "openstack-pkg-tools" \
	"UPSTREAM_GIT := https://github.com/openstack/openstack-pkg-tools.git"

run_modernize
assert_eq "exit code" "${MODERNIZE_RC}" "0"

assert_eq "version bumped" "$(dpkg-parsechangelog -SVersion)" "1.0.0-2"
assert_eq "new entry is UNRELEASED" "$(dpkg-parsechangelog -SDistribution)" "UNRELEASED"
BULLETS=$(sed -n '/1.0.0-2/,$p' debian/changelog)
assert_contains "bullet salsa-ci" "${BULLETS}" "* Update debian/salsa-ci.yml"
assert_contains "bullet watch" "${BULLETS}" "* Update debian/watch to version=4 mode=git"
assert_contains "bullet priority" "${BULLETS}" "* Remove the Priority: field from debian/control"
assert_contains "bullet compat" "${BULLETS}" "* Upgrade the package to debhelper-compat (= 13)"
assert_contains "bullet SV" "${BULLETS}" "* Update Standards-Version to 4.7.4"

exit 0
