Skip to content

Commit b017a5e

Browse files
committed
fix and cookiejar in wrong place
1 parent 461f520 commit b017a5e

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/integration.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,31 @@ jobs:
6161
zip -r "../${i}.zip" -- *
6262
)
6363
curl --fail -X POST -n -N -F zip=@${i}.zip http://localhost/domjudge/api/contests/demo/problems
64-
done
64+
done
65+
- name: Preparing curl cookiejar
66+
run: |
67+
export CURLOPTS="--fail -sq -m 30 -b /tmp/cookiejar"
68+
# Make an initial request which will get us a session id, and grab the csrf token from it
69+
CSRFTOKEN=$(curl $CURLOPTS -c $COOKIEJAR "http://localhost/domjudge/login" 2>/dev/null | sed -n 's/.*_csrf_token.*value="\(.*\)".*/\1/p')
70+
# Make a second request with our session + csrf token to actually log in
71+
curl $CURLOPTS -c $COOKIEJAR -F "_csrf_token=$CSRFTOKEN" -F "_username=admin" -F "_password=password" "http://localhost/domjudge/login"
72+
# Send a general clarification to later test if we see the event.
73+
curl $CURLOPTS -F "sendto=" -F "problem=1-" -F "bodytext=Testing" -F "submit=Send" \
74+
"http://localhost/domjudge/jury/clarifications/send" -o /dev/null
75+
NUMNOTVERIFIED=$(curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier" | grep "submissions checked" | sed -r 's/^.* ([0-9]+) submissions checked.*$/\1/')
76+
NUMVERIFIED=$( curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier" | grep "submissions not checked" | sed -r 's/^.* ([0-9]+) submissions not checked.*$/\1/')
77+
NUMNOMAGIC=$( curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier" | grep "without magic string" | sed -r 's/^.* ([0-9]+) without magic string.*$/\1/')
78+
# We expect
79+
# - two submissions with ambiguous outcome,
80+
# - one submissions submitted through the submit client, and thus the magic string ignored,
81+
# - and all submissions to be judged.
82+
if [ $NUMNOTVERIFIED -ne 2 ] || [ $NUMNOMAGIC -ne 1 ] || [ $NUMSUBS -gt $((NUMVERIFIED+NUMNOTVERIFIED)) ]; then
83+
echo "verified subs: $NUMVERIFIED, unverified subs: $NUMNOTVERIFIED, total subs: $NUMSUBS"
84+
echo "(expected 2 submissions to be unverified, but all to be processed)"
85+
echo "Of these $NUMNOMAGIC do not have the EXPECTED_RESULTS string (should be 1)."
86+
curl $CURLOPTS "http://localhost/domjudge/jury/judging-verifier?verify_multiple=1" | w3m -dump -T text/html
87+
exit 1
88+
fi
6589
- name: Monitor judgehost log and stop once all submissions are judged
6690
run: |
6791
tail -f /opt/domjudge/judgehost/log/judge*-0.log | while read line; do

0 commit comments

Comments
 (0)