From 43cd82ff2082ad8b44f2a323f7c7796b30491f83 Mon Sep 17 00:00:00 2001
From: Denis Pynkin <denis.pynkin@collabora.com>
Date: Tue, 4 Jun 2019 00:51:26 +0300
Subject: [PATCH] AUM: create noticeable changes for manual tests of offline
 update

With this change we prepare the "outdated" commit without the
content of some directories. This allows to provide the significant
difference between "original" and "outdated" commits, so it is easy
to check it in booted deployment.
The side effect of huge size difference during upgrade is more stable
and convenient testing of "disk full" and "usb unplug" cases.

More detailed description is available here:
https://phabricator.apertis.org/T5439#189061

Signed-off-by: Denis Pynkin <denis.pynkin@collabora.com>
---
 test-cases/apertis-update-manager-api.yaml        | 9 +++++++--
 test-cases/apertis-update-manager-automount.yaml  | 9 +++++++--
 test-cases/apertis-update-manager-diskfull.yaml   | 9 +++++++--
 test-cases/apertis-update-manager-manual.yaml     | 9 +++++++--
 test-cases/apertis-update-manager-powercut.yaml   | 9 +++++++--
 test-cases/apertis-update-manager-rollback.yaml   | 9 +++++++--
 test-cases/apertis-update-manager-usb-unplug.yaml | 9 +++++++--
 7 files changed, 49 insertions(+), 14 deletions(-)

diff --git a/test-cases/apertis-update-manager-api.yaml b/test-cases/apertis-update-manager-api.yaml
index 4717f96..48f59ea 100644
--- a/test-cases/apertis-update-manager-api.yaml
+++ b/test-cases/apertis-update-manager-api.yaml
@@ -34,14 +34,19 @@ run:
     - "Get the Collection ID and ref"
     -  $ export CID=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 1 -d ' '); echo COLLECTION_ID=$CID
     -  $ export REF=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 2 -d ' '); echo REF=$REF
-    - "Create the commit with changed timestamp to allow upgrade with recent update file"
+    - "Create the list of files to skip and enshure there are some files in these directories"
+    - $ ls -1d /usr/share/locale /usr/share/man /usr/share/zoneinfo > /tmp/skip
+    - $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
+    - "Create the commit with changed timestamp and skipped list from above to allow upgrade with recent update file"
     - |
-        $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago"); echo "New commit: $NEWID"
+        $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago" --skip-list=/tmp/skip); echo "New commit: $NEWID"
     - "Deploy the prepared commit"
     - $ sudo ostree admin upgrade --allow-downgrade --deploy-only --override-commit=$NEWID --reboot
     - "Wait until the system is booted again and check the deployment"
     - $ sudo ostree admin status
     - "The booted commit (started with '*') must have ID which we prepare and the initial commit ID should be marked as '(rollback)'"
+    - "Check booted deployment have no file objects which we skip"
+    - $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
     - "Remove the initial deployment"
     - $ sudo ostree admin undeploy 1
     - "Reboot the system"
diff --git a/test-cases/apertis-update-manager-automount.yaml b/test-cases/apertis-update-manager-automount.yaml
index c89d685..2dd2520 100644
--- a/test-cases/apertis-update-manager-automount.yaml
+++ b/test-cases/apertis-update-manager-automount.yaml
@@ -32,14 +32,19 @@ run:
     - "Get the Collection ID and ref"
     -  $ export CID=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 1 -d ' '); echo COLLECTION_ID=$CID
     -  $ export REF=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 2 -d ' '); echo REF=$REF
-    - "Create the commit with changed timestamp to allow upgrade with recent update file"
+    - "Create the list of files to skip and enshure there are some files in these directories"
+    - $ ls -1d /usr/share/locale /usr/share/man /usr/share/zoneinfo > /tmp/skip
+    - $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
+    - "Create the commit with changed timestamp and skipped list from above to allow upgrade with recent update file"
     - |
-        $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago"); echo "New commit: $NEWID"
+        $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago" --skip-list=/tmp/skip); echo "New commit: $NEWID"
     - "Deploy the prepared commit"
     - $ sudo ostree admin upgrade --allow-downgrade --deploy-only --override-commit=$NEWID --reboot
     - "Wait until the system is booted again and check the deployment"
     - $ sudo ostree admin status
     - "The booted commit (started with '*') must have ID which we prepare and the initial commit ID should be marked as '(rollback)'"
+    - "Check booted deployment have no file objects which we skip"
+    - $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
     - "Remove the initial deployment"
     - $ sudo ostree admin undeploy 1
     - "Reboot the system"
diff --git a/test-cases/apertis-update-manager-diskfull.yaml b/test-cases/apertis-update-manager-diskfull.yaml
index 9180a91..fb460af 100644
--- a/test-cases/apertis-update-manager-diskfull.yaml
+++ b/test-cases/apertis-update-manager-diskfull.yaml
@@ -34,14 +34,19 @@ run:
     - "Get the Collection ID and ref"
     -  $ export CID=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 1 -d ' '); echo COLLECTION_ID=$CID
     -  $ export REF=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 2 -d ' '); echo REF=$REF
-    - "Create the commit with changed timestamp to allow upgrade with recent update file"
+    - "Create the list of files to skip and enshure there are some files in these directories"
+    - $ ls -1d /usr/share/locale /usr/share/man /usr/share/zoneinfo > /tmp/skip
+    - $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
+    - "Create the commit with changed timestamp and skipped list from above to allow upgrade with recent update file"
     - |
-        $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago"); echo "New commit: $NEWID"
+        $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago" --skip-list=/tmp/skip); echo "New commit: $NEWID"
     - "Deploy the prepared commit"
     - $ sudo ostree admin upgrade --allow-downgrade --deploy-only --override-commit=$NEWID --reboot
     - "Wait until the system is booted again and check the deployment"
     - $ sudo ostree admin status
     - "The booted commit (started with '*') must have ID which we prepare and the initial commit ID should be marked as '(rollback)'"
+    - "Check booted deployment have no file objects which we skip"
+    - $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
     - "Remove the initial deployment"
     - $ sudo ostree admin undeploy 1
     - "Reboot the system"
diff --git a/test-cases/apertis-update-manager-manual.yaml b/test-cases/apertis-update-manager-manual.yaml
index 3b2e8c6..8d02323 100644
--- a/test-cases/apertis-update-manager-manual.yaml
+++ b/test-cases/apertis-update-manager-manual.yaml
@@ -31,14 +31,19 @@ run:
     - "Get the Collection ID and ref"
     -  $ export CID=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 1 -d ' '); echo COLLECTION_ID=$CID
     -  $ export REF=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 2 -d ' '); echo REF=$REF
-    - "Create the commit with changed timestamp to allow upgrade with recent update file"
+    - "Create the list of files to skip and enshure there are some files in these directories"
+    - $ ls -1d /usr/share/locale /usr/share/man /usr/share/zoneinfo > /tmp/skip
+    - $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
+    - "Create the commit with changed timestamp and skipped list from above to allow upgrade with recent update file"
     - |
-        $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago"); echo "New commit: $NEWID"
+        $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago" --skip-list=/tmp/skip); echo "New commit: $NEWID"
     - "Deploy the prepared commit"
     - $ sudo ostree admin upgrade --allow-downgrade --deploy-only --override-commit=$NEWID --reboot
     - "Wait until the system is booted again and check the deployment"
     - $ sudo ostree admin status
     - "The booted commit (started with '*') must have ID which we prepare and the initial commit ID should be marked as '(rollback)'"
+    - "Check booted deployment have no file objects which we skip"
+    - $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
     - "Remove the initial deployment"
     - $ sudo ostree admin undeploy 1
     - "Reboot the system"
diff --git a/test-cases/apertis-update-manager-powercut.yaml b/test-cases/apertis-update-manager-powercut.yaml
index 9ab30e9..105f567 100644
--- a/test-cases/apertis-update-manager-powercut.yaml
+++ b/test-cases/apertis-update-manager-powercut.yaml
@@ -35,14 +35,19 @@ run:
     - "Get the Collection ID and ref"
     -  $ export CID=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 1 -d ' '); echo COLLECTION_ID=$CID
     -  $ export REF=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 2 -d ' '); echo REF=$REF
-    - "Create the commit with changed timestamp to allow upgrade with recent update file"
+    - "Create the list of files to skip and enshure there are some files in these directories"
+    - $ ls -1d /usr/share/locale /usr/share/man /usr/share/zoneinfo > /tmp/skip
+    - $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
+    - "Create the commit with changed timestamp and skipped list from above to allow upgrade with recent update file"
     - |
-        $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago"); echo "New commit: $NEWID"
+        $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago" --skip-list=/tmp/skip); echo "New commit: $NEWID"
     - "Deploy the prepared commit"
     - $ sudo ostree admin upgrade --allow-downgrade --deploy-only --override-commit=$NEWID --reboot
     - "Wait until the system is booted again and check the deployment"
     - $ sudo ostree admin status
     - "The booted commit (started with '*') must have ID which we prepare and the initial commit ID should be marked as '(rollback)'"
+    - "Check booted deployment have no file objects which we skip"
+    - $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
     - "Remove the initial deployment"
     - $ sudo ostree admin undeploy 1
     - "Add udev rule for limiting the maximal read speed from USB drive to 1MBps."
diff --git a/test-cases/apertis-update-manager-rollback.yaml b/test-cases/apertis-update-manager-rollback.yaml
index f23f015..9156592 100644
--- a/test-cases/apertis-update-manager-rollback.yaml
+++ b/test-cases/apertis-update-manager-rollback.yaml
@@ -37,14 +37,19 @@ run:
     - "Get the Collection ID and ref"
     -  $ export CID=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 1 -d ' '); echo COLLECTION_ID=$CID
     -  $ export REF=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 2 -d ' '); echo REF=$REF
-    - "Create the commit with changed timestamp to allow upgrade with recent update file"
+    - "Create the list of files to skip and enshure there are some files in these directories"
+    - $ ls -1d /usr/share/locale /usr/share/man /usr/share/zoneinfo > /tmp/skip
+    - $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
+    - "Create the commit with changed timestamp and skipped list from above to allow upgrade with recent update file"
     - |
-        $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago"); echo "New commit: $NEWID"
+        $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago" --skip-list=/tmp/skip); echo "New commit: $NEWID"
     - "Deploy the prepared commit"
     - $ sudo ostree admin upgrade --allow-downgrade --deploy-only --override-commit=$NEWID --reboot
     - "Wait until the system is booted again and check the deployment"
     - $ sudo ostree admin status
     - "The booted commit (started with '*') must have ID which we prepare and the initial commit ID should be marked as '(rollback)'"
+    - "Check booted deployment have no file objects which we skip"
+    - $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
     - "Remove the initial deployment"
     - $ sudo ostree admin undeploy 1
     - "Reboot the system"
diff --git a/test-cases/apertis-update-manager-usb-unplug.yaml b/test-cases/apertis-update-manager-usb-unplug.yaml
index 2c3d740..f0ee4ef 100644
--- a/test-cases/apertis-update-manager-usb-unplug.yaml
+++ b/test-cases/apertis-update-manager-usb-unplug.yaml
@@ -33,14 +33,19 @@ run:
     - "Get the Collection ID and ref"
     -  $ export CID=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 1 -d ' '); echo COLLECTION_ID=$CID
     -  $ export REF=$(sudo ostree refs -c | head -n 1 | tr -d '(),' | cut -f 2 -d ' '); echo REF=$REF
-    - "Create the commit with changed timestamp to allow upgrade with recent update file"
+    - "Create the list of files to skip and enshure there are some files in these directories"
+    - $ ls -1d /usr/share/locale /usr/share/man /usr/share/zoneinfo > /tmp/skip
+    - $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
+    - "Create the commit with changed timestamp and skipped list from above to allow upgrade with recent update file"
     - |
-        $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago"); echo "New commit: $NEWID"
+        $ export NEWID=$(sudo ostree commit --orphan --tree=ref=$BOOTID --add-metadata-string=ostree.collection-binding=$CID --bind-ref=$REF --timestamp="1 year ago" --skip-list=/tmp/skip); echo "New commit: $NEWID"
     - "Deploy the prepared commit"
     - $ sudo ostree admin upgrade --allow-downgrade --deploy-only --override-commit=$NEWID --reboot
     - "Wait until the system is booted again and check the deployment"
     - $ sudo ostree admin status
     - "The booted commit (started with '*') must have ID which we prepare and the initial commit ID should be marked as '(rollback)'"
+    - "Check booted deployment have no file objects which we skip"
+    - $ du -sh /usr/share/locale /usr/share/man /usr/share/zoneinfo
     - "Remove the initial deployment"
     - $ sudo ostree admin undeploy 1
     - "Add udev rule for limiting the maximal read speed from USB drive to 64Kbps."
-- 
GitLab