Archived
Sprint 08 (roadmap/08. ready to submit.md), the last milestone. - scripts/watch.sh runs the collector with a live view of its log, stops cleanly on Ctrl-C, then checks the output (reconcile) and shows one symbol's book as text (show, a new binary). - The README for the solution, with the final runs: Polymarket through an outage it recovered from on its own, Kalshi's demo with two slow connections recycled. - From a review of the whole codebase: Kalshi takes RSA keys too (RSA-PSS-SHA256); a slow Kalshi connection takes the hourly recycle's next turn, which it nearly never got before; a market tracked again no longer fails reconcile; Book::add checks for overflow; usage and --help name the key variables; the first scan says how far it got. - Tests for every gap the reviews found, an offline run of the whole orchestrator among them; ShellCheck in CI.
36 lines
1.1 KiB
Rust
36 lines
1.1 KiB
Rust
//! The collector's command line, run as a user would.
|
|
|
|
use std::process::Command;
|
|
|
|
#[test]
|
|
fn help_prints_the_usage_and_exits_0() {
|
|
for flag in ["--help", "-h"] {
|
|
let output = Command::new(env!("CARGO_BIN_EXE_engineering-challenge"))
|
|
.arg(flag)
|
|
.output()
|
|
.unwrap();
|
|
let text = String::from_utf8(output.stdout).unwrap();
|
|
assert!(output.status.success(), "{flag}: {text}");
|
|
assert!(
|
|
text.starts_with("usage: engineering-challenge EXCHANGE"),
|
|
"{flag}: {text}"
|
|
);
|
|
assert!(text.contains("KALSHI_PRIVATE_KEY_FILE"), "{flag}: {text}");
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn an_unknown_exchange_fails_with_the_usage() {
|
|
let output = Command::new(env!("CARGO_BIN_EXE_engineering-challenge"))
|
|
.arg("kraken")
|
|
.output()
|
|
.unwrap();
|
|
let text = String::from_utf8(output.stderr).unwrap();
|
|
assert!(!output.status.success());
|
|
assert!(text.contains("unknown exchange \"kraken\""), "{text}");
|
|
assert!(
|
|
text.contains("usage: engineering-challenge EXCHANGE"),
|
|
"{text}"
|
|
);
|
|
}
|