Skip to content

Commit

Permalink
Adjust integration test for printing API
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevinjil committed Nov 26, 2024
1 parent 0414353 commit 87cbe4e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ jobs:
run: sudo misc-tools/dj_make_chroot -a amd64
- name: Check nginx
run: curl -v https://localhost/domjudge/
- name: Configure print command
working-directory: submit
run: |
curl --fail -u 'admin:password' -X 'GET' 'http://localhost/domjudge/api/v4/config?strict=false' \
| jq '.print_command |= "cp [file] /tmp/dj-printfile"' \
| curl --fail -u 'admin:password' -X 'PUT' -T - 'http://localhost/domjudge/api/v4/config?strict=false' \
- name: Testing submit client
working-directory: submit
run: make check-full
Expand Down
9 changes: 9 additions & 0 deletions submit/submit_online.bats
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,12 @@ setup() {
assert_regex "Submission received: id = s[0-9]*, time = [0-9]{2}:[0-9]{2}:[0-9]{2}"
assert_regex "Check http[^ ]*/[0-9]* for the result."
}

@test "submit print job" {
run ./submit -P -l C ../example_problems/hello/submissions/accepted/test-hello.c
assert_success
assert_regex "DOMjudge reported a successful print job."
run diff /tmp/dj-printfile ../example_problems/hello/submissions/accepted/test-hello.c
# Diff has exit code 0 iff the files are equal
assert_success
}
2 changes: 1 addition & 1 deletion submit/submit_standalone.bats
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ setup() {
@test "display basic usage information" {
run ./submit --help
assert_success
assert_line "usage: submit [--version] [-h] [-c CONTEST] [-p PROBLEM] [-l LANGUAGE] [-e ENTRY_POINT]"
assert_line "usage: submit [--version] [-h] [-c CONTEST] [-P] [-p PROBLEM] [-l LANGUAGE] [-e ENTRY_POINT]"
assert_line " [-v [{DEBUG,INFO,WARNING,ERROR,CRITICAL}]] [-q] [-y] [-u URL]"
# The help printer does print this differently on versions of argparse for nargs=*.
assert_regex " (filename )?[filename ...]"
Expand Down

0 comments on commit 87cbe4e

Please sign in to comment.