Skip to content

Commit e2d538a

Browse files
authored
Merge pull request DeusData#2041 from CaptainMittens/test/cli-uninstall-path-isolation
test(cli): point PATH at the fixture so uninstall isolation holds on any machine
2 parents 2b030a5 + 99fa463 commit e2d538a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎tests/test_cli.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2033,6 +2033,15 @@ TEST(cli_uninstall_quiesces_active_cohort_before_removing_binary_and_index) {
20332033
char *old_cache = NULL;
20342034
cli_activation_save_env(&old_home, &old_cache);
20352035
cbm_setenv("HOME", tmpdir, 1);
2036+
/* PATH has to move with HOME. Agent detection asks cbm_find_cli, which
2037+
* reads PATH before anything else, so a real agent binary on the developer's
2038+
* PATH is found even though HOME points at this fixture. Uninstall then
2039+
* tries to edit that agent's config file here, fails because the fixture
2040+
* never created one, and stops before removing the binary and the index —
2041+
* which is exactly what this test measures. Redirecting PATH makes the
2042+
* result the same on every machine. */
2043+
char *old_path = save_test_env("PATH");
2044+
cbm_setenv("PATH", tmpdir, 1);
20362045

20372046
char cache_dir[512];
20382047
char index_path[640];
@@ -2070,6 +2079,7 @@ TEST(cli_uninstall_quiesces_active_cohort_before_removing_binary_and_index) {
20702079
bool binary_preserved =
20712080
installed && strcmp(installed, "binary must survive active-daemon refusal") == 0;
20722081
cli_activation_restore_env(old_home, old_cache);
2082+
restore_test_env("PATH", old_path);
20732083
test_rmdir_r(tmpdir);
20742084

20752085
ASSERT_EQ(rc, 0);

0 commit comments

Comments
 (0)