diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-09-24 22:21:38 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-09-24 22:21:38 +0200 |
commit | e86fbc7275c036cefe75d7c46b0f11898bde1c6c (patch) | |
tree | 91ab1d24bfb234eced5ec75937c40b93a8b3779a | |
parent | 6cc629a3b7576d454589ffb38f49869d30926d02 (diff) | |
download | planetwars.dev-e86fbc7275c036cefe75d7c46b0f11898bde1c6c.tar.xz planetwars.dev-e86fbc7275c036cefe75d7c46b0f11898bde1c6c.zip |
test regular docker runner operation
-rw-r--r-- | planetwars-matchrunner/bots/echo_bot.py | 5 | ||||
-rw-r--r-- | planetwars-matchrunner/tests/test_matchrunner.rs | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/planetwars-matchrunner/bots/echo_bot.py b/planetwars-matchrunner/bots/echo_bot.py new file mode 100644 index 0000000..328d914 --- /dev/null +++ b/planetwars-matchrunner/bots/echo_bot.py @@ -0,0 +1,5 @@ +import sys + +for line in sys.stdin: + sys.stdout.write(line) + sys.stdout.flush()
\ No newline at end of file diff --git a/planetwars-matchrunner/tests/test_matchrunner.rs b/planetwars-matchrunner/tests/test_matchrunner.rs index 5b96406..131a7b8 100644 --- a/planetwars-matchrunner/tests/test_matchrunner.rs +++ b/planetwars-matchrunner/tests/test_matchrunner.rs @@ -78,6 +78,22 @@ where } #[tokio::test] +async fn docker_runner_success() { + let bot_spec = simple_python_docker_bot_spec("./bots", "echo_bot.py"); + with_bot_match_ctx(bot_spec, |ctx| { + async move { + let resp = ctx + .request(1, b"sup".to_vec(), Duration::from_millis(200)) + .await; + + assert_eq!(resp, Ok(b"sup\n".to_vec())); + } + .boxed() + }) + .await; +} + +#[tokio::test] async fn docker_runner_timeout() { let bot_spec = simple_python_docker_bot_spec("./bots", "timeout_bot.py"); with_bot_match_ctx(bot_spec, |ctx| { |