From a3e687bdf792892e926d4ef7c7d9e15800811519 Mon Sep 17 00:00:00 2001 From: Kevin Jilissen Date: Sat, 23 Nov 2024 18:33:09 +0100 Subject: [PATCH] DONTMERGE: implement integration test --- .github/workflows/integration.yml | 6 ++++++ submit/submit_online.bats | 6 ++++++ submit/submit_standalone.bats | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 56ee842a2c..e9d9d0c651 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -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 diff --git a/submit/submit_online.bats b/submit/submit_online.bats index 1177854542..f97bdb0f0c 100755 --- a/submit/submit_online.bats +++ b/submit/submit_online.bats @@ -136,3 +136,9 @@ 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." +} diff --git a/submit/submit_standalone.bats b/submit/submit_standalone.bats index dd476fd6e8..dcaffe5250 100755 --- a/submit/submit_standalone.bats +++ b/submit/submit_standalone.bats @@ -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 ...]"