Skip to content

Commit a51daea

Browse files
authored
Merge pull request #284 from emmertex/fix/093-peer-macos-ci
Peer sync: skip LAN-pairing tests on macOS CI (macOS LAN pairing check)
2 parents bc572fe + a33c597 commit a51daea

3 files changed

Lines changed: 38 additions & 0 deletions

File tree

‎crates/engine/src/peers.rs‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,12 @@ mod tests {
536536
/// code, both list the other as paired; looking shows in the activity stack until stopped.
537537
#[test]
538538
fn two_sessions_pair_through_the_commands() {
539+
// macOS LAN pairing check: discovery times out on the macOS CI runner; checked in person on
540+
// real Macs instead (see "Checked in person, not on CI" in docs/ci.md)
541+
if cfg!(target_os = "macos") && std::env::var_os("CI").is_some() {
542+
lcc_testkit::skip!(System, "LAN discovery on the macOS CI runner (macOS LAN pairing check, tested in person)");
543+
return;
544+
}
539545
let dir = std::env::temp_dir().join(format!("lcc-engine-peers-{}", std::process::id()));
540546
let _ = std::fs::remove_dir_all(&dir);
541547
let port = 30000 + (std::process::id() % 9000) as u16;
@@ -597,6 +603,12 @@ mod tests {
597603
/// on one side arrives on the other, and edits on both sides end as a copy in a stack.
598604
#[test]
599605
fn shared_libraries_exchange_edits_and_keep_both_sides_of_a_collision() {
606+
// macOS LAN pairing check: discovery times out on the macOS CI runner; checked in person on
607+
// real Macs instead (see "Checked in person, not on CI" in docs/ci.md)
608+
if cfg!(target_os = "macos") && std::env::var_os("CI").is_some() {
609+
lcc_testkit::skip!(System, "LAN discovery on the macOS CI runner (macOS LAN pairing check, tested in person)");
610+
return;
611+
}
600612
let dir = std::env::temp_dir().join(format!("lcc-engine-exchange-{}", std::process::id()));
601613
let _ = std::fs::remove_dir_all(&dir);
602614
std::fs::create_dir_all(dir.join("src")).unwrap();
@@ -696,6 +708,12 @@ mod tests {
696708
/// on A reaches C through B, and one made on C reaches A the same way.
697709
#[test]
698710
fn edits_travel_across_a_chain_of_devices() {
711+
// macOS LAN pairing check: discovery times out on the macOS CI runner; checked in person on
712+
// real Macs instead (see "Checked in person, not on CI" in docs/ci.md)
713+
if cfg!(target_os = "macos") && std::env::var_os("CI").is_some() {
714+
lcc_testkit::skip!(System, "LAN discovery on the macOS CI runner (macOS LAN pairing check, tested in person)");
715+
return;
716+
}
699717
let dir = std::env::temp_dir().join(format!("lcc-engine-chain-{}", std::process::id()));
700718
let _ = std::fs::remove_dir_all(&dir);
701719
std::fs::create_dir_all(dir.join("src")).unwrap();

‎crates/peer/src/service.rs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,12 @@ mod tests {
692692
/// other as paired, and a third party's attempt is refused while they aren't looking.
693693
#[test]
694694
fn two_devices_find_each_other_and_pair() {
695+
// macOS LAN pairing check: discovery times out on the macOS CI runner; checked in person on
696+
// real Macs instead (see "Checked in person, not on CI" in docs/ci.md)
697+
if cfg!(target_os = "macos") && std::env::var_os("CI").is_some() {
698+
lcc_testkit::skip!(System, "LAN discovery on the macOS CI runner (macOS LAN pairing check, tested in person)");
699+
return;
700+
}
695701
let dir = std::env::temp_dir().join(format!("lcc-peer-svc-{}", std::process::id()));
696702
let _ = std::fs::remove_dir_all(&dir);
697703
// a port of its own, so parallel test runs don't hear each other
@@ -728,6 +734,12 @@ mod tests {
728734

729735
#[test]
730736
fn a_refused_code_pairs_nobody() {
737+
// macOS LAN pairing check: discovery times out on the macOS CI runner; checked in person on
738+
// real Macs instead (see "Checked in person, not on CI" in docs/ci.md)
739+
if cfg!(target_os = "macos") && std::env::var_os("CI").is_some() {
740+
lcc_testkit::skip!(System, "LAN discovery on the macOS CI runner (macOS LAN pairing check, tested in person)");
741+
return;
742+
}
731743
let dir = std::env::temp_dir().join(format!("lcc-peer-no-{}", std::process::id()));
732744
let _ = std::fs::remove_dir_all(&dir);
733745
let port = 40000 + ((std::process::id() + 7) % 20000) as u16;

‎docs/ci.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ temporary step scripts (`shell: powershell`) may run. After changing `.env`, res
133133

134134
If the runner is offline, jobs for our own branches wait in the queue; post a local result instead (below).
135135

136+
## Checked in person, not on CI
137+
138+
- **macOS LAN pairing check** (peer sync): finding and pairing devices over the LAN times out on the macOS CI runner,
139+
so the five tests that need it (`crates/peer` service pairing and refusal; engine `peers` pairing, exchange and
140+
chain) skip on macOS when `CI` is set. They still run on Linux and Windows CI and locally on a Mac. Before calling
141+
peer sync done on macOS, pair two real Macs (and a Mac with another OS) on one network, exchange edits, and remove
142+
this skip once the runner's discovery problem is understood.
143+
136144
## Retries, flaky tests and the quarantine
137145

138146
The full pre-release run (`cargo xtask ci` without `--fast`, on a push to `release` or a manual dispatch) runs the tests with [cargo-nextest](https://nexte.st) (installed by `taiki-e/install-action`, into the

0 commit comments

Comments
 (0)