Skip to content

Commit 2bbb2b5

Browse files
authored
Fix flake-inducing race condition in test harness (#184)
Set nat-only to fix test_service_ipv4_unknown_address
1 parent 54c5ab2 commit 2bbb2b5

4 files changed

Lines changed: 26 additions & 8 deletions

File tree

dpd-client/tests/integration_tests/common.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -708,9 +708,7 @@ impl Switch {
708708
let n_total_packets = send.len() + expect.len();
709709
let mut captured = Vec::with_capacity(n_total_packets);
710710
let now = std::time::Instant::now();
711-
while now.elapsed() < self.packet_timeout
712-
&& captured.len() < n_total_packets
713-
{
711+
while now.elapsed() < self.packet_timeout {
714712
captured.extend(self.collected_packets_get());
715713
thread::sleep(Duration::from_millis(10));
716714
}

dpd-client/tests/integration_tests/mcast.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// License, v. 2.0. If a copy of the MPL was not distributed with this
33
// file, You can obtain one at https://mozilla.org/MPL/2.0/
44
//
5-
// Copyright 2025 Oxide Computer Company
5+
// Copyright 2026 Oxide Computer Company
66

77
use std::{
88
collections::HashSet,
@@ -3783,6 +3783,10 @@ async fn test_multicast_reset_all_tables() -> TestResult {
37833783
Ok(())
37843784
}
37853785

3786+
/*
3787+
* Commented out untl https://github.com/oxidecomputer/dendrite/issues/107 is
3788+
* fixed
3789+
*
37863790
#[tokio::test]
37873791
#[ignore]
37883792
async fn test_multicast_vlan_translation_not_possible() -> TestResult {
@@ -3859,6 +3863,7 @@ async fn test_multicast_vlan_translation_not_possible() -> TestResult {
38593863
.unwrap();
38603864
cleanup_test_group(switch, internal_multicast_ip).await
38613865
}
3866+
*/
38623867

38633868
#[tokio::test]
38643869
#[ignore]

dpd-client/tests/integration_tests/service.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// License, v. 2.0. If a copy of the MPL was not distributed with this
33
// file, You can obtain one at https://mozilla.org/MPL/2.0/
44
//
5-
// Copyright 2025 Oxide Computer Company
5+
// Copyright 2026 Oxide Computer Company
66

77
use std::sync::Arc;
88

@@ -195,17 +195,32 @@ async fn test_service_ipv4_unknown_address() -> TestResult {
195195
.await
196196
.unwrap();
197197

198+
// Mark the port as NAT-only
199+
switch
200+
.client
201+
.link_nat_only_set(&port_id, &link_id, true)
202+
.await
203+
.unwrap();
204+
198205
let send_pkt = common::gen_udp_packet(
199206
Endpoint::parse("e0:d5:5e:67:89:ab", "10.10.10.10", 3333).unwrap(),
200207
Endpoint::parse(router_mac, "192.10.12.1", 4444).unwrap(),
201208
);
202209

203210
let send = TestPacket {
204211
packet: Arc::new(send_pkt),
205-
port: PhysPort(ingress + 1),
212+
port: PhysPort(ingress),
206213
};
207214

208-
switch.packet_test(vec![send], Vec::new())
215+
let result = switch.packet_test(vec![send], Vec::new());
216+
// Clear the port's NAT-only property
217+
switch
218+
.client
219+
.link_nat_only_set(&port_id, &link_id, false)
220+
.await
221+
.unwrap();
222+
223+
result
209224
}
210225

211226
#[tokio::test]

xtask/src/linux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn collect(src: &str, dst: &str, files: Vec<&str>) -> Result<()> {
2121

2222
let dst_dir = Path::new(&dst);
2323
if !dst_dir.is_dir() {
24-
fs::create_dir_all(&dst_dir)?;
24+
fs::create_dir_all(dst_dir)?;
2525
}
2626

2727
for f in files {

0 commit comments

Comments
 (0)