chiark / gitweb /
Test suite: start work on test of policy machinery
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Apr 2015 21:51:33 +0000 (22:51 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 10:54:06 +0000 (11:54 +0100)
tests/lib
tests/tests/debpolicy-newreject [new file with mode: 0755]

index 7a5ede5..cb5c649 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -7,6 +7,7 @@ if [ "x$DGIT_TEST_INTREE" != x ]; then
        : ${DGIT_TEST:=$DGIT_TEST_INTREE/dgit}
        : ${DGIT_REPOS_SERVER_TEST:=$DGIT_TEST_INTREE/infra/dgit-repos-server}
        : ${DGIT_SSH_DISPATCH_TEST:=$DGIT_TEST_INTREE/infra/dgit-ssh-dispatch}
+       : ${DGIT_INFRA_PFX:=$DGIT_TEST_INTREE${DGIT_TEST_INTREE:+/infra/}}
        export DGIT_TEST DGIT_REPOS_SERVER_TEST DGIT_SSH_DISPATCH_TEST
 fi
 
@@ -353,6 +354,20 @@ t-dsd () {
        echo 'no-such-package* drs' >$dsd_dispatch/diverts
 }
 
+t-policy-admin () {
+       ${DGIT_INFRA_PFX}dgit-repos-admin-debian --repos $tmp/git "$@"
+}
+
+t-debpolicy () {
+       t-dsd
+
+       ln -sf ${DGIT_INFRA_PFX}dgit-repos-policy-debian \
+               $dsd_dispatch/policy-hook
+
+       mkdir $tmp/git
+       t-policy-admin create-db
+}
+
 t-chain-test () {
        local ct=$1
        local d=${0%/*}
diff --git a/tests/tests/debpolicy-newreject b/tests/tests/debpolicy-newreject
new file mode 100755 (executable)
index 0000000..de01a53
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+set -e
+. tests/lib
+
+export DGIT_DRS_DEBUG=1
+
+t-debpolicy
+t-prep-newpackage pari-extra 3.1
+
+cd $p
+
+
+echo FORBIDDEN >debian/some-file
+git add debian/some-file
+git commit -m 'Commit a forbidden thing'
+
+bad=`git rev-parse HEAD:debian/some-file`
+t-policy-admin taint --global "$bad" "forbidden for testing"
+
+t-dgit build
+t-expect-fail 'forbidden for testing' \
+t-dgit push --new
+
+echo xxx up to here