Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port Tee to MessageId #1506

Merged
merged 1 commit into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shotover-proxy/tests/test-configs/tee/switch_chain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ sources:
- DebugReturner:
Redis: "a"
- Redis:
name: "redis-3"
name: "redis-2"
listen_addr: "127.0.0.1:6372"
connection_limit:
chain:
Expand Down
56 changes: 33 additions & 23 deletions shotover-proxy/tests/transforms/tee.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::shotover_process;
use test_helpers::connection::redis_connection;
use test_helpers::docker_compose::docker_compose;
use test_helpers::shotover_process::{EventMatcher, Level};
use test_helpers::shotover_process::{Count, EventMatcher, Level};

#[tokio::test(flavor = "multi_thread")]
async fn test_ignore_matches() {
Expand Down Expand Up @@ -77,24 +77,15 @@ async fn test_log_with_mismatch() {

assert_eq!("42", result);
shotover
.shutdown_and_then_consume_events(&[
EventMatcher::new()
.with_level(Level::Warn)
.with_target("shotover::transforms::tee")
.with_message(
r#"Tee mismatch:
chain response: ["Redis BulkString(b\"42\")", "Redis BulkString(b\"42\")"]
tee response: ["Redis BulkString(b\"41\")", "Redis BulkString(b\"41\")"]"#,
),
EventMatcher::new()
.with_level(Level::Warn)
.with_target("shotover::transforms::tee")
.with_message(
r#"Tee mismatch:
chain response: ["Redis BulkString(b\"42\")"]
tee response: ["Redis BulkString(b\"41\")"]"#,
),
])
.shutdown_and_then_consume_events(&[EventMatcher::new()
.with_level(Level::Warn)
.with_count(Count::Times(3))
.with_target("shotover::transforms::tee")
.with_message(
r#"Tee mismatch:
result-source response: Redis BulkString(b"42")
other response: Redis BulkString(b"41")"#,
)])
.await;
}

Expand Down Expand Up @@ -211,6 +202,7 @@ async fn test_switch_main_chain() {
.await;

for i in 1..=3 {
println!("{i}");
let redis_port = 6370 + i;
let switch_port = 1230 + i;

Expand Down Expand Up @@ -254,9 +246,27 @@ async fn test_switch_main_chain() {
}

shotover
.shutdown_and_then_consume_events(&[EventMatcher::new()
.with_level(Level::Warn)
// 1 warning per loop above + 1 warning from the redis-rs driver connection handshake
.with_count(tokio_bin_process::event_matcher::Count::Times(4))])
.shutdown_and_then_consume_events(&[
EventMatcher::new()
.with_level(Level::Warn)
// generated by the final loop above, 2 by the requests + 2 by the redis-rs driver connection handshake
.with_count(Count::Times(4))
.with_target("shotover::transforms::tee")
.with_message(
r#"Tee mismatch:
result-source response: Redis BulkString(b"a")
other response: Redis BulkString(b"b")"#,
),
EventMatcher::new()
.with_level(Level::Warn)
// generated by the final loop above, by the request made while the result-source is flipped.
.with_count(Count::Times(1))
.with_target("shotover::transforms::tee")
.with_message(
r#"Tee mismatch:
result-source response: Redis BulkString(b"b")
other response: Redis BulkString(b"a")"#,
),
])
.await;
}
Loading
Loading