Skip to content

Commit

Permalink
dump stats before expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
mceachen committed Mar 1, 2022
1 parent 4e3d5b5 commit 38320f8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/BatchCluster.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,10 @@ describe("BatchCluster", function () {
const tasks = await Promise.all(runTasks(bc, iterations))
assertExpectedResults(tasks)
await shutdown(bc)
console.log(bc.stats())
expect(bc.spawnedProcCount).to.be.within(
maxProcs,
(iterations + maxProcs) * 2 // because flaky
(iterations + maxProcs) * 3 // because flaky
)
const pids = sortNumeric(testPids())
expect(pids.length).to.be.gte(maxProcs)
Expand Down Expand Up @@ -403,6 +404,8 @@ describe("BatchCluster", function () {
runTasks(bc, iters, expectedResultCount)
))
)
console.log(bc.stats())

expectedResultCount += iters
assertExpectedResults(results)
expect(results.length).to.eql(expectedResultCount)
Expand All @@ -420,7 +423,7 @@ describe("BatchCluster", function () {

expect(bc.spawnedProcCount).to.be.within(
results.length / opts.maxTasksPerProcess,
results.length * 4 // because flaky
results.length * (isWin ? 9 : 5) // because flaky
)

// Expect no prior pids to remain, as long as there were before-pids:
Expand Down Expand Up @@ -730,6 +733,7 @@ describe("BatchCluster", function () {
maxProcCount: 4,
internalErrorCount: 0,
startErrorRatePerMinute: 0,
spawnedProcCount: 1,
childEndCounts: {},
ending: false,
ended: false,
Expand All @@ -744,6 +748,7 @@ describe("BatchCluster", function () {
maxProcCount: 4,
internalErrorCount: 0,
startErrorRatePerMinute: 0,
spawnedProcCount: 1,
childEndCounts: {},
ending: false,
ended: false,
Expand All @@ -759,6 +764,7 @@ describe("BatchCluster", function () {
maxProcCount: 4,
internalErrorCount: 0,
startErrorRatePerMinute: 0,
spawnedProcCount: 1,
childEndCounts: {},
ending: false,
ended: false,
Expand All @@ -775,6 +781,7 @@ describe("BatchCluster", function () {
maxProcCount: 4,
internalErrorCount: 0,
startErrorRatePerMinute: 0,
spawnedProcCount: 1,
childEndCounts: { ending: 1 },
ending: true,
ended: true,
Expand Down

0 comments on commit 38320f8

Please sign in to comment.