Skip to content

Commit

Permalink
Issue #5201 - Fix issues with test after changes to QTP dump
Browse files Browse the repository at this point in the history
Signed-off-by: Lachlan Roberts <[email protected]>
  • Loading branch information
lachlan-roberts committed Sep 3, 2020
1 parent 0a59a2b commit 85c8c65
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -715,9 +715,11 @@ else if (isDetailedDump())
threads.add(baseThreadInfo + " @ " + (trace.length > 0 ? trace[0].toString() : "???"));
}

dumpObjects(out, indent, new DumpableCollection("threads", threads));
DumpableCollection threadsDump = new DumpableCollection("threads", threads);
if (isDetailedDump())
dumpObjects(out, indent, new DumpableCollection("jobs", new ArrayList<>(getQueue())));
dumpObjects(out, indent, threadsDump, new DumpableCollection("jobs", new ArrayList<>(getQueue())));
else
dumpObjects(out, indent, threadsDump);
}

private String getKnownMethod(StackTraceElement[] trace)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,8 @@ public void testDump() throws Exception
assertThat(count(dump, " - STARTED"), is(2));
assertThat(dump, containsString(",3<=3<=4,i=3,r=2,q=0"));
assertThat(dump, containsString("[ReservedThreadExecutor@"));
assertThat(count(dump, " IDLE "), is(3));
assertThat(count(dump, " RESERVED "), is(0));
assertThat(count(dump, " IDLE"), is(3));
assertThat(count(dump, " RESERVED"), is(0));

CountDownLatch started = new CountDownLatch(1);
CountDownLatch waiting = new CountDownLatch(1);
Expand All @@ -801,9 +801,9 @@ public void testDump() throws Exception
assertThat(count(dump, " - STARTED"), is(2));
assertThat(dump, containsString(",3<=3<=4,i=2,r=2,q=0"));
assertThat(dump, containsString("[ReservedThreadExecutor@"));
assertThat(count(dump, " IDLE "), is(2));
assertThat(count(dump, " WAITING "), is(1));
assertThat(count(dump, " RESERVED "), is(0));
assertThat(count(dump, " IDLE"), is(2));
assertThat(count(dump, " WAITING"), is(1));
assertThat(count(dump, " RESERVED"), is(0));
assertThat(count(dump, "QueuedThreadPoolTest.lambda$testDump$"), is(0));

pool.setDetailedDump(true);
Expand All @@ -812,9 +812,9 @@ public void testDump() throws Exception
assertThat(dump, containsString(",3<=3<=4,i=2,r=2,q=0"));
assertThat(dump, containsString("s=0/2"));
assertThat(dump, containsString("[ReservedThreadExecutor@"));
assertThat(count(dump, " IDLE "), is(2));
assertThat(count(dump, " WAITING "), is(1));
assertThat(count(dump, " RESERVED "), is(0));
assertThat(count(dump, " IDLE"), is(2));
assertThat(count(dump, " WAITING"), is(1));
assertThat(count(dump, " RESERVED"), is(0));
assertThat(count(dump, "QueuedThreadPoolTest.lambda$testDump$"), is(1));

assertFalse(pool.tryExecute(() ->
Expand All @@ -827,9 +827,9 @@ public void testDump() throws Exception
assertThat(dump, containsString(",3<=3<=4,i=1,r=2,q=0"));
assertThat(dump, containsString("s=1/2"));
assertThat(dump, containsString("[ReservedThreadExecutor@"));
assertThat(count(dump, " IDLE "), is(1));
assertThat(count(dump, " WAITING "), is(1));
assertThat(count(dump, " RESERVED "), is(1));
assertThat(count(dump, " IDLE"), is(1));
assertThat(count(dump, " WAITING"), is(1));
assertThat(count(dump, " RESERVED"), is(1));
assertThat(count(dump, "QueuedThreadPoolTest.lambda$testDump$"), is(1));
}

Expand Down

0 comments on commit 85c8c65

Please sign in to comment.