Files
snapd/tests/core/tmp/task.yaml
Sergio Cazzolato e4e08579bf tests: add details to a new set of tests - part 9 (#13864)
* tests: add details to a new set of tests - part 8

* add missing details

* Update tests/core/kernel-base-gadget-single-reboot/task.yaml

Co-authored-by: Zeyad Yasser <zeyady98@gmail.com>

* Update tests/core/netplan-cfg/task.yaml

Co-authored-by: Zeyad Yasser <zeyady98@gmail.com>

* Update tests/core/netplan-cfg/task.yaml

Co-authored-by: Zeyad Yasser <zeyady98@gmail.com>

* Update tests/core/remodel/task.yaml

Co-authored-by: Zeyad Yasser <zeyady98@gmail.com>

* Update tests/core/remove-user/task.yaml

Co-authored-by: Zeyad Yasser <zeyady98@gmail.com>

* Update tests/core/system-settings/task.yaml

Co-authored-by: Zeyad Yasser <zeyady98@gmail.com>

* Update tests/core/swapfiles/task.yaml

Co-authored-by: Zeyad Yasser <zeyady98@gmail.com>

* Update tests/core/snapd16/task.yaml

Co-authored-by: Zeyad Yasser <zeyady98@gmail.com>

* Update tests/core/snapd-refresh/task.yaml

Co-authored-by: Zeyad Yasser <zeyady98@gmail.com>

* Update tests/core/snapd-refresh-vs-services-reboots/task.yaml

Co-authored-by: Zeyad Yasser <zeyady98@gmail.com>

* Update task.yaml

* Update tests/core/mem-cgroup-disabled/task.yaml

Co-authored-by: Maciej Borzecki <maciek.borzecki@gmail.com>

* Update tests/core/snapd-refresh-vs-services-reboots/task.yaml

Co-authored-by: Maciej Borzecki <maciek.borzecki@gmail.com>

---------

Co-authored-by: Zeyad Yasser <zeyady98@gmail.com>
Co-authored-by: Maciej Borzecki <maciek.borzecki@gmail.com>
2024-04-24 18:27:07 -03:00

51 lines
1.6 KiB
YAML

summary: Check that the tmp.size settings work
details: |
Check that snapd allows to modify the size of /tmp through the 'tmp.size'
config. Verify also the unset of the config gets things back to defaults
environment:
MOUNTCFG_FILE: /etc/systemd/system/tmp.mount.d/override.conf
prepare: |
if [ -f "$MOUNTCFG_FILE" ]; then
echo "tmpfs configuration file already present, testbed not clean"
exit 1
fi
restore: |
rm -f "$MOUNTCFG_FILE"
execute: |
echo "Ensure tmp.size is not set initially"
test ! -f "$MOUNTCFG_FILE"
if snap get system tmp.size; then
echo "Error: tmp.size is unexpectedly set"
exit 1
fi
def_size=$(df --output=size /tmp | tail -1)
echo "Ensure setting tmp.size works"
for size in 100 200; do
snap set system tmp.size="$size"M
snap get system tmp.size | MATCH "$size"M
df -h --output=size /tmp | MATCH "$size"M
grep '^tmpfs /tmp' /proc/mounts | MATCH nosuid,nodev
MATCH "Options=mode=1777,strictatime,nosuid,nodev,size=${size}M" "$MOUNTCFG_FILE"
# Check that systemd is happy with the generated override.conf
systemctl daemon-reload
done
echo "Unsetting gets things back to defaults"
snap unset system tmp.size
if snap get system tmp.size; then
echo "Error: tmp.size is unexpectedly set"
exit 1
fi
test ! -f "$MOUNTCFG_FILE"
cur_size=$(df --output=size /tmp | tail -1)
# For some odd reason, resizing to the default can have a difference with the
# old one of one page (4k), at least in GCE, so we take that into account.
test "$cur_size" -le $((def_size + 4)) && test "$cur_size" -ge $((def_size - 4))
systemctl daemon-reload