add flush timeout to emitter test (#8963)

This commit is contained in:
Clint Wylie 2019-11-27 19:30:09 -08:00 committed by Jonathan Wei
parent a5b40a6099
commit 923c003213
2 changed files with 9 additions and 0 deletions

View File

@ -81,6 +81,12 @@ public class HttpEmitterConfig extends BaseHttpEmittingConfig
return this; return this;
} }
public Builder setFlushTimeout(long flushTimeout)
{
this.flushTimeOut = flushTimeout;
return this;
}
public Builder setFlushCount(int flushCount) public Builder setFlushCount(int flushCount)
{ {
this.flushCount = flushCount; this.flushCount = flushCount;

View File

@ -52,6 +52,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -117,6 +118,7 @@ public class EmitterTest
{ {
HttpEmitterConfig config = new HttpEmitterConfig.Builder(TARGET_URL) HttpEmitterConfig config = new HttpEmitterConfig.Builder(TARGET_URL)
.setFlushMillis(timeInMillis) .setFlushMillis(timeInMillis)
.setFlushTimeout(TimeUnit.MILLISECONDS.convert(10, TimeUnit.SECONDS))
.setFlushCount(Integer.MAX_VALUE) .setFlushCount(Integer.MAX_VALUE)
.build(); .build();
HttpPostEmitter emitter = new HttpPostEmitter( HttpPostEmitter emitter = new HttpPostEmitter(
@ -132,6 +134,7 @@ public class EmitterTest
{ {
HttpEmitterConfig config = new HttpEmitterConfig.Builder(TARGET_URL) HttpEmitterConfig config = new HttpEmitterConfig.Builder(TARGET_URL)
.setFlushMillis(Long.MAX_VALUE) .setFlushMillis(Long.MAX_VALUE)
.setFlushTimeout(TimeUnit.MILLISECONDS.convert(10, TimeUnit.SECONDS))
.setFlushCount(size) .setFlushCount(size)
.build(); .build();
HttpPostEmitter emitter = new HttpPostEmitter( HttpPostEmitter emitter = new HttpPostEmitter(