Skip to content

Commit 9b79cae

Browse files
committed
add test
1 parent 6b0b6c0 commit 9b79cae

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

shotover-proxy/tests/runner/runner_int_tests.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,36 @@
11
use crate::shotover_process;
2+
use serde_json::Value;
23
use test_helpers::shotover_process::{EventMatcher, Level};
4+
use tokio::net::TcpStream;
5+
6+
#[tokio::test]
7+
async fn test_request_id_increments() {
8+
// Ensure it isnt reliant on timing
9+
let shotover_process = shotover_process("tests/test-configs/null-valkey/topology.yaml")
10+
.start()
11+
.await;
12+
for _ in 0..1000 {
13+
TcpStream::connect("127.0.0.1:6379").await.unwrap();
14+
}
15+
16+
let events = shotover_process.shutdown_and_then_consume_events(&[]).await;
17+
let mut previous_id = 0;
18+
for event in events.events {
19+
for span in event.spans {
20+
if let Some(name) = span.get("name") {
21+
if *name == Value::String("connection".into()) {
22+
if let Some(id) = span.get("id").and_then(|x| x.as_i64()) {
23+
// ensure that the ID increases by 1 and monotonically
24+
assert!(previous_id == id || previous_id + 1 == id);
25+
previous_id = id;
26+
}
27+
}
28+
}
29+
}
30+
}
31+
// ensure that this test does something
32+
assert_eq!(previous_id, 1000);
33+
}
334

435
#[tokio::test]
536
async fn test_early_shutdown_cassandra_source() {

shotover/src/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl<C: CodecBuilder + 'static> TcpCodecListener<C> {
238238
let client_details = stream.peer_addr()
239239
.map(|p| p.ip().to_string())
240240
.unwrap_or_else(|_| "Unknown Peer".to_string());
241-
tracing::debug!("New connection from {}", client_details);
241+
tracing::info!("New connection from {}", client_details);
242242

243243
let force_run_chain = Arc::new(Notify::new());
244244
let context = TransformContextBuilder{

0 commit comments

Comments
 (0)