Skip to content

Commit

Permalink
Merge branch 'main' into levi/tag-macro
Browse files Browse the repository at this point in the history
  • Loading branch information
morrisonlevi committed May 30, 2024
2 parents 708212b + 5128ad6 commit 30d1198
Show file tree
Hide file tree
Showing 5 changed files with 678 additions and 96 deletions.
31 changes: 15 additions & 16 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
jobs:
run-fuzz:
runs-on: ubuntu-latest
strategy:
matrix:
directory: [alloc, profiling]
env:
CARGO_TERM_COLOR: always
steps:
Expand All @@ -20,20 +23,16 @@ jobs:
tool: cargo-bolero
- run: |
set -e
DIRS="alloc profiling"
for dir in $DIRS;
# cargo bolero list outputs {"package":"package-name","test":"test-name"}
pushd ${{ matrix.directory }}
cargo bolero list | \
# And the following command will parse package-name's and test-name's one in each line
grep -oP '"(package|test)"\s*:\s*"\K[^"]+' | \
# awk will stitch package and test names back separated by a tab
awk 'NR%2{printf "%s\t", $0; next}1' | \
while read -r package test;
do
# cargo bolero list outputs {"package":"package-name","test":"test-name"}
pushd $dir
cargo bolero list | \
# And the following command will parse package-name's and test-name's one in each line
grep -oP '"(package|test)"\s*:\s*"\K[^"]+' | \
# awk will stitch package and test names back separated by a tab
awk 'NR%2{printf "%s\t", $0; next}1' | \
while read -r package test;
do
echo "****** Starting bolero test for $package $test ******" 1>&2
cargo bolero test -T 1min --package $package $test
done
popd
done
echo "****** Starting bolero test for $package $test ******" 1>&2
cargo bolero test -T 1min --package $package $test
done
popd
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions sidecar/src/service/tracing/trace_flusher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,11 @@ mod tests {
use std::sync::Arc;

// This function will poll the mock server for "hits" until the expected number of hits is
// observed. In its current form it may not correctly report if more than the asserted number of
// hits occurred. More attempts at lower sleep intervals is preferred to reduce flakiness and
// test runtime.
// observed. Then it will delete the mock. In its current form it may not correctly report if
// more than the asserted number of hits occurred. More attempts at lower sleep intervals is
// preferred to reduce flakiness and test runtime.
async fn poll_for_mock_hit(
mock: &Mock<'_>,
mock: &mut Mock<'_>,
poll_attempts: i32,
sleep_interval_ms: u64,
expected_hits: usize,
Expand Down Expand Up @@ -360,7 +360,7 @@ mod tests {

let server = MockServer::start();

let mock = server
let mut mock = server
.mock_async(|_when, then| {
then.status(202)
.header("content-type", "application/json")
Expand All @@ -386,12 +386,12 @@ mod tests {
trace_flusher.enqueue(send_data_1);
trace_flusher.enqueue(send_data_2);

assert!(poll_for_mock_hit(&mock, 10, 150, 0).await);
assert!(poll_for_mock_hit(&mut mock, 10, 150, 0).await);

// enqueue a trace that exceeds the min force flush size
trace_flusher.enqueue(send_data_3);

assert!(poll_for_mock_hit(&mock, 5, 250, 1).await);
assert!(poll_for_mock_hit(&mut mock, 25, 100, 1).await);
}

#[cfg_attr(miri, ignore)]
Expand All @@ -403,7 +403,7 @@ mod tests {
..TraceFlusher::default()
});
let server = MockServer::start();
let mock = server
let mut mock = server
.mock_async(|_when, then| {
then.status(202)
.header("content-type", "application/json")
Expand All @@ -427,7 +427,7 @@ mod tests {
trace_flusher.interval_ms.load(Ordering::Relaxed) + 1,
))
.await;
assert!(poll_for_mock_hit(&mock, 25, 100, 1).await);
assert!(poll_for_mock_hit(&mut mock, 25, 100, 1).await);
}

#[cfg_attr(miri, ignore)]
Expand All @@ -439,7 +439,7 @@ mod tests {
..TraceFlusher::default()
});
let server = MockServer::start();
let mock = server
let mut mock = server
.mock_async(|_when, then| {
then.status(202)
.header("content-type", "application/json")
Expand All @@ -459,6 +459,6 @@ mod tests {

trace_flusher.enqueue(send_data_1);

assert!(poll_for_mock_hit(&mock, 5, 250, 0).await);
assert!(poll_for_mock_hit(&mut mock, 5, 250, 0).await);
}
}
7 changes: 5 additions & 2 deletions trace-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ futures = { version = "0.3", default-features = false }
ddcommon = { path = "../ddcommon" }
datadog-trace-protobuf = { path = "../trace-protobuf" }
datadog-trace-normalization = { path = "../trace-normalization" }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
rand = "0.8.5"
bytes = "1.6.0"

[dev-dependencies]
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
serde_json = "1.0"
httpmock = "0.7.0"
serde_json = "1.0"
Loading

0 comments on commit 30d1198

Please sign in to comment.