Fix interactive execution of integration tests#42
Conversation
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
By default, the integration test overwrites `stdin` with a mock file using `libc::dup2` to prevent tests from hanging on user input prompts. This commit introduces a check against the `INTERACTIVE` environment variable. If set, the test will skip mocking `stdin`, allowing developers to run `INTERACTIVE=1 cargo test -- --nocapture` and manually input values to the CLI prompts. Co-authored-by: soniapi <396009+soniapi@users.noreply.github.com>
ee2a270 to
97cf889
Compare
This PR modifies
tests/integration_test.rsto allow the integration test to be run interactively.Problem:
The integration test aggressively mocks
stdinusinglibc::dup2by default. This causes any manual attempts to run the test and provide terminal inputs to immediately fall through, as the file descriptors have already been pointed to a temporary file containing pre-filled string data ("1\n180000.0\n").Solution:
Wrapped the standard input mocking block inside an environment variable check (
std::env::var("INTERACTIVE").is_err()).Now, when run with
cargo test(like in CI/CD pipelines),INTERACTIVEwon't be set, and it will silently mockstdinas it did before.If a user wishes to run the test manually, they can now execute:
INTERACTIVE=1 cargo test -- --nocaptureAnd the test will correctly wait for them to type
1and180000.0into the terminal.PR created automatically by Jules for task 5341466632526390579 started by @soniapi