| 514 | }); |
| 515 | |
| 516 | class ControlledSource implements MachineStatsSource { |
| 517 | public readonly name = 'controlled'; |
| 518 | protected values: Array<{ cpu: number | null; memory: number | null }> = []; |
| 519 | protected callCount = 0; |
| 520 | |
| 521 | public setSequence( |
| 522 | values: Array<{ cpu: number | null; memory: number | null }>, |
| 523 | ) { |
| 524 | this.values = values; |
| 525 | this.callCount = 0; |
| 526 | } |
| 527 | |
| 528 | public async read(): Promise<IResourceLoad> { |
| 529 | const i = this.callCount; |
| 530 | this.callCount++; |
| 531 | if (this.values.length === 0) { |
| 532 | return { cpu: 0, memory: 0 }; |
| 533 | } |
| 534 | return this.values[Math.min(i, this.values.length - 1)]; |
| 535 | } |
| 536 | } |
| 537 | |
| 538 | class TestMonitoring extends Monitoring { |
| 539 | public async runSample(): Promise<void> { |
nothing calls this directly
no outgoing calls
no test coverage detected