Add CLI streaming integration tests#1542
Conversation
SummaryAdds two Tokio integration tests ( Notes
ReviewLooks great—nice to see end-to-end coverage for both streaming paths. Suggestions
|
bolinfest
left a comment
There was a problem hiding this comment.
Just some small suggestions!
| } | ||
|
|
||
| let server = MockServer::start().await; | ||
| let sse = concat!( |
There was a problem hiding this comment.
I would use r# here. Since it isn't a format string, you won't have to escape {.
| "model_providers.mock={{ name = \"mock\", base_url = \"{}/v1\", env_key = \"PATH\", wire_api = \"chat\" }}", | ||
| server.uri() | ||
| ); | ||
| let mut cmd = Command::new("cargo"); |
There was a problem hiding this comment.
Command::cargo_bin("codex-rs") instead?
| let server = MockServer::start().await; | ||
| let sse = concat!( | ||
| "data: {\"choices\":[{\"delta\":{\"content\":\"hi\"}}]}\n\n", | ||
| "data: {\"choices\":[{\"delta\":{}}]}\n\n", |
There was a problem hiding this comment.
Is this empty {} the way it signals the end of the stream?
| std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/cli_responses_fixture.sse"); | ||
|
|
||
| let home = TempDir::new().unwrap(); | ||
| let mut cmd = Command::new("cargo"); |
There was a problem hiding this comment.
Command::cargo_bin here, as well?
| .arg("exec") | ||
| .arg("--skip-git-repo-check") | ||
| .arg("hello?"); | ||
| cmd.current_dir(env!("CARGO_MANIFEST_DIR")) |
There was a problem hiding this comment.
note that if you need codex to use a specific cwd, it has a --cd/-C option.
Summary
cargo runto invoke the CLI during testsTesting
cargo test -p codex-core --test cli_stream -- --nocapturecargo clippy --all-targets --all-features -- -D warningshttps://chatgpt.com/codex/tasks/task_i_68715980bbec8321999534fdd6a013c1