aboutsummaryrefslogtreecommitdiff
path: root/planetwars-matchrunner/tests
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-12-03 15:57:59 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2022-12-03 16:09:42 +0100
commit453ff83e6cda30100e9c7d8079854f651f1e3787 (patch)
tree6cd1fe02d7354d7830fecb71874aa19c6c988b4f /planetwars-matchrunner/tests
parentc7d973406790056451af2af24630f03409a9647e (diff)
downloadplanetwars.dev-453ff83e6cda30100e9c7d8079854f651f1e3787.tar.xz
planetwars.dev-453ff83e6cda30100e9c7d8079854f651f1e3787.zip
hotfix: enable reading lines split over multiple stdout buffers
Diffstat (limited to 'planetwars-matchrunner/tests')
-rw-r--r--planetwars-matchrunner/tests/test_matchrunner.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/planetwars-matchrunner/tests/test_matchrunner.rs b/planetwars-matchrunner/tests/test_matchrunner.rs
index 43afd85..c2b324c 100644
--- a/planetwars-matchrunner/tests/test_matchrunner.rs
+++ b/planetwars-matchrunner/tests/test_matchrunner.rs
@@ -148,3 +148,20 @@ async fn docker_runner_crash() {
})
.await;
}
+
+#[tokio::test]
+async fn test_long_line() {
+ let bot_spec = simple_python_docker_bot_spec("./bots", "echo_bot.py");
+ let len = 10 * 2_usize.pow(20); // 10 megabytes - hopefully large enough to cause buffering
+ let buf = std::iter::repeat(b'a').take(len).collect::<Vec<u8>>();
+ with_bot_match_ctx(bot_spec, |ctx| {
+ async move {
+ let resp = ctx.request(1, buf, Duration::from_millis(200)).await;
+
+ let resp_bytes = resp.expect("unexpected error");
+ assert_eq!(resp_bytes.len(), len + 1);
+ }
+ .boxed()
+ })
+ .await;
+}