From ccaf3d8f6722fc18ca919d02cb93ddfca6315343 Mon Sep 17 00:00:00 2001 From: Matthew Johnson Date: Thu, 26 Jul 2018 09:46:19 -0700 Subject: [PATCH] swupd: add test for trimmed deletes over format bump Signed-off-by: Matthew Johnson --- swupd/create_manifests_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/swupd/create_manifests_test.go b/swupd/create_manifests_test.go index aca4771..d79a61d 100644 --- a/swupd/create_manifests_test.go +++ b/swupd/create_manifests_test.go @@ -388,6 +388,30 @@ func TestCreateManifestsMVDeletes(t *testing.T) { fileDeletedInManifest(t, ts.parseManifest(30, "full"), 30, "/foo") } +func TestCreateManifestsFormatDeletes(t *testing.T) { + ts := newTestSwupd(t, "formatDeletes") + defer ts.cleanup() + + ts.Bundles = []string{"test-bundle"} + ts.addFile(10, "test-bundle", "/foo", "foo") + ts.createManifests(10) + ts.checkContains("www/10/Manifest.test-bundle", "10\t/foo\n") + ts.checkContains("www/10/Manifest.full", "10\t/foo\n") + + // update and remove /foo + ts.createManifests(20) + fileDeletedInManifest(t, ts.parseManifest(20, "test-bundle"), 20, "/foo") + fileDeletedInManifest(t, ts.parseManifest(20, "full"), 20, "/foo") + + // now create a minversion and format bump + ts.Format = 2 + ts.MinVersion = 30 + ts.createManifests(30) + + fileNotInManifest(t, ts.parseManifest(30, "test-bundle"), "/foo") + fileNotInManifest(t, ts.parseManifest(30, "full"), "/foo") +} + func TestCreateManifestsPersistDeletes(t *testing.T) { ts := newTestSwupd(t, "persistDeletes") defer ts.cleanup()