summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2018-05-16 12:09:47 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2018-06-25 12:06:21 +0200
commit90de65bb3fbacbc8a1443161c212c7ecbadfab1a (patch)
tree015bb714641f0d232760c1d858e9f5d50a7f4379
parentcda69dac5b460970536820738cffc0d5948a9a2f (diff)
tests: Do not expect requested-by if sudo was invoked by root
If sudo was invoked by root, SUDO_UID will be 0, and apt will not print a Requested-By line. (cherry picked from commit 68842e1741a5005b1e3f0a07deffd737c65e3294)
-rwxr-xr-xtest/integration/test-bug-611729-mark-as-manual2
-rwxr-xr-xtest/integration/test-disappearing-packages2
2 files changed, 2 insertions, 2 deletions
diff --git a/test/integration/test-bug-611729-mark-as-manual b/test/integration/test-bug-611729-mark-as-manual
index 97ef846e3..4bcd25f0f 100755
--- a/test/integration/test-bug-611729-mark-as-manual
+++ b/test/integration/test-bug-611729-mark-as-manual
@@ -56,7 +56,7 @@ testdpkginstalled b c
testmarkedauto 'b'
sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d'
-if [ -n "$SUDO_USER" ]; then
+if [ -n "$SUDO_USER" -a "$(id -u "$SUDO_USER")" -gt 0 ]; then
testfileequal 'rootdir/var/log/apt/history.log' "
Requested-By: $SUDO_USER ($(id -u "$SUDO_USER"))
Reinstall: b:i386 (1.0)"
diff --git a/test/integration/test-disappearing-packages b/test/integration/test-disappearing-packages
index e8748e6bc..b27755361 100755
--- a/test/integration/test-disappearing-packages
+++ b/test/integration/test-disappearing-packages
@@ -60,7 +60,7 @@ all files have been overwritten by other packages:
Note: This is done automatically and on purpose by dpkg.' tail -n 4 disappear.output
sed -i rootdir/var/log/apt/history.log -e '/^Commandline: / d' -e '/^Start-Date: / d' -e '/^End-Date: / d' -e "s#:$(getarchitecture 'native') #:native #"
-if [ -n "$SUDO_USER" ]; then
+if [ -n "$SUDO_USER" -a "$(id -u "$SUDO_USER")" -gt 0 ]; then
testfileequal 'rootdir/var/log/apt/history.log' "
Requested-By: $SUDO_USER ($(id -u "$SUDO_USER"))
Install: old-pkg:native (1)