summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Johnsson <simon.johnsson@canonical.com>2025-10-02 12:49:58 +0200
committerJulian Andres Klode <jak@debian.org>2025-10-02 10:49:58 +0000
commita65dca5d5e9b4bc71722bc91a5641126a1b0ec61 (patch)
tree8a49e2f43956bcb5fb5e6976a3636b95ebc1248e /test
parentb1e10340d5b9cd6fd12f968b5ddd9b7a70b827cb (diff)
Add history undo, redo, and rollback features
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-history43
1 files changed, 42 insertions, 1 deletions
diff --git a/test/integration/test-history b/test/integration/test-history
index 76dc04630..e10dab08e 100755
--- a/test/integration/test-history
+++ b/test/integration/test-history
@@ -69,6 +69,48 @@ testsuccessequal "ID Command line Date and Time Action C
0 dummy dummy Install 1
1 dummy dummy Install 1 " normalizedlist
+################################################################################
+# Read previous history for manipulation
+################################################################################
+
+# Test history
+# 0 - Install pkg1
+# 1 - Install pkg2
+# 2 - Remove pkg1 (undo ID 0)
+# 3 - Install pkg1 (undo ID 2)
+# 4 - Remove pkg1 (redo ID 2)
+# 5 - Install pkg1 (rollback to ID 1)
+# 6 - Remove pkg1 (rollback to ID 2)
+
+testdpkginstalled pkg1
+# undo the first package install
+apt history-undo 0 -y >> /dev/null
+testdpkgnotinstalled pkg1
+# ...which generates a new id that we also undo
+apt history-undo 2 -y >>/dev/null
+testdpkginstalled pkg1
+
+# redo the removal
+apt history-redo 2 -y >> /dev/null
+testdpkgnotinstalled pkg1
+
+# rollback to ID 1 and it should be installed
+apt history-rollback 1 -y >> /dev/null
+testdpkginstalled pkg1
+# rollback to ID 2 and it should be removed
+apt history-rollback 2 -y >> /dev/null
+testdpkgnotinstalled pkg1
+# rollback to ID 0 and it should be installed
+apt history-rollback 0 -y >> /dev/null
+testdpkginstalled pkg1
+# rollback to ID 4 and it should be removed
+apt history-rollback 4 -y >> /dev/null
+testdpkgnotinstalled pkg1
+
+################################################################################
+# Reset history log
+################################################################################
+
msgmsg "Actionless group"
cat > rootdir/var/log/apt/history.log << EOF
Start-Date: dummy
@@ -86,4 +128,3 @@ End time: dummy
Requested by:
Command line: install nothing
Packages changed:" normalizedinfo
-