Skip to content

Commit 2c8e56f

Browse files
committed
DROP THIS COMMIT -- testing ipv6 addresses in tests and benches
1 parent da2d55f commit 2c8e56f

File tree

15 files changed

+45
-45
lines changed

15 files changed

+45
-45
lines changed

msg-socket/src/pub/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ mod tests {
201201

202202
let mut sub_socket = SubSocket::with_options(Tcp::default(), SubOptions::default());
203203

204-
pub_socket.bind("0.0.0.0:0").await.unwrap();
204+
pub_socket.bind("[::]:0").await.unwrap();
205205
let addr = pub_socket.local_addr().unwrap();
206206

207207
sub_socket.connect(addr).await.unwrap();
@@ -227,7 +227,7 @@ mod tests {
227227
SubOptions::default().auth_token(Bytes::from("client1")),
228228
);
229229

230-
pub_socket.bind("0.0.0.0:0").await.unwrap();
230+
pub_socket.bind("[::]:0").await.unwrap();
231231
let addr = pub_socket.local_addr().unwrap();
232232

233233
sub_socket.connect(addr).await.unwrap();
@@ -253,7 +253,7 @@ mod tests {
253253
SubOptions::default().auth_token(Bytes::from("client1")),
254254
);
255255

256-
pub_socket.bind("0.0.0.0:0").await.unwrap();
256+
pub_socket.bind("[::]:0").await.unwrap();
257257
let addr = pub_socket.local_addr().unwrap();
258258

259259
sub_socket.connect(addr).await.unwrap();
@@ -278,7 +278,7 @@ mod tests {
278278

279279
let mut sub2 = SubSocket::new(Tcp::default());
280280

281-
pub_socket.bind("0.0.0.0:0").await.unwrap();
281+
pub_socket.bind("[::]:0").await.unwrap();
282282
let addr = pub_socket.local_addr().unwrap();
283283

284284
sub1.connect(addr).await.unwrap();
@@ -310,7 +310,7 @@ mod tests {
310310

311311
let mut sub2 = SubSocket::new(Tcp::default());
312312

313-
pub_socket.bind("0.0.0.0:0").await.unwrap();
313+
pub_socket.bind("[::]:0").await.unwrap();
314314
let addr = pub_socket.local_addr().unwrap();
315315

316316
sub1.connect(addr).await.unwrap();
@@ -345,11 +345,11 @@ mod tests {
345345
let mut sub_socket = SubSocket::new(Tcp::default());
346346

347347
// Try to connect and subscribe before the publisher is up
348-
sub_socket.connect("0.0.0.0:6662").await.unwrap();
348+
sub_socket.connect("[::]:6662").await.unwrap();
349349
sub_socket.subscribe("HELLO".to_string()).await.unwrap();
350350
tokio::time::sleep(Duration::from_millis(500)).await;
351351

352-
pub_socket.bind("0.0.0.0:6662").await.unwrap();
352+
pub_socket.bind("[::]:6662").await.unwrap();
353353
tokio::time::sleep(Duration::from_millis(2000)).await;
354354

355355
pub_socket.publish("HELLO".to_string(), Bytes::from("WORLD")).await.unwrap();
@@ -369,11 +369,11 @@ mod tests {
369369
let mut sub_socket = SubSocket::new(Quic::default());
370370

371371
// Try to connect and subscribe before the publisher is up
372-
sub_socket.connect("0.0.0.0:6662").await.unwrap();
372+
sub_socket.connect("[::]:6662").await.unwrap();
373373
sub_socket.subscribe("HELLO".to_string()).await.unwrap();
374374
tokio::time::sleep(Duration::from_millis(1000)).await;
375375

376-
pub_socket.bind("0.0.0.0:6662").await.unwrap();
376+
pub_socket.bind("[::]:6662").await.unwrap();
377377
tokio::time::sleep(Duration::from_millis(2000)).await;
378378

379379
pub_socket.publish("HELLO".to_string(), Bytes::from("WORLD")).await.unwrap();
@@ -391,7 +391,7 @@ mod tests {
391391
let mut pub_socket =
392392
PubSocket::with_options(Tcp::default(), PubOptions::default().max_clients(1));
393393

394-
pub_socket.bind("0.0.0.0:0").await.unwrap();
394+
pub_socket.bind("[::]:0").await.unwrap();
395395

396396
let mut sub1 = SubSocket::with_options(Tcp::default(), SubOptions::default());
397397

msg-socket/src/rep/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ mod tests {
103103
use super::*;
104104

105105
fn localhost() -> SocketAddr {
106-
"127.0.0.1:0".parse().unwrap()
106+
"[::1]:0".parse().unwrap()
107107
}
108108

109109
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
@@ -146,7 +146,7 @@ mod tests {
146146
async fn reqrep_durable() {
147147
let _ = tracing_subscriber::fmt::try_init();
148148
let random_port = rand::random::<u16>() + 10000;
149-
let addr = format!("0.0.0.0:{random_port}");
149+
let addr = format!("[::]:{random_port}");
150150

151151
// Initialize the request socket (client side) with a transport
152152
let mut req = ReqSocket::new(Tcp::default());
@@ -233,7 +233,7 @@ mod tests {
233233
async fn rep_max_connections() {
234234
let _ = tracing_subscriber::fmt::try_init();
235235
let mut rep = RepSocket::with_options(Tcp::default(), RepOptions::default().max_clients(1));
236-
rep.bind("127.0.0.1:0").await.unwrap();
236+
rep.bind("[::1]:0").await.unwrap();
237237
let addr = rep.local_addr().unwrap();
238238

239239
let mut req1 = ReqSocket::new(Tcp::default());
@@ -253,13 +253,13 @@ mod tests {
253253
RepSocket::with_options(Tcp::default(), RepOptions::default().min_compress_size(0))
254254
.with_compressor(SnappyCompressor);
255255

256-
rep.bind("0.0.0.0:4445").await.unwrap();
256+
rep.bind("[::]:4445").await.unwrap();
257257

258258
let mut req =
259259
ReqSocket::with_options(Tcp::default(), ReqOptions::default().min_compress_size(0))
260260
.with_compressor(GzipCompressor::new(6));
261261

262-
req.connect("0.0.0.0:4445").await.unwrap();
262+
req.connect("[::]:4445").await.unwrap();
263263

264264
tokio::spawn(async move {
265265
let req = rep.next().await.unwrap();

msg-socket/src/sub/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ mod tests {
184184
use super::*;
185185

186186
async fn spawn_listener() -> SocketAddr {
187-
let listener = TcpListener::bind("0.0.0.0:0").await.unwrap();
187+
let listener = TcpListener::bind("[::]:0").await.unwrap();
188188

189189
let addr = listener.local_addr().unwrap();
190190

msg-socket/tests/it/pubsub.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn init_simulation(addr: IpAddr, config: SimulationConfig) -> Simulator {
2525
async fn pubsub_channel() {
2626
let _ = tracing_subscriber::fmt::try_init();
2727

28-
let addr = "127.0.0.1".parse().unwrap();
28+
let addr = "::1".parse().unwrap();
2929

3030
let mut simulator = init_simulation(
3131
addr,
@@ -37,11 +37,11 @@ async fn pubsub_channel() {
3737
},
3838
);
3939

40-
let result = pubsub_channel_transport(build_tcp, "127.0.0.1:9879".parse().unwrap()).await;
40+
let result = pubsub_channel_transport(build_tcp, "[::1]:9879".parse().unwrap()).await;
4141

4242
assert!(result.is_ok());
4343

44-
let result = pubsub_channel_transport(build_quic, "127.0.0.1:9879".parse().unwrap()).await;
44+
let result = pubsub_channel_transport(build_quic, "[::1]:9879".parse().unwrap()).await;
4545

4646
assert!(result.is_ok());
4747

@@ -90,7 +90,7 @@ where
9090
async fn pubsub_fan_out() {
9191
let _ = tracing_subscriber::fmt::try_init();
9292

93-
let addr = "127.0.0.1".parse().unwrap();
93+
let addr = "::1".parse().unwrap();
9494

9595
let mut simulator = init_simulation(
9696
addr,
@@ -102,11 +102,11 @@ async fn pubsub_fan_out() {
102102
},
103103
);
104104

105-
let result = pubsub_fan_out_transport(build_tcp, 10, "127.0.0.1:9880".parse().unwrap()).await;
105+
let result = pubsub_fan_out_transport(build_tcp, 10, "[::1]:9880".parse().unwrap()).await;
106106

107107
assert!(result.is_ok());
108108

109-
let result = pubsub_fan_out_transport(build_quic, 10, "127.0.0.1:9880".parse().unwrap()).await;
109+
let result = pubsub_fan_out_transport(build_quic, 10, "[::1]:9880".parse().unwrap()).await;
110110

111111
assert!(result.is_ok());
112112

@@ -169,7 +169,7 @@ async fn pubsub_fan_out_transport<
169169
async fn pubsub_fan_in() {
170170
let _ = tracing_subscriber::fmt::try_init();
171171

172-
let addr = "127.0.0.1".parse().unwrap();
172+
let addr = "::1".parse().unwrap();
173173

174174
let mut simulator = init_simulation(
175175
addr,
@@ -181,11 +181,11 @@ async fn pubsub_fan_in() {
181181
},
182182
);
183183

184-
let result = pubsub_fan_in_transport(build_tcp, 20, "127.0.0.1:9881".parse().unwrap()).await;
184+
let result = pubsub_fan_in_transport(build_tcp, 20, "[::1]:9881".parse().unwrap()).await;
185185

186186
assert!(result.is_ok());
187187

188-
let result = pubsub_fan_in_transport(build_quic, 20, "127.0.0.1:9881".parse().unwrap()).await;
188+
let result = pubsub_fan_in_transport(build_quic, 20, "[::1]:9881".parse().unwrap()).await;
189189

190190
assert!(result.is_ok());
191191

msg-socket/tests/it/reqrep.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ async fn test_reqrep() {
1010
let mut rep = RepSocket::new(Tcp::default());
1111
let mut req = ReqSocket::new(Tcp::default());
1212

13-
rep.bind("0.0.0.0:0").await.unwrap();
13+
rep.bind("[::]:0").await.unwrap();
1414

1515
req.connect(rep.local_addr().unwrap()).await.unwrap();
1616

msg/benches/pubsub.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ fn pubsub_single_thread_tcp(c: &mut Criterion) {
168168
msg_sizes: vec![MSG_SIZE, MSG_SIZE * 8, MSG_SIZE * 64, MSG_SIZE * 128],
169169
};
170170

171-
bench.init("127.0.0.1:0".parse().unwrap());
171+
bench.init("[::1]:0".parse().unwrap());
172172

173173
let mut group = c.benchmark_group("pubsub_single_thread_tcp_bytes");
174174
group.sample_size(10);
@@ -208,7 +208,7 @@ fn pubsub_multi_thread_tcp(c: &mut Criterion) {
208208
msg_sizes: vec![MSG_SIZE, MSG_SIZE * 8, MSG_SIZE * 64, MSG_SIZE * 128],
209209
};
210210

211-
bench.init("127.0.0.1:0".parse().unwrap());
211+
bench.init("[::1]:0".parse().unwrap());
212212

213213
let mut group = c.benchmark_group("pubsub_multi_thread_tcp_bytes");
214214
group.sample_size(10);
@@ -247,7 +247,7 @@ fn pubsub_single_thread_quic(c: &mut Criterion) {
247247
msg_sizes: vec![MSG_SIZE, MSG_SIZE * 8, MSG_SIZE * 64, MSG_SIZE * 128],
248248
};
249249

250-
bench.init("127.0.0.1:0".parse().unwrap());
250+
bench.init("[::1]:0".parse().unwrap());
251251

252252
let mut group = c.benchmark_group("pubsub_single_thread_quic_bytes");
253253
group.sample_size(10);
@@ -287,7 +287,7 @@ fn pubsub_multi_thread_quic(c: &mut Criterion) {
287287
msg_sizes: vec![MSG_SIZE, MSG_SIZE * 8, MSG_SIZE * 64, MSG_SIZE * 128],
288288
};
289289

290-
bench.init("127.0.0.1:0".parse().unwrap());
290+
bench.init("[::1]:0".parse().unwrap());
291291

292292
let mut group = c.benchmark_group("pubsub_multi_thread_quic_bytes");
293293
group.sample_size(10);

msg/benches/reqrep.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn reqrep_single_thread_tcp(c: &mut Criterion) {
131131
msg_sizes: vec![MSG_SIZE, MSG_SIZE * 8, MSG_SIZE * 64, MSG_SIZE * 128],
132132
};
133133

134-
bench.init("127.0.0.1:0".parse().unwrap());
134+
bench.init("[::1]:0".parse().unwrap());
135135
let mut group = c.benchmark_group("reqrep_single_thread_tcp_bytes");
136136
group.sample_size(10);
137137
bench.bench_request_throughput(group);
@@ -162,7 +162,7 @@ fn reqrep_multi_thread_tcp(c: &mut Criterion) {
162162
msg_sizes: vec![MSG_SIZE, MSG_SIZE * 8, MSG_SIZE * 64, MSG_SIZE * 128],
163163
};
164164

165-
bench.init("127.0.0.1:0".parse().unwrap());
165+
bench.init("[::1]:0".parse().unwrap());
166166
let mut group = c.benchmark_group("reqrep_multi_thread_tcp_bytes");
167167
group.sample_size(10);
168168
bench.bench_request_throughput(group);

msg/examples/durable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async fn start_rep() {
2323
// Initialize the reply socket (server side) with a transport
2424
// and an authenticator.
2525
let mut rep = RepSocket::new(Tcp::default()).with_auth(Auth);
26-
while rep.bind("0.0.0.0:4444").await.is_err() {
26+
while rep.bind("[::]:4444").await.is_err() {
2727
rep = RepSocket::new(Tcp::default()).with_auth(Auth);
2828
warn!("Failed to bind rep socket, retrying...");
2929
tokio::time::sleep(Duration::from_secs(1)).await;
@@ -69,7 +69,7 @@ async fn main() {
6969
tokio::spawn(
7070
async move {
7171
tracing::info!("Trying to connect to rep socket... This will start the connection process in the background, it won't immediately connect.");
72-
req.connect("0.0.0.0:4444").await.unwrap();
72+
req.connect("[::]:4444").await.unwrap();
7373

7474
for i in 0..10 {
7575
info!("Sending request {i}...");

msg/examples/pubsub.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ async fn main() {
2929
);
3030

3131
tracing::info!("Setting up the sockets...");
32-
pub_socket.bind("127.0.0.1:0").await.unwrap();
32+
pub_socket.bind("[::1]:0").await.unwrap();
3333
let pub_addr = pub_socket.local_addr().unwrap();
3434

3535
info!("Publisher listening on: {}", pub_addr);

msg/examples/pubsub_auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ async fn main() {
4545
);
4646

4747
tracing::info!("Setting up the sockets...");
48-
pub_socket.bind("127.0.0.1:0").await.unwrap();
48+
pub_socket.bind("[::1]:0").await.unwrap();
4949

5050
let pub_addr = pub_socket.local_addr().unwrap();
5151
info!("Publisher listening on: {}", pub_addr);

0 commit comments

Comments
 (0)