diff options
author | David Kalnischkies <david@kalnischkies.de> | 2024-04-23 16:13:46 +0000 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2024-04-24 13:16:21 +0000 |
commit | 9c06578c37ff77b70b9d978d48528df13e13530f (patch) | |
tree | b95b208a7e00045b2d498b6e293526b01e4aae15 /test/integration/test-apt-get-autoremove | |
parent | d030a1041b243c45dcd41e34d3c2b21cf1a533ba (diff) |
Drop sudo-related envvars in testing framework
Our autoremoval-advertisment is modified by SUDO_USER as if the current
apt call was made with sudo it seems a good idea to show the ad with
sudo as well. That is annoying for our tests through as normally the
tests are run locally or by autopkgtest without sudo, but in Gitlab CI
we use it (to run our tests as user… as we are already root) and so
individual tests had to deal with this.
That is annoying and really not needed as we can have our autoremove
test check that this ad gets displayed the right way and ignore it the
rest of the time.
Diffstat (limited to 'test/integration/test-apt-get-autoremove')
-rwxr-xr-x | test/integration/test-apt-get-autoremove | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove index 66257f442..9454df5c8 100755 --- a/test/integration/test-apt-get-autoremove +++ b/test/integration/test-apt-get-autoremove @@ -27,10 +27,6 @@ testdpkginstalled 'po-debconf' 'unrelated' echo 'unrelated purge' | dpkg --set-selections testdpkgstatus 'pi' '1' 'unrelated' -AUTOREMOVE='apt autoremove' -if [ -n "$SUDO_USER" ]; then - AUTOREMOVE="sudo $AUTOREMOVE" -fi echo 'APT::NeverAutoRemove { "^debc.*nf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove testsuccessequal 'Reading package lists... Building dependency tree... @@ -39,20 +35,28 @@ The following packages will be REMOVED: po-debconf 0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded. Remv po-debconf [1.0.16]' aptget autoremove -s -testequal "Reading package lists... +for sudouser in '_apt' ''; do + if [ -n "$sudouser" ]; then + export SUDO_USER="$sudouser" + AUTOREMOVE='sudo apt autoremove' + else + unset SUDO_USER + AUTOREMOVE='apt autoremove' + fi + testequal "Reading package lists... Building dependency tree... Reading state information... The following package was automatically installed and is no longer required: po-debconf Use '$AUTOREMOVE' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -testequal "Reading package lists... + testequal "Reading package lists... Building dependency tree... Reading state information... 1 package was automatically installed and is no longer required. Use '$AUTOREMOVE' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small -testequal "Reading package lists... + testequal "Reading package lists... Building dependency tree... Reading state information... Calculating upgrade... @@ -60,6 +64,8 @@ The following package was automatically installed and is no longer required: po-debconf Use '$AUTOREMOVE' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget upgrade -s +done + testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... @@ -111,7 +117,7 @@ Reading state information... Calculating upgrade... The following package was automatically installed and is no longer required: po-debconf -Use '$AUTOREMOVE' to remove it. +Use 'apt autoremove' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget upgrade -s rm -f rootdir/etc/apt/apt.conf.d/autoremoval @@ -163,13 +169,13 @@ Building dependency tree... Reading state information... The following packages were automatically installed and are no longer required: debhelper po-debconf -Use '$AUTOREMOVE' to remove them. +Use 'apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s testequal "Reading package lists... Building dependency tree... Reading state information... 2 packages were automatically installed and are no longer required. -Use '$AUTOREMOVE' to remove them. +Use 'apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small testsuccess aptmark hold debhelper |