test: add GPU and quota service tests
This commit is contained in:
26
test/gpu.test.js
Normal file
26
test/gpu.test.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { describe, it } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { parseNvidiaSmiCsv } from '../src/services/gpu.js';
|
||||
|
||||
describe('parseNvidiaSmiCsv', () => {
|
||||
it('parses GPU memory and utilization rows', () => {
|
||||
const result = parseNvidiaSmiCsv('0, NVIDIA A100, 1024, 40960, 87\n1, RTX 4090, 12, 24564, 3');
|
||||
|
||||
assert.deepEqual(result, [
|
||||
{
|
||||
index: 0,
|
||||
name: 'NVIDIA A100',
|
||||
memoryUsedMiB: 1024,
|
||||
memoryTotalMiB: 40960,
|
||||
gpuUtilizationPercent: 87
|
||||
},
|
||||
{
|
||||
index: 1,
|
||||
name: 'RTX 4090',
|
||||
memoryUsedMiB: 12,
|
||||
memoryTotalMiB: 24564,
|
||||
gpuUtilizationPercent: 3
|
||||
}
|
||||
]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user