Re-instate .selfsigned check in assert_rhizome_list()

Also add checks for the "version", "date" and ".inserttime" columns, that they
match the corresponding manifest or are at least well formed.

Issue #9.
This commit is contained in:
Andrew Bettison 2012-10-04 14:22:06 +09:30
parent 37d4b4fa3a
commit f18d7ba9af

View File

@ -46,18 +46,18 @@ assert_manifest_complete() {
}
assert_rhizome_list() {
# PGS 20121002 - Removed sensitivity to self-signed flag, because it will be
# different between originator and a receiver of a bundle.
assertStdoutLineCount --stderr '==' $(($# + 2))
assertStdoutIs --stderr --line=1 -e '11\n'
assertStdoutIs --stderr --line=2 -e 'service:id:version:date:.inserttime:.selfsigned:filesize:filehash:sender:recipient:name\n'
local filename
local re__inserttime="$rexp_date"
for filename; do
re__selfsigned=1
case "$filename" in
*!) filename="${filename%!}"; re__selfsigned=0;;
esac
unpack_manifest_for_grep "$filename"
assertStdoutGrep --stderr --matches=1 "^$re_service:$re_manifestid:.*:.*:$re_filesize:$re_filehash:$re_sender:$re_recipient:$re_name\$"
assertStdoutGrep --stderr --matches=1 "^$re_service:$re_manifestid:$re_version:$re_date:$re__inserttime:$re__selfsigned:$re_filesize:$re_filehash:$re_sender:$re_recipient:$re_name\$"
done
}
@ -108,6 +108,7 @@ unpack_manifest_for_grep() {
re_service="$rexp_service"
re_manifestid="$rexp_manifestid"
re_version="$rexp_version"
re_date="$rexp_date"
re_secret="$rexp_bundlesecret"
re_name=$(escape_grep_basic "${filename##*/}")
local filesize=$($SED -n -e '/^filesize=/s///p' "$filename.manifest" 2>/dev/null)
@ -125,6 +126,7 @@ unpack_manifest_for_grep() {
if [ "$filehash" = "$re_filehash" ]; then
re_manifestid=$($SED -n -e '/^id=/s///p' "$filename.manifest")
re_version=$($SED -n -e '/^version=/s///p' "$filename.manifest")
re_date=$($SED -n -e '/^date=/s///p' "$filename.manifest")
re_service=$($SED -n -e '/^service=/s///p' "$filename.manifest")
re_service=$(escape_grep_basic "$re_service")
re_sender=$($SED -n -e '/^sender=/s///p' "$filename.manifest")