dashboard: update InMemoryMetricsRepositoryTest
Signed-off-by: Eric Zhao <sczyh16@gmail.com>
This commit is contained in:
parent
10d7c903cf
commit
226589f773
|
|
@ -37,8 +37,6 @@ import static org.junit.Assert.*;
|
||||||
*/
|
*/
|
||||||
public class InMemoryMetricsRepositoryTest {
|
public class InMemoryMetricsRepositoryTest {
|
||||||
|
|
||||||
private static final int AVAILABLE_CPU_PROCESSORS = Runtime.getRuntime().availableProcessors();
|
|
||||||
|
|
||||||
private static final String DEFAULT_APP = "default";
|
private static final String DEFAULT_APP = "default";
|
||||||
private static final String DEFAULT_EXPIRE_APP = "default_expire_app";
|
private static final String DEFAULT_EXPIRE_APP = "default_expire_app";
|
||||||
private static final String DEFAULT_RESOURCE = "test";
|
private static final String DEFAULT_RESOURCE = "test";
|
||||||
|
|
@ -51,7 +49,7 @@ public class InMemoryMetricsRepositoryTest {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
inMemoryMetricsRepository = new InMemoryMetricsRepository();
|
inMemoryMetricsRepository = new InMemoryMetricsRepository();
|
||||||
executorService = Executors.newFixedThreadPool(AVAILABLE_CPU_PROCESSORS);
|
executorService = Executors.newFixedThreadPool(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
|
@ -112,7 +110,7 @@ public class InMemoryMetricsRepositoryTest {
|
||||||
List<CompletableFuture> futures = Lists.newArrayList();
|
List<CompletableFuture> futures = Lists.newArrayList();
|
||||||
|
|
||||||
// concurrent query resources of app
|
// concurrent query resources of app
|
||||||
final CyclicBarrier cyclicBarrier = new CyclicBarrier(AVAILABLE_CPU_PROCESSORS);
|
final CyclicBarrier cyclicBarrier = new CyclicBarrier(8);
|
||||||
for (int j = 0; j < 10000; j++) {
|
for (int j = 0; j < 10000; j++) {
|
||||||
futures.add(
|
futures.add(
|
||||||
CompletableFuture.runAsync(() -> {
|
CompletableFuture.runAsync(() -> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue