Skip to content

Commit e25df1b

Browse files
committed
remove explicit adding now that tracker is singleton
1 parent 1286ee2 commit e25df1b

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

packages/core/src/test/shared/utilities/processUtils.test.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ describe('ChildProcessTracker', function () {
399399

400400
before(function () {
401401
clock = installFakeClock()
402-
tracker = ChildProcessTracker.instance
403402
usageMock = sinon.stub(ChildProcessTracker.prototype, 'getUsage')
404403
})
405404

@@ -415,7 +414,6 @@ describe('ChildProcessTracker', function () {
415414
it(`removes stopped processes every ${ChildProcessTracker.pollingInterval / 1000} seconds`, async function () {
416415
// Start a 'sleep' command, check it only removes after we stop it.
417416
const runningProcess = startSleepProcess()
418-
tracker.add(runningProcess.childProcess)
419417
assert.strictEqual(tracker.has(runningProcess.childProcess), true, 'failed to add sleep command')
420418

421419
await clock.tickAsync(ChildProcessTracker.pollingInterval)
@@ -433,8 +431,6 @@ describe('ChildProcessTracker', function () {
433431
it('multiple processes from same command are tracked seperately', async function () {
434432
const runningProcess1 = startSleepProcess()
435433
const runningProcess2 = startSleepProcess()
436-
tracker.add(runningProcess1.childProcess)
437-
tracker.add(runningProcess2.childProcess)
438434

439435
assert.strictEqual(tracker.has(runningProcess1.childProcess), true, 'Missing first process')
440436
assert.strictEqual(tracker.has(runningProcess2.childProcess), true, 'Missing second process')
@@ -461,7 +457,6 @@ describe('ChildProcessTracker', function () {
461457

462458
it('logs a warning message and emits metric when cpu exceeds threshold', async function () {
463459
const runningProcess = startSleepProcess()
464-
tracker.add(runningProcess.childProcess)
465460

466461
const highCpu: ProcessStats = {
467462
cpu: ChildProcessTracker.thresholds.cpu + 1,
@@ -482,7 +477,6 @@ describe('ChildProcessTracker', function () {
482477

483478
it('logs a warning message and emits metric when memory exceeds threshold', async function () {
484479
const runningProcess = startSleepProcess()
485-
tracker.add(runningProcess.childProcess)
486480
const highMemory: ProcessStats = {
487481
cpu: 0,
488482
memory: ChildProcessTracker.thresholds.memory + 1,
@@ -501,7 +495,6 @@ describe('ChildProcessTracker', function () {
501495

502496
it('includes pid in logs', async function () {
503497
const runningProcess = startSleepProcess()
504-
tracker.add(runningProcess.childProcess)
505498

506499
usageMock.resolves({
507500
cpu: ChildProcessTracker.thresholds.cpu + 1,
@@ -534,9 +527,6 @@ describe('ChildProcessTracker', function () {
534527
const runningProcess1 = startSleepProcess()
535528
const runningProcess2 = startSleepProcess()
536529

537-
tracker.add(runningProcess1.childProcess)
538-
tracker.add(runningProcess2.childProcess)
539-
540530
assert.ok(tracker.has(runningProcess1.childProcess), 'Missing first process')
541531
assert.ok(tracker.has(runningProcess2.childProcess), 'Missing seconds process')
542532

@@ -561,8 +551,7 @@ describe('ChildProcessTracker', function () {
561551
it('logsAllUsage emits telemetry to number of processes (nonempty)', async function () {
562552
const size = 10
563553
for (const _ of Array.from({ length: size })) {
564-
const runningProcess = startSleepProcess()
565-
tracker.add(runningProcess.childProcess)
554+
startSleepProcess()
566555
}
567556

568557
await tracker.logAllUsage()

0 commit comments

Comments
 (0)