summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2022-12-28 13:25:59 +0000
committerIan Jackson <ijackson@chiark.greenend.org.uk>2022-12-28 23:47:15 +0000
commit6fe6632091fd92f7017976915e81f262c8a428a9 (patch)
treec093848ac36a00f99b8c3747c4dde5b1222e679f
parentbae3427d6efe421d8032b2b8697f134b99ed41d8 (diff)
tainted-objects: tests: Fix and improve debpolicy-newreject
Replace several t-expect-push-fail with t-expect-push-fail-tainted. Abolish the adhoc use of --force-push-tainted. Adjust the expected errors accordingly. Fix the expected errors to use anchored patterns (see the comment for t-expect-push-fail-tainted). Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
-rwxr-xr-xtests/tests/debpolicy-newreject37
1 files changed, 23 insertions, 14 deletions
diff --git a/tests/tests/debpolicy-newreject b/tests/tests/debpolicy-newreject
index 61f7951..05a0a4f 100755
--- a/tests/tests/debpolicy-newreject
+++ b/tests/tests/debpolicy-newreject
@@ -27,7 +27,8 @@ t-git-objects-not-present "" $bad
'
t-dgit build
-t-expect-push-fail 'forbidden for testing' \
+t-expect-push-fail-tainted \
+ 'Reason: forbidden for testing' \
t-dgit push --new
t-git-dir-check enoent
@@ -53,7 +54,8 @@ t-git-dir-check enoent
t-commit 'should require --deliberately...questionable'
t-dgit build
-t-expect-push-fail E:"tag $tagpfx/${vanished//./\\.} referred to this object.*all previously pushed versions were found to have been removed" \
+t-expect-push-fail-tainted \
+ "Reason: tag $tagpfx/${vanished//./\\.} referred to this object.*all previously pushed versions were found to have been removed" \
t-dgit push --new
t-git-dir-check enoent
@@ -77,11 +79,15 @@ git reset --hard start
t-commit 'should require --deliberately..not-ff'
t-dgit build
-t-expect-push-fail "HEAD is not a descendant of the archive's version" \
+# Rewound, without passing the option
+t-expect-push-fail-retriably \
+ E:"^dgit: error: .* HEAD is not a descendant of the archive's version" \
t-dgit push
+# Rewound, passing stunt option to defeat local checks
+# so we check that remote check is effective.
t-expect-push-fail \
- "Package is in NEW and has not been accepted or rejected yet" \
+ E:"^remote: Package is in NEW and has not been accepted or rejected yet" \
t-dgit --deliberately-TEST-dgit-only-not-fast-forward push
t-dgit --deliberately-not-fast-forward --force-reusing-version push
@@ -93,13 +99,12 @@ cd $tmp/$p
t-commit 'Still not accepted, will override taint'
t-dgit build
-t-expect-push-fail \
+t-expect-push-fail-tainted \
"Package is in NEW and has not been accepted or rejected yet" \
t-dgit push
t-dgit push --deliberately-include-questionable-history \
- --force-reusing-version --force-push-tainted
-# TODO remove --force-push-tainted and test both local and remote reject
+ --force-reusing-version
t-archive-process-incoming sid
@@ -110,19 +115,23 @@ t-dgit push
git checkout -b stoats $tagpfx/$vanished
t-commit 'Simulate accidentally building on rejected version'
t-dgit build
-t-expect-push-fail "HEAD is not a descendant of the archive's version" \
+t-expect-push-fail \
+ E:"^dgit: error:.* HEAD is not a descendant of the archive's version" \
t-dgit push
: "check that uploader can't force it now"
-t-expect-push-fail "not fast forward on dgit branch" \
-t-dgit --deliberately-not-fast-forward push --force-push-tainted
-# TODO remove --force-push-tainted and test both local and remote reject
+t-expect-push-fail \
+ E:"^remote: .*: reject: not fast forward on dgit branch" \
+t-dgit --deliberately-not-fast-forward push \
+ --deliberately-include-questionable-history \
+ --force-push-tainted
+# Ideally ^ this would be detected locally first, in which case we would
+# use t-expect-push-fail-tainted or something like it. But it isn't.
t-dgit pull
t-dgit build
-t-expect-push-fail \
+t-expect-push-fail-tainted \
'Reason: rewound suite sid; --deliberately-not-fast-forward specified' \
-t-dgit --force-reusing-version push --force-push-tainted
-# TODO remove --force-push-tainted and test both local and remote reject
+t-dgit --force-reusing-version push
t-ok