Improving test reliability

Improving the reliability of the slow sender test.

Still needs work, but to make this truly reliable, I'd need to add to the DDAgentWriter API.  I'll probably do that, but I'm trying to start with sticking to the existing API.
This commit is contained in:
dougqh 2019-12-10 10:25:21 -05:00
parent 7883366b83
commit 53eacfdc79
1 changed files with 14 additions and 2 deletions

View File

@ -445,6 +445,18 @@ class DDAgentWriterTest extends DDSpecification {
numPublished.get() + numFailedPublish.get() == numWritten
when:
// As best as possible, make sure a slot hasn't just freed up in the sender queue
// DQH - TODO: Add a flush to sender queue but don't wait for send to make the
// test reliable
while (numFlushes.get() - (numRequests.get() + numFailedRequests.get()) < senderQueueSize) {
// chunk the loop & wait to allow for flushing to send queue
(1..1_000).forEach {
writer.write(minimalTrace)
numWritten += 1
}
Thread.sleep(100)
}
def priorNumFailed = numFailedPublish.get()
// with both disruptor & queue full, should reject everything
@ -455,8 +467,8 @@ class DDAgentWriterTest extends DDSpecification {
}
then:
// timing means that not 100% will be rejected, but the vast majority should be rejected
numFailedPublish.get() - priorNumFailed > expectedRejects * 0.8
// if a slot frees up in the sending queue
numFailedPublish.get() - priorNumFailed > expectedRejects * 0.60
numPublished.get() + numFailedPublish.get() == numWritten
cleanup: