Skip to content

test: correct 2 mislabelled tests in init_tests and cli_tests#984

Open
github-actions[bot] wants to merge 1 commit into
mainfrom
test-reducer/init-cli-incorrect-tests-2026-06-12-508d376d81738590
Open

test: correct 2 mislabelled tests in init_tests and cli_tests#984
github-actions[bot] wants to merge 1 commit into
mainfrom
test-reducer/init-cli-incorrect-tests-2026-06-12-508d376d81738590

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Suite Reduction: tests/init_tests.rs + tests/cli_tests.rs

What was wrong

  • test_init_force_overwrites (tests/init_tests.rs): The test claimed to verify that --force enables file overwriting, but --force controls the GitHub-remote guard — not overwriting. init always rewrites the agent file unconditionally. Worse, during cargo test the CARGO_BIN_EXE_ado-aw environment variable is always set, which causes ensure_non_github_remote_for_ado_aw to return Ok() immediately regardless of --force. The flag therefore had zero effect in the test, and its assertions were byte-for-byte identical to test_init_overwrites_by_default.

  • test_run_subcommand_not_present (tests/cli_tests.rs): The test name says "run subcommand not present" and its failure message says "Help output should not include a run subcommand" — but the run subcommand is present (it queues ADO builds). The test was actually checking that the old description string "Run agent locally" no longer appears, not that run is absent. A reader seeing a failure from this test would be misled into thinking the run subcommand had been accidentally added.

Changes

File Test Action Category
tests/init_tests.rs test_init_force_overwrites Replaced with test_init_force_flag_is_advertised_in_help Incorrect + Redundant
tests/cli_tests.rs test_run_subcommand_not_present Renamed to test_run_agent_locally_description_absent; fixed assertion message Incorrect (misleading name/message)

The replacement test for --force verifies that:

  1. ado-aw init --help succeeds
  2. --force appears in the output
  3. The description mentions GitHub or bypass (i.e., explains it bypasses the GitHub-remote guard)

This is a meaningful regression guard: it would fail if --force were removed from the CLI or its purpose were silently changed.

Verification

  • cargo test --test init_tests --test cli_tests: all 4 tests pass ✅
  • cargo test: 1829 tests pass, 0 failed ✅
  • cargo clippy --all-targets --all-features: no errors or warnings ✅

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • spsprodeus21.vssps.visualstudio.com
  • spsprodweu4.vssps.visualstudio.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "spsprodeus21.vssps.visualstudio.com"
    - "spsprodweu4.vssps.visualstudio.com"

See Network Configuration for more information.

Generated by Test Reducer · sonnet46 4.4M ·

- tests/init_tests.rs: replace test_init_force_overwrites with
  test_init_force_flag_is_advertised_in_help.  The old test claimed
  --force 'overwrites' an agent file, but --force controls the
  GitHub-remote guard, not overwriting (init always rewrites).
  Because CARGO_BIN_EXE_ado-aw is set during cargo test the guard
  is already bypassed, so --force had zero effect in the test and
  its assertions were identical to test_init_overwrites_by_default.
  The new test verifies --force is documented in 'init --help' with
  the correct purpose (GitHub-remote guard bypass).

- tests/cli_tests.rs: rename test_run_subcommand_not_present to
  test_run_agent_locally_description_absent and fix the assertion
  message.  The run subcommand IS present (it queues ADO builds);
  the test was checking that the old 'Run agent locally' description
  no longer appears, not that run is absent.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesadevine jamesadevine marked this pull request as ready for review June 12, 2026 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants