From 458e56df1cca79da1bc2f52da94a4a284f91b693 Mon Sep 17 00:00:00 2001 From: Denis Pynkin <denis.pynkin@collabora.com> Date: Wed, 23 Jan 2019 02:42:36 +0300 Subject: [PATCH] AUM: diskfull: rework the test Test is reworked to be more reliable and prevent the system reboot. Added `core.min-free-space-percent = 0` option to avoid complex calculation and re-creation of big file. Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com> --- .../apertis-update-manager-diskfull.yaml | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/test-cases/apertis-update-manager-diskfull.yaml b/test-cases/apertis-update-manager-diskfull.yaml index 4c21a4a..c49b6c8 100644 --- a/test-cases/apertis-update-manager-diskfull.yaml +++ b/test-cases/apertis-update-manager-diskfull.yaml @@ -28,28 +28,35 @@ run: - $ sudo ostree admin status - "Need to monitor the journal log" - $ sudo journalctl -ef --unit apertis-update-manager & - - "Check the free space on rootfs, calculate the size of file to leave only 3% of free space. - For instance, NUM=2604620 for case below -- just round to lesser value the result of calculation: 2716616-(3733136/100*3)" - - $ sudo df -B 512 / + - "Check the free space on rootfs, calculate the size of file to leave insufficient free space for upgrade to happen + (this prevents the unexpected reboot during the test caused by other services). + For instance, in the case below, NUM value would be 1451. It is the result of the calculation 1823-348-24, + there 24 is a magic constant, so that almost, but not all free space is used. + The free space can be calculated with command line `sudo df -B 1M / | grep / | awk '{print $2-$3-24}'`" + - $ sudo df -B 1M / - | - >Filesystem 512B-blocks Used Available Use% Mounted on - /dev/mmcblk0p2 3733136 790784 2716616 23% / - - $ sudo dd if=/dev/zero of=/var/bigfile bs=512 count=<NUM> - - "Plug the USB flash drive in the device" - - "The update should fail with some error message related to disk space, for instance:" + >Filesystem 1M-blocks Used Available Use% Mounted on + /dev/mmcblk0p2 1823 348 1365 21% / + - $ sudo dd if=/dev/zero of=/var/bigfile bs=1M count=<NUM> ; echo "dd completed!" + - Wait until 'dd' completes (it should take time), you will see the output similar to - | - >Dec 19 22:55:10 apertis apertis-update-[319]: Ostree upgrade failed: mkdir(boot/loader.0/entries): Input/output error - Dec 19 22:43:46 apertis apertis-update-[794]: Ostree upgrade failed: Error writing to file descriptor: No space left on device - - "Remove the USB flash drive" - - "Remove temporary file" - - $ sudo rm -f /var/bigfile - - "Fill the disk with root filesystem to 100%" - - $ sudo dd if=/dev/zero of=/var/bigfile bs=1M + >1521483776 bytes (1.5 GB) copied, 82.1661 s, 18.5 MB/s + dd completed! - "Plug the USB flash drive in the device" - "The update should fail with error message" - | >Dec 19 22:53:33 apertis apertis-update-[348]: Ostree upgrade failed: min-free-space-percent '3%' would be exceeded, 16.8 MB available - "Remove the USB flash drive" + - Set reserved space for ostree to '0' + - $ sudo ostree config set core.min-free-space-percent "0" + - Restart the Apertis Update Manager + - $ sudo systemctl restart apertis-update-manager + - "Plug the USB flash drive in the device" + - "The update should fail with some error message related to disk space, for instance:" + - | + >Dec 19 22:55:10 apertis apertis-update-[319]: Ostree upgrade failed: mkdir(boot/loader.0/entries): Input/output error + Dec 19 22:43:46 apertis apertis-update-[794]: Ostree upgrade failed: Error writing to file descriptor: No space left on device + - "Remove the USB flash drive" - "Remove temporary file" - $ sudo rm -f /var/bigfile - "Reboot the system" -- GitLab