From 87d601d05a24d4110aeff38c09882cf0200ea413 Mon Sep 17 00:00:00 2001 From: Icarus Sparry Date: Mon, 19 Mar 2018 10:44:56 -0700 Subject: [PATCH] New test for issue 412 Create a test-bundle manifest with a stupid number of files, see that it is rejected. Unfortunately because of retries this takes a long time (70 seconds) time to run. Signed-off-by: Icarus Sparry --- .../bundleadd/bad-manifest/lines-checked | 18 ++++++++++++++ .../target-dir/usr/lib/os-release | 9 +++++++ .../usr/share/clear/bundles/os-core | 0 .../bundleadd/bad-manifest/test.bats | 24 +++++++++++++++++++ .../bad-manifest/web-dir/10/Manifest.os-core | 14 +++++++++++ .../web-dir/10/Manifest.test-bundle | 8 +++++++ ...bfdbdec784afef5a82ffa54e8c93bda3e0883360a3 | 1 + ...bfdbdec784afef5a82ffa54e8c93bda3e0883360a3 | 1 + .../web-dir/version/formatstaging/latest | 1 + 9 files changed, 76 insertions(+) create mode 100644 test/functional/bundleadd/bad-manifest/lines-checked create mode 100644 test/functional/bundleadd/bad-manifest/target-dir/usr/lib/os-release create mode 100644 test/functional/bundleadd/bad-manifest/target-dir/usr/share/clear/bundles/os-core create mode 100755 test/functional/bundleadd/bad-manifest/test.bats create mode 100644 test/functional/bundleadd/bad-manifest/web-dir/10/Manifest.os-core create mode 100644 test/functional/bundleadd/bad-manifest/web-dir/10/Manifest.test-bundle create mode 100644 test/functional/bundleadd/bad-manifest/web-dir/10/files/e6d85023c5e619eb43d5cfbfdbdec784afef5a82ffa54e8c93bda3e0883360a3 create mode 100644 test/functional/bundleadd/bad-manifest/web-dir/10/staged/e6d85023c5e619eb43d5cfbfdbdec784afef5a82ffa54e8c93bda3e0883360a3 create mode 100644 test/functional/bundleadd/bad-manifest/web-dir/version/formatstaging/latest diff --git a/test/functional/bundleadd/bad-manifest/lines-checked b/test/functional/bundleadd/bad-manifest/lines-checked new file mode 100644 index 00000000..a9da6c6b --- /dev/null +++ b/test/functional/bundleadd/bad-manifest/lines-checked @@ -0,0 +1,18 @@ +Error: preposterous (9000000) number of files in test-bundle Manifest, more than 4 million skipping +Warning: Removing corrupt Manifest.test-bundle artifacts and re-downloading... +Error: preposterous (9000000) number of files in test-bundle Manifest, more than 4 million skipping +Failed to load 10 test-bundle manifest +Error: preposterous (9000000) number of files in test-bundle Manifest, more than 4 million skipping +Warning: Removing corrupt Manifest.test-bundle artifacts and re-downloading... +Error: preposterous (9000000) number of files in test-bundle Manifest, more than 4 million skipping +Failed to load 10 test-bundle manifest +Error: preposterous (9000000) number of files in test-bundle Manifest, more than 4 million skipping +Warning: Removing corrupt Manifest.test-bundle artifacts and re-downloading... +Error: preposterous (9000000) number of files in test-bundle Manifest, more than 4 million skipping +Failed to load 10 test-bundle manifest +Error: preposterous (9000000) number of files in test-bundle Manifest, more than 4 million skipping +Warning: Removing corrupt Manifest.test-bundle artifacts and re-downloading... +Error: preposterous (9000000) number of files in test-bundle Manifest, more than 4 million skipping +Failed to load 10 test-bundle manifest +Unable to download manifest test-bundle version 10, exiting now +Error: Processing error - Aborting diff --git a/test/functional/bundleadd/bad-manifest/target-dir/usr/lib/os-release b/test/functional/bundleadd/bad-manifest/target-dir/usr/lib/os-release new file mode 100644 index 00000000..d20f3873 --- /dev/null +++ b/test/functional/bundleadd/bad-manifest/target-dir/usr/lib/os-release @@ -0,0 +1,9 @@ +NAME="Clear Linux Software for Intel Architecture" +VERSION=1 +ID=clear-linux-os +VERSION_ID=10 +PRETTY_NAME="Clear Linux Software for Intel Architecture" +ANSI_COLOR="1;35" +HOME_URL="https://clearlinux.org" +SUPPORT_URL="https://clearlinux.org" +BUG_REPORT_URL="https://bugs.clearlinux.org/jira" diff --git a/test/functional/bundleadd/bad-manifest/target-dir/usr/share/clear/bundles/os-core b/test/functional/bundleadd/bad-manifest/target-dir/usr/share/clear/bundles/os-core new file mode 100644 index 00000000..e69de29b diff --git a/test/functional/bundleadd/bad-manifest/test.bats b/test/functional/bundleadd/bad-manifest/test.bats new file mode 100755 index 00000000..157f5c8f --- /dev/null +++ b/test/functional/bundleadd/bad-manifest/test.bats @@ -0,0 +1,24 @@ +#!/usr/bin/env bats + +load "../../swupdlib" + +setup() { + clean_test_dir + create_manifest_tar 10 MoM + sign_manifest_mom 10 + create_manifest_tar 10 test-bundle +} + +teardown() { + clean_tars 10 +} + +@test "bundle-add add bundle with invalid number of files in manifest" { + run sudo sh -c "$SWUPD bundle-add $SWUPD_OPTS test-bundle" + + # it will retry a number of times, so takes about 70 seconds + [ "$status" -gt 0 ] + check_lines "$output" +} + +# vi: ft=sh ts=8 sw=2 sts=2 et tw=80 diff --git a/test/functional/bundleadd/bad-manifest/web-dir/10/Manifest.os-core b/test/functional/bundleadd/bad-manifest/web-dir/10/Manifest.os-core new file mode 100644 index 00000000..8184dc11 --- /dev/null +++ b/test/functional/bundleadd/bad-manifest/web-dir/10/Manifest.os-core @@ -0,0 +1,14 @@ +MANIFEST 3 +version: 10 +previous: 0 +filecount: 7 +timestamp: 1451936779 +contentsize: 17929151 + +D... cde33514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr +D... dde33514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr/lib +D... ede33514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr/lib/kernel +D... cde13514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr/share +D... cde23514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr/share/clear +D... cde43514c151abb2b01448be290ab1d5212952571d15e3533cadc15ff82f2cd5 10 /usr/share/clear/bundles +F... b85f1dc2c2317a20f47a36d3257313b131124ffa6d4f19bb060d43014fd386b0 10 /usr/share/clear/bundles/os-core diff --git a/test/functional/bundleadd/bad-manifest/web-dir/10/Manifest.test-bundle b/test/functional/bundleadd/bad-manifest/web-dir/10/Manifest.test-bundle new file mode 100644 index 00000000..b5ca813e --- /dev/null +++ b/test/functional/bundleadd/bad-manifest/web-dir/10/Manifest.test-bundle @@ -0,0 +1,8 @@ +MANIFEST 3 +version: 10 +previous: 0 +filecount: 9000000 +timestamp: 1451936779 +contentsize: 17929151 + +F... e6d85023c5e619eb43d5cfbfdbdec784afef5a82ffa54e8c93bda3e0883360a3 10 /testfile diff --git a/test/functional/bundleadd/bad-manifest/web-dir/10/files/e6d85023c5e619eb43d5cfbfdbdec784afef5a82ffa54e8c93bda3e0883360a3 b/test/functional/bundleadd/bad-manifest/web-dir/10/files/e6d85023c5e619eb43d5cfbfdbdec784afef5a82ffa54e8c93bda3e0883360a3 new file mode 100644 index 00000000..539f3894 --- /dev/null +++ b/test/functional/bundleadd/bad-manifest/web-dir/10/files/e6d85023c5e619eb43d5cfbfdbdec784afef5a82ffa54e8c93bda3e0883360a3 @@ -0,0 +1 @@ +test file MODIFIED1 diff --git a/test/functional/bundleadd/bad-manifest/web-dir/10/staged/e6d85023c5e619eb43d5cfbfdbdec784afef5a82ffa54e8c93bda3e0883360a3 b/test/functional/bundleadd/bad-manifest/web-dir/10/staged/e6d85023c5e619eb43d5cfbfdbdec784afef5a82ffa54e8c93bda3e0883360a3 new file mode 100644 index 00000000..539f3894 --- /dev/null +++ b/test/functional/bundleadd/bad-manifest/web-dir/10/staged/e6d85023c5e619eb43d5cfbfdbdec784afef5a82ffa54e8c93bda3e0883360a3 @@ -0,0 +1 @@ +test file MODIFIED1 diff --git a/test/functional/bundleadd/bad-manifest/web-dir/version/formatstaging/latest b/test/functional/bundleadd/bad-manifest/web-dir/version/formatstaging/latest new file mode 100644 index 00000000..f599e28b --- /dev/null +++ b/test/functional/bundleadd/bad-manifest/web-dir/version/formatstaging/latest @@ -0,0 +1 @@ +10