diff --git a/sru/release-31/binary-package-rename-uninstall-old-not-allowed.sh b/sru/release-31/binary-package-rename-uninstall-old-not-allowed.sh new file mode 100755 index 0000000000..75aad76a4f --- /dev/null +++ b/sru/release-31/binary-package-rename-uninstall-old-not-allowed.sh @@ -0,0 +1,61 @@ +#!/bin/bash +set -e + +series=$1 +install_from=$2 # 'staging', or 'proposed', or the name of a ppa + +name=$series-test + +function cleanup { + lxc delete $name --force +} + +function on_err { + echo -e "Test Failed" + cleanup + exit 1 +} +trap on_err ERR + + +lxc launch ubuntu-daily:$series $name +sleep 5 + +# Install latest ubuntu-advantage-tools +lxc exec $name -- apt-get update > /dev/null +lxc exec $name -- apt-get install -y ubuntu-advantage-tools > /dev/null + +# Set up source for installing new version +# ---------------------------------------------------------------- +if [ $install_from == 'staging' ]; then + lxc exec $name -- sudo add-apt-repository ppa:ua-client/staging -y > /dev/null + lxc exec $name -- apt-get update > /dev/null +elif [ $install_from == 'proposed' ]; then + lxc exec $name -- sh -c "echo \"deb http://archive.ubuntu.com/ubuntu $series-proposed main\" | tee /etc/apt/sources.list.d/proposed.list" + lxc exec $name -- apt-get update + lxc exec $name -- sh -c "cat > /etc/apt/preferences.d/pro-posed << EOF +Package: ubuntu-advantage-tools ubuntu-pro-client ubuntu-pro-auto-attach ubuntu-advantage-pro ubuntu-pro-client-l10n +Pin: release a=$series-proposed +Pin-Priority: 600 +EOF" +else + lxc exec $name -- sudo add-apt-repository $install_from -y > /dev/null + lxc exec $name -- apt-get update > /dev/null +fi +# ---------------------------------------------------------------- + +echo -e "\n* Latest u-a-t is installed from -updates and -proposed enabled with new version available" +echo "###########################################" +lxc exec $name -- apt-cache policy ubuntu-advantage-tools ubuntu-pro-client +echo -e "###########################################\n" + +echo -e "\n* Attempt to upgrade to ubuntu-pro-client while simultaneously removing ubuntu-advantage-tools without removing ubuntu-minimal" +echo -e "* This should fail" +echo "###########################################" +set -x +lxc exec $name -- apt install ubuntu-pro-client ubuntu-advantage-tools- ubuntu-minimal -y && RC=$? || RC=$? +test $RC -eq 100 +set +x +echo -e "###########################################\n" + +cleanup diff --git a/sru/release-31/binary-package-renames-install-upc.sh b/sru/release-31/binary-package-renames-install-upc.sh new file mode 100755 index 0000000000..ff4812fc1e --- /dev/null +++ b/sru/release-31/binary-package-renames-install-upc.sh @@ -0,0 +1,112 @@ +#!/bin/bash +set -e + +series=$1 +install_from=$2 # 'staging', or 'proposed', or the name of a ppa +version=$3 + +name=$series-test + +function cleanup { + lxc delete $name --force +} + +function on_err { + echo -e "Test Failed" + cleanup + exit 1 +} +trap on_err ERR + + +lxc launch ubuntu-daily:$series $name +sleep 5 + +# Install latest ubuntu-advantage-tools +lxc exec $name -- apt-get update > /dev/null +lxc exec $name -- apt-get install -y ubuntu-advantage-tools > /dev/null + +# Set up source for installing new version +# ---------------------------------------------------------------- +if [ $install_from == 'staging' ]; then + lxc exec $name -- sudo add-apt-repository ppa:ua-client/staging -y > /dev/null + lxc exec $name -- apt-get update > /dev/null +elif [ $install_from == 'proposed' ]; then + lxc exec $name -- sh -c "echo \"deb http://archive.ubuntu.com/ubuntu $series-proposed main\" | tee /etc/apt/sources.list.d/proposed.list" + lxc exec $name -- apt-get update > /dev/null + lxc exec $name -- sh -c "cat > /etc/apt/preferences.d/pro-posed << EOF +Package: ubuntu-advantage-tools ubuntu-pro-client ubuntu-pro-auto-attach ubuntu-advantage-pro ubuntu-pro-client-l10n +Pin: release a=$series-proposed +Pin-Priority: 600 +EOF" +else + lxc exec $name -- sudo add-apt-repository $install_from -y > /dev/null + lxc exec $name -- apt-get update > /dev/null +fi +# ---------------------------------------------------------------- + +echo -e "\n* Latest u-a-t is installed from -updates and 31.2 is available in -proposed" +echo "###########################################" +lxc exec $name -- apt-cache policy ubuntu-advantage-tools ubuntu-pro-client +echo -e "###########################################\n" + +echo -e "\n* attach prior to upgrade" +echo "###########################################" +lxc exec $name -- pro attach $UACLIENT_BEHAVE_CONTRACT_TOKEN +echo -e "###########################################\n" + +echo -e "\n* upgrade to rename" +echo "###########################################" +set -x +# uncomment one of these per run +# lxc exec $name -- apt install ubuntu-advantage-tools -y +# lxc exec $name -- apt install ubuntu-pro-client -y +lxc exec $name -- apt install ubuntu-pro-client=$version -y +# lxc exec $name -- apt upgrade -y +# lxc exec $name -- apt dist-upgrade -y +set +x +echo -e "###########################################\n" + +echo -e "\n* autoremove just to make sure it doesn't do anything unexpected" +echo "###########################################" +set -x +lxc exec $name -- apt autoremove -y +set +x +echo -e "###########################################\n" + +echo -e "\n* still attached" +echo "###########################################" +lxc exec $name -- pro status +echo -e "###########################################\n" + +echo -e "\n* appropriate versions of ubuntu-advantage-tools and ubuntu-pro-client are installed" +echo "###########################################" +lxc exec $name -- apt policy ubuntu-advantage-tools ubuntu-pro-client +echo -e "###########################################\n" + +echo -e "\n* dpkg doesn't show obsolete conffiles for ubuntu-advantage-tools" +echo "###########################################" +lxc exec $name -- dpkg-query --showformat='${Conffiles}\n' --show ubuntu-advantage-tools +echo -e "###########################################\n" + +if [ "$series" != "xenial" ] && [ "$series" != "bionic" ]; then + echo -e "\n* reinstall just to make sure it doesn't do anything unexpected" + echo "###########################################" + set -x + lxc exec $name -- apt reinstall ubuntu-advantage-tools + lxc exec $name -- apt reinstall ubuntu-pro-client + set +x + echo -e "###########################################\n" + + echo -e "\n* still attached" + echo "###########################################" + lxc exec $name -- pro status + echo -e "###########################################\n" + + echo -e "\n* appropriate versions of ubuntu-advantage-tools and ubuntu-pro-client are installed" + echo "###########################################" + lxc exec $name -- apt policy ubuntu-advantage-tools ubuntu-pro-client + echo -e "###########################################\n" +fi + +cleanup diff --git a/sru/release-31/test-jobs-status-world-readable.sh b/sru/release-31/test-jobs-status-world-readable.sh index a85e99e8d0..f392fa895a 100755 --- a/sru/release-31/test-jobs-status-world-readable.sh +++ b/sru/release-31/test-jobs-status-world-readable.sh @@ -45,6 +45,11 @@ if [ $install_from == 'staging' ]; then elif [ $install_from == 'proposed' ]; then lxc exec $name -- sh -c "echo \"deb http://archive.ubuntu.com/ubuntu $series-proposed main\" | tee /etc/apt/sources.list.d/proposed.list" lxc exec $name -- apt-get update > /dev/null + lxc exec $name -- sh -c "cat > /etc/apt/preferences.d/pro-posed << EOF +Package: ubuntu-advantage-tools ubuntu-pro-client ubuntu-pro-auto-attach ubuntu-advantage-pro ubuntu-pro-client-l10n +Pin: release a=$series-proposed +Pin-Priority: 600 +EOF" lxc exec $name -- apt-get install ubuntu-advantage-tools -y > /dev/null else lxc file push $install_from $name/new-ua.deb @@ -52,8 +57,14 @@ else fi # ---------------------------------------------------------------- +echo -e "\n* Installed u-a-t from -proposed" +echo "###########################################" +lxc exec $name -- apt-cache policy ubuntu-advantage-tools ubuntu-pro-client +echo -e "###########################################\n" + echo -e "\n* re-create jobs-status file and notice that is now world-readable" echo "###########################################" +lxc exec $name -- rm /var/lib/ubuntu-advantage/jobs-status.json lxc exec $name -- python3 /usr/lib/ubuntu-advantage/timer.py lxc exec $name -- ls -la /var/lib/ubuntu-advantage/jobs-status.json echo -e "###########################################\n"