e2e: Fix false-positive in canonical ref update test
Previously `test_fetch_emits_canonical_ref_update` was passing by catching a leftover `CanonicalRefUpdated` event from the initial repository fetch. Furthermore, the new commit was written to the un-namespaced root. It can be proven to be the case by commenting out the `alice.commit_to(...)` line and watching the test still pass. Fix the test by committing to the namespaced default branch which will trigger the `CanonicalRefUpdated` that is expected by Bob. Drains events so we don't catch the wrong event, and explicitly announces.
This commit is contained in:
parent
ed340f5724
commit
80d30d3b59
|
|
@ -1691,13 +1691,20 @@ fn test_fetch_emits_canonical_ref_update() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(result.is_success());
|
assert!(result.is_success());
|
||||||
|
|
||||||
|
// Drain all the events including initial `CanonicalRefUpdated`
|
||||||
|
// from fetch
|
||||||
|
while bob_events.try_recv().is_ok() {}
|
||||||
|
|
||||||
let default_branch: git::fmt::Qualified = {
|
let default_branch: git::fmt::Qualified = {
|
||||||
let repo = alice.storage.repository(rid).unwrap();
|
let repo = alice.storage.repository(rid).unwrap();
|
||||||
let proj = repo.project().unwrap();
|
let proj = repo.project().unwrap();
|
||||||
git::fmt::lit::refs_heads(proj.default_branch()).into()
|
git::fmt::lit::refs_heads(proj.default_branch()).into()
|
||||||
};
|
};
|
||||||
|
|
||||||
alice.commit_to(rid, &default_branch);
|
alice.commit_to(rid, &default_branch);
|
||||||
|
|
||||||
|
alice.handle.announce_refs_for(rid, [alice.id]).unwrap();
|
||||||
|
|
||||||
bob_events
|
bob_events
|
||||||
.wait(
|
.wait(
|
||||||
|e| {
|
|e| {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue