test: correct 2 mislabelled tests in init_tests and cli_tests#984
Open
github-actions[bot] wants to merge 1 commit into
Open
test: correct 2 mislabelled tests in init_tests and cli_tests#984github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
- 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>
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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--forceenables file overwriting, but--forcecontrols the GitHub-remote guard — not overwriting.initalways rewrites the agent file unconditionally. Worse, duringcargo testtheCARGO_BIN_EXE_ado-awenvironment variable is always set, which causesensure_non_github_remote_for_ado_awto returnOk()immediately regardless of--force. The flag therefore had zero effect in the test, and its assertions were byte-for-byte identical totest_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 therunsubcommand is present (it queues ADO builds). The test was actually checking that the old description string"Run agent locally"no longer appears, not thatrunis absent. A reader seeing a failure from this test would be misled into thinking therunsubcommand had been accidentally added.Changes
tests/init_tests.rstest_init_force_overwritestest_init_force_flag_is_advertised_in_helptests/cli_tests.rstest_run_subcommand_not_presenttest_run_agent_locally_description_absent; fixed assertion messageThe replacement test for
--forceverifies that:ado-aw init --helpsucceeds--forceappears in the outputGitHuborbypass(i.e., explains it bypasses the GitHub-remote guard)This is a meaningful regression guard: it would fail if
--forcewere 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.comspsprodweu4.vssps.visualstudio.comSee Network Configuration for more information.