diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-18 22:12:22 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-18 22:12:22 +0000 |
| commit | fefb37e040eb3cf91093d597737e1431fed38c81 (patch) | |
| tree | 62be13f2855f4672273061426312e80956b23fce /grasp-audit/src/fixtures.rs | |
| parent | 1f0298bcfe125bee5d996e163ad8f3e9c17e3a9e (diff) | |
fix: use unique commit instead of deterministic Owner variant for wrong-commit PR tests
PRWrongCommitPushedBeforeEvent and test_push_to_nostr_ref_with_wrong_commit_after_event_received_rejected
were calling create_deterministic_commit_with_variant(CommitVariant::Owner) on a clone that already
had test.txt with 'Initial commit\n' content from OwnerStateDataPushed. Writing identical content
staged nothing so git commit failed silently.
Now that ValidRepoServed always depends on OwnerStateDataPushed (git data pushed), the clone is
never empty - use create_commit (unique file) instead since the wrong commit only needs to differ
from PR_TEST_COMMIT_HASH, not be deterministic.
Diffstat (limited to 'grasp-audit/src/fixtures.rs')
| -rw-r--r-- | grasp-audit/src/fixtures.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/grasp-audit/src/fixtures.rs b/grasp-audit/src/fixtures.rs index fc6e8cb..45d3094 100644 --- a/grasp-audit/src/fixtures.rs +++ b/grasp-audit/src/fixtures.rs | |||
| @@ -1579,10 +1579,14 @@ impl<'a> TestContext<'a> { | |||
| 1579 | let _ = fs::remove_dir_all(path); | 1579 | let _ = fs::remove_dir_all(path); |
| 1580 | }; | 1580 | }; |
| 1581 | 1581 | ||
| 1582 | // Create a WRONG commit (Owner variant, not PRTestCommit) | 1582 | // Create a WRONG commit using a unique file (not PRTestCommit) |
| 1583 | // This commit hash will NOT match what's in the PR event's `c` tag | 1583 | // We use create_commit (non-deterministic) so it always succeeds even if the |
| 1584 | // repo already has a commit (e.g. from OwnerStateDataPushed) with the same | ||
| 1585 | // deterministic content. The only requirement is that the hash differs from | ||
| 1586 | // PR_TEST_COMMIT_HASH, which is guaranteed since PR_TEST_COMMIT_HASH is a | ||
| 1587 | // deterministic root-commit with specific content and dates. | ||
| 1584 | let wrong_commit_hash = | 1588 | let wrong_commit_hash = |
| 1585 | match create_deterministic_commit_with_variant(&clone_path, CommitVariant::Owner) { | 1589 | match create_commit(&clone_path, "wrong commit - not the PR test commit") { |
| 1586 | Ok(h) => h, | 1590 | Ok(h) => h, |
| 1587 | Err(e) => { | 1591 | Err(e) => { |
| 1588 | cleanup(&clone_path); | 1592 | cleanup(&clone_path); |