mirror of
https://github.com/apple/foundationdb.git
synced 2025-06-02 03:12:12 +08:00
Add /GrvProxyTagThrottler/MultiTag unit test
This commit is contained in:
parent
ed20a30c11
commit
9a3cdb9a3b
@ -378,6 +378,32 @@ TEST_CASE("/GrvProxyTagThrottler/MultiClient") {
|
||||
return Void();
|
||||
}
|
||||
|
||||
// Each tag receives 10 transaction/second budget
|
||||
TEST_CASE("/GrvProxyTagThrottler/MultiTag") {
|
||||
state GrvProxyTagThrottler throttler(5.0);
|
||||
state TagSet tagSet1;
|
||||
state TagSet tagSet2;
|
||||
state TransactionTagMap<uint32_t> counters;
|
||||
{
|
||||
TransactionTagMap<double> rates;
|
||||
rates["sampleTag1"_sr] = 10.0;
|
||||
rates["sampleTag2"_sr] = 10.0;
|
||||
throttler.updateRates(rates);
|
||||
}
|
||||
tagSet1.addTag("sampleTag1"_sr);
|
||||
tagSet2.addTag("sampleTag2"_sr);
|
||||
state Future<Void> client1 = mockClient(&throttler, TransactionPriority::DEFAULT, tagSet1, 5, 20.0, &counters);
|
||||
state Future<Void> client2 = mockClient(&throttler, TransactionPriority::DEFAULT, tagSet2, 5, 20.0, &counters);
|
||||
state Future<Void> server = mockServer(&throttler);
|
||||
wait(timeout(client1 && client2 && server, 60.0, Void()));
|
||||
TraceEvent("TagQuotaTest_MultiTag")
|
||||
.detail("Counter1", counters["sampleTag1"_sr])
|
||||
.detail("Counter2", counters["sampleTag2"_sr]);
|
||||
ASSERT(isNear(counters["sampleTag1"_sr], 60 * 10.0));
|
||||
ASSERT(isNear(counters["sampleTag2"_sr], 60 * 10.0));
|
||||
return Void();
|
||||
}
|
||||
|
||||
// Test processing GetReadVersionRequests that batch several transactions
|
||||
TEST_CASE("/GrvProxyTagThrottler/Batch") {
|
||||
state GrvProxyTagThrottler throttler(5.0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user