Merge pull request #13365 from jtattermusch/stats_test_boundary_skipping

Make stats_test.IncHistogram skip values far from boundaries
pull/13376/head
Jan Tattermusch 7 years ago committed by GitHub
commit 4ed062561c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      test/core/debug/stats_test.cc

@ -109,11 +109,12 @@ TEST_P(HistogramTest, IncHistogram) {
}
};
std::vector<int> test_values;
for (int j = -1000;
j < grpc_stats_histo_bucket_boundaries
[kHistogram][grpc_stats_histo_buckets[kHistogram] - 1] +
1000;
j++) {
// largest bucket boundary for current histogram type.
int max_bucket_boundary =
grpc_stats_histo_bucket_boundaries[kHistogram]
[grpc_stats_histo_buckets[kHistogram] -
1];
for (int j = -1000; j < max_bucket_boundary + 1000;) {
int expected_bucket = FindExpectedBucket(kHistogram, j);
if (cur_bucket != expected_bucket) {
threads.emplace_back(
@ -122,6 +123,14 @@ TEST_P(HistogramTest, IncHistogram) {
test_values.clear();
}
test_values.push_back(j);
if (j < max_bucket_boundary &&
FindExpectedBucket(kHistogram, j + 1000) == expected_bucket &&
FindExpectedBucket(kHistogram, j - 1000) == expected_bucket) {
// if we are far from bucket boundary, skip values to speed-up the tests
j += 500;
} else {
j++;
}
}
run(test_values, cur_bucket);
for (auto& t : threads) {

Loading…
Cancel
Save