-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add tests for Endless compat files
Various tests to makes sure that handling of the compat .sig and .sizes2 files works correctly on client and server sides. A repo containing only compat files simulating an old Endless commit is included. [endlessm/eos-shell#5083] https://phabricator.endlessm.com/T11513 Rebase 2016.9: Squashed all the following commits together: tests: Add test for creating compat signature file tests: Check if compat sig file included in pull tests: Check pull behavior from old repo tests: Check if compat files are deleted with prune tests: Check GPG verification when only compat file available tests: Move compat-repo dist outside of conditional tests: Make compat-repo writable in tests directory Rebase 2017.7 (T16919): Squash in feature test fixes which were previously separate patches; fix the SKIP emission to use correct TAP output Rebase 2018.4 (T17367, T22022): Squash in reduction of tests for removed compat object handling features
- Loading branch information
1 parent
7610f0c
commit e727966
Showing
12 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[core] | ||
repo_version=1 | ||
mode=archive-z2 |
Binary file added
BIN
+118 Bytes
...pat-repo/objects/10/9dc1626d2d50bcb1863abd6121d6ec934deae478f52d276b1fa4131b0055ee.commit
Binary file not shown.
Binary file added
BIN
+287 Bytes
...compat-repo/objects/10/9dc1626d2d50bcb1863abd6121d6ec934deae478f52d276b1fa4131b0055ee.sig
Binary file not shown.
Binary file added
BIN
+483 Bytes
...pat-repo/objects/10/9dc1626d2d50bcb1863abd6121d6ec934deae478f52d276b1fa4131b0055ee.sizes2
Binary file not shown.
Binary file added
BIN
+92 Bytes
...mpat-repo/objects/10/dfe586da94ceb6776958df95f6ad6aae859f66b617a68800088e0a500f85a8.filez
Binary file not shown.
Binary file added
BIN
+68 Bytes
...at-repo/objects/d5/85282a65417f5db7f7c979e05400a82f90a34648f291c173be7a4b0910d008.dirmeta
Binary file not shown.
Binary file added
BIN
+70 Bytes
...at-repo/objects/dc/301b0d0ead3543596111ad5918bf6844ffabb0ed4a440346f81932d20a570a.dirtree
Binary file not shown.
Binary file added
BIN
+37 Bytes
...at-repo/objects/e3/c31ef19fac252a3159bdd7f1fb61b9a10d5023fe3c01519f2070c797d2078f.dirtree
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
109dc1626d2d50bcb1863abd6121d6ec934deae478f52d276b1fa4131b0055ee |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
109dc1626d2d50bcb1863abd6121d6ec934deae478f52d276b1fa4131b0055ee main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (C) 2015 Dan Nicholson <nicholson@endlessm.com> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
# License as published by the Free Software Foundation; either | ||
# version 2 of the License, or (at your option) any later version. | ||
# | ||
# This library is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
# Lesser General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Lesser General Public | ||
# License along with this library; if not, write to the | ||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
# Boston, MA 02111-1307, USA. | ||
|
||
set -euo pipefail | ||
|
||
. $(dirname $0)/libtest.sh | ||
|
||
if ! has_gpgme; then | ||
echo "1..0 #SKIP no gpg support compiled in" | ||
exit 0 | ||
fi | ||
|
||
setup_test_repository "archive-z2" | ||
|
||
echo '1..6' | ||
|
||
cd ${test_tmpdir} | ||
${OSTREE} commit -b test2 -s "A GPG signed commit" -m "Signed commit body" \ | ||
--gpg-sign=${TEST_GPG_KEYID_1} --gpg-homedir=${TEST_GPG_KEYHOME} \ | ||
--tree=dir=files | ||
find repo/objects -name '*.sig' | wc -l > sigcount | ||
assert_file_has_content sigcount "^0$" | ||
|
||
echo "ok commit sign no old signature" | ||
|
||
setup_fake_remote_repo1 "archive-z2" | ||
|
||
cd ${test_tmpdir} | ||
${CMD_PREFIX} ostree --repo=${test_tmpdir}/ostree-srv/gnomerepo \ | ||
commit -b main -s "A GPG signed commit" -m "Signed commit body" \ | ||
--gpg-sign=${TEST_GPG_KEYID_1} --gpg-homedir=${TEST_GPG_KEYHOME} \ | ||
--tree=dir=files | ||
|
||
rm -rf local | ||
mkdir local | ||
${CMD_PREFIX} ostree --repo=local init | ||
${CMD_PREFIX} ostree --repo=local remote add --set=gpg-verify=false origin \ | ||
$(cat httpd-address)/ostree/gnomerepo | ||
${CMD_PREFIX} ostree --repo=local pull origin main | ||
find local/objects -name '*.sig' | wc -l > sigcount | ||
assert_file_has_content sigcount "^0$" | ||
|
||
echo "ok compat pull" | ||
|
||
# Test pulls from a repo containing a commit made with old ostree. | ||
# Create a couple needed directories not tracked in git. | ||
cd ${test_tmpdir} | ||
rm -rf compat-repo | ||
cp -a ${test_srcdir}/compat-repo . | ||
chmod -R u+w compat-repo | ||
mkdir -p compat-repo/tmp compat-repo/refs/remotes | ||
|
||
rm -rf local | ||
mkdir local | ||
${CMD_PREFIX} ostree --repo=local init --mode=archive-z2 | ||
${CMD_PREFIX} ostree --repo=local pull-local compat-repo main | ||
find local/objects -name '*.sig' | wc -l > sigcount | ||
assert_file_has_content sigcount "^0$" | ||
find local/objects -name '*.sizes2' | wc -l > sizescount | ||
assert_file_has_content sizescount "^0$" | ||
|
||
echo "ok compat pull-local from old repo" | ||
|
||
ln -s ${test_tmpdir}/compat-repo ${test_tmpdir}/httpd/ | ||
|
||
rm -rf local | ||
mkdir local | ||
${CMD_PREFIX} ostree --repo=local init --mode=archive-z2 | ||
${CMD_PREFIX} ostree --repo=local remote add --set=gpg-verify=false origin \ | ||
$(cat httpd-address)/compat-repo | ||
${CMD_PREFIX} ostree --repo=local pull origin main | ||
find local/objects -name '*.sig' | wc -l > sigcount | ||
assert_file_has_content sigcount "^0$" | ||
find local/objects -name '*.sizes2' | wc -l > sizescount | ||
assert_file_has_content sizescount "^0$" | ||
|
||
echo "ok compat pull from old repo" | ||
|
||
rm -rf local | ||
mkdir local | ||
${CMD_PREFIX} ostree --repo=local init --mode=archive-z2 | ||
${CMD_PREFIX} ostree --repo=local remote add origin \ | ||
$(cat httpd-address)/compat-repo | ||
if ${CMD_PREFIX} ostree --repo=local pull origin main; then | ||
fatal "pulled commit verified unexpectedly" | ||
fi | ||
|
||
echo "ok compat pull from old repo with verification fails" | ||
|
||
${CMD_PREFIX} ostree --repo=compat-repo refs --delete main | ||
${CMD_PREFIX} ostree --repo=compat-repo prune --depth=-1 --refs-only | ||
find compat-repo/objects -type f | wc -l > objcount | ||
assert_file_has_content objcount "^0$" | ||
|
||
echo "ok compat prune" |