From a65dca5d5e9b4bc71722bc91a5641126a1b0ec61 Mon Sep 17 00:00:00 2001 From: Simon Johnsson Date: Thu, 2 Oct 2025 12:49:58 +0200 Subject: Add history undo, redo, and rollback features --- test/integration/test-history | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'test/integration') 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 - -- cgit v1.2.3-70-g09d2