From 5643c8d41c50c76f317575c17560032de3f50b99 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/jobs/baseinstall.sh | 1 - .github/workflows/integration.yml | 3 +++ submit/submit_online.bats | 6 ++++++ submit/submit_standalone.bats | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/jobs/baseinstall.sh b/.github/jobs/baseinstall.sh index 2c61bc2a7b..b91a781e68 100755 --- a/.github/jobs/baseinstall.sh +++ b/.github/jobs/baseinstall.sh @@ -139,4 +139,3 @@ elif [ "$version" = "all" ]; then mysql_root "UPDATE user SET teamid = 1 WHERE userid = 1;" domjudge fi section_end - diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 56ee842a2c..da88487e04 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -42,6 +42,9 @@ jobs: run: sudo misc-tools/dj_make_chroot -a amd64 - name: Check nginx run: curl -v https://localhost/domjudge/ + - name: Test printing + working-directory: submit + run: curl --fail -u "admin:$(cat ../etc/initial_admin_password.secret)" -X 'PUT' -d 'print_command=cp [file] /tmp/dj-printfile' "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 ...]"