Skip to content

Commit

Permalink
Add test for .buckconfig.local's previous mismatched command
Browse files Browse the repository at this point in the history
Reviewed By: scottcao

Differential Revision: D69870664

fbshipit-source-id: a573bcc43a4a31467f5b3cae66dcf14d81e266c8
  • Loading branch information
ezgicicek authored and facebook-github-bot committed Feb 24, 2025
1 parent 9a6941a commit f322b14
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/core/build/test_external_buckconfigs.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,33 @@ async def test_previous_command_with_mismatched_config(
# Previous command didn't change any external configs but still has new_configs_used = 1 due to changes to project-relative configs.
# We don't capture that by design at the moment.
record_file = tmp_path / "record.json"
await buck.build(
res = await buck.build(
"@root//mode/my_mode",
"//:test",
"-c",
"my_section.my_key=my_new_value",
"--unstable-write-invocation-record",
str(record_file),
)
trace_id = json.loads(res.stdout)["trace_id"]

previous_invalidating_command = await filter_events(
buck, "Event", "data", "Instant", "data", "PreviousCommandWithMismatchedConfig"
)
assert len(previous_invalidating_command) == 0
assert read_invocation_record(record_file)["new_configs_used"] == 1

# Make a change to .buckconfig.local
with open(buck.cwd / ".buckconfig.local", "w") as localconfig:
localconfig.write("\n[local_section]\nlocal_key = local_value\n")
await buck.build(
"@root//mode/my_mode",
"//:test",
"-c",
"my_section.my_key=my_new_value",
)
previous_invalidating_command = await filter_events(
buck, "Event", "data", "Instant", "data", "PreviousCommandWithMismatchedConfig"
)
assert len(previous_invalidating_command) == 1
assert previous_invalidating_command[0]["trace_id"] == trace_id

0 comments on commit f322b14

Please sign in to comment.