From fd52e266c6e25999a49c36f17342977b759a2612 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sun, 13 Mar 2022 15:20:03 +0100 Subject: apply clippy suggestions --- planetwars-matchrunner/src/bin/testmatch.rs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'planetwars-matchrunner/src/bin/testmatch.rs') diff --git a/planetwars-matchrunner/src/bin/testmatch.rs b/planetwars-matchrunner/src/bin/testmatch.rs index db160cf..4a9d10e 100644 --- a/planetwars-matchrunner/src/bin/testmatch.rs +++ b/planetwars-matchrunner/src/bin/testmatch.rs @@ -10,16 +10,9 @@ async fn main() { _run_match(map_path).await; } -const IMAGE: &'static str = "python:3.10-slim-buster"; +const IMAGE: &str = "python:3.10-slim-buster"; async fn _run_match(map_path: String) { - let code_dir_path = PathBuf::from("../simplebot"); - let bot_spec = DockerBotSpec { - image: IMAGE.to_string(), - code_path: code_dir_path, - argv: vec!["python".to_string(), "simplebot.py".to_string()], - }; - run_match(MatchConfig { map_path: PathBuf::from(map_path), map_name: "hex".to_string(), @@ -27,13 +20,25 @@ async fn _run_match(map_path: String) { players: vec![ MatchPlayer { name: "a".to_string(), - bot_spec: Box::new(bot_spec.clone()), + bot_spec: Box::new(DockerBotSpec { + image: IMAGE.to_string(), + // code_path: PathBuf::from("../simplebot"), + code_path: PathBuf::from("./bots/simplebot"), + argv: vec!["python".to_string(), "simplebot.py".to_string()], + }), }, MatchPlayer { name: "b".to_string(), - bot_spec: Box::new(bot_spec.clone()), + bot_spec: Box::new(DockerBotSpec { + image: IMAGE.to_string(), + code_path: PathBuf::from("./bots/broken_bot"), + argv: vec!["python".to_string(), "bot.py".to_string()], + }), }, ], }) .await; + + // TODO: use a joinhandle to wait for the logger to finish + tokio::time::sleep(std::time::Duration::from_secs(1)).await; } -- cgit v1.2.3