To test on the ubuntu-advantage-tools package we have created a script that calls the update API multiple times and checks if the results are consistent. Since the problem that affected update-manager was that the endpoint was interfering with the APT cache.
To test on the ubuntu- advantage- tools package we have created a script that calls the update API multiple times and checks if the results are consistent. Since the problem that affected update-manager was that the endpoint was interfering with the APT cache.
This is the script we have used to test it:
------- ------- ------- ------- ------- -------
#!/bin/bash
set -e
series=$1
name=$series-test
function cleanup {
lxc delete $name --force
}
function on_err {
echo -e "Test Failed"
cleanup
exit 1
}
trap on_err ERR
function upgrade_to_latest { ------- ------- ------- ------- ------- ----" ------- ------- ------- ------- ------- --" advantage- tools -y advantage- tools ------- ------- ------- ------- ------- --"
echo -e "\n----
echo "** upgrading to 27.13.6"
echo "------
lxc exec $name -- apt-get update > /dev/null
lxc exec $name -- apt-get install ubuntu-
lxc exec $name -- apt-cache policy ubuntu-
echo "------
}
function upgrade_to_proposed { ------- ------- ------- ------- ------- ----" ------- ------- ------- ------- ------- --" archive. ubuntu. com/ubuntu $series-proposed main\" | tee /etc/apt/ sources. list.d/ proposed. list" advantage- tools -y advantage- tools ------- ------- ------- ------- ------- --"
echo -e "\n----
echo "** upgrading to 27.14.3 from proposed"
echo "------
lxc exec $name -- sh -c "echo \"deb http://
lxc exec $name -- apt-get update > /dev/null
lxc exec $name -- apt-get install ubuntu-
lxc exec $name -- apt-cache policy ubuntu-
echo "------
}
function setup_python_script { ------- ------- ------- ------- ------- ----" ------- ------- ------- ------- ------- --"
echo -e "\n----
echo "** Setting up python3 environment"
echo "------
cat > python-apt-test.py << EOF api.u.pro. packages. updates. v1 import updates
from uaclient.
from uaclient.system import subp
result = updates() summary) summary) summary) ------- ------- ------- ------- ------- --"
print(result.
result = updates()
print(result.
result = updates()
print(result.
EOF
lxc file push python-apt-test.py $name/tmp/
echo "------
}
lxc launch ubuntu- daily:$ series $name
sleep 5
upgrade_to_latest
sleep 20
setup_python_script
echo -e "\n---- ------- ------- ------- ------- ------- ----" apt-test. py ------- ------- ------- ------- ------- --"
echo "** Verify apt cache is not consistent"
lxc exec $name -- apt-get update
lxc exec $name -- python3 /tmp/python-
echo "------
upgrade_to_proposed
echo -e "\n---- ------- ------- ------- ------- ------- ----" apt-test. py ------- ------- ------- ------- ------- --"
echo "** Verify apt cache is now consistent"
lxc exec $name -- python3 /tmp/python-
echo "------
cleanup
------- ------- ------- ------- ------- ------- -------