style: run Prettier formatting and ESLint lint:fix on test files
Addresses CI format:check failures and import-sort warning in MetricsPage.test.tsx flagged by QA on PR #17. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -124,9 +124,7 @@ describe('DevicePluginsPage', () => {
|
|||||||
);
|
);
|
||||||
render(<DevicePluginsPage />);
|
render(<DevicePluginsPage />);
|
||||||
expect(screen.getByText('CRD Not Available')).toBeInTheDocument();
|
expect(screen.getByText('CRD Not Available')).toBeInTheDocument();
|
||||||
expect(
|
expect(screen.getByText(/GpuDevicePlugin CRD.*is not installed/)).toBeInTheDocument();
|
||||||
screen.getByText(/GpuDevicePlugin CRD.*is not installed/)
|
|
||||||
).toBeInTheDocument();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows "No Device Plugins" section when crdAvailable=true but devicePlugins empty', () => {
|
it('shows "No Device Plugins" section when crdAvailable=true but devicePlugins empty', () => {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { describe, expect, it, vi } from 'vitest';
|
import { describe, expect, it, vi } from 'vitest';
|
||||||
import { IntelGpuContextValue, useIntelGpuContext } from '../api/IntelGpuDataContext';
|
import { IntelGpuContextValue, useIntelGpuContext } from '../api/IntelGpuDataContext';
|
||||||
import { GpuChipMetrics, GpuMetrics, fetchGpuMetrics } from '../api/metrics';
|
import { fetchGpuMetrics, GpuChipMetrics, GpuMetrics } from '../api/metrics';
|
||||||
import MetricsPage from './MetricsPage';
|
import MetricsPage from './MetricsPage';
|
||||||
|
|
||||||
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', () => ({
|
vi.mock('@kinvolk/headlamp-plugin/lib/CommonComponents', () => ({
|
||||||
|
|||||||
@@ -89,9 +89,7 @@ describe('NodeDetailSection', () => {
|
|||||||
|
|
||||||
it('renders nothing for a non-GPU node passed via jsonData wrapper', () => {
|
it('renders nothing for a non-GPU node passed via jsonData wrapper', () => {
|
||||||
vi.mocked(useIntelGpuContext).mockReturnValue(makeContext());
|
vi.mocked(useIntelGpuContext).mockReturnValue(makeContext());
|
||||||
const { container } = render(
|
const { container } = render(<NodeDetailSection resource={{ jsonData: nonGpuNodeRaw }} />);
|
||||||
<NodeDetailSection resource={{ jsonData: nonGpuNodeRaw }} />
|
|
||||||
);
|
|
||||||
expect(container).toBeEmptyDOMElement();
|
expect(container).toBeEmptyDOMElement();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -132,9 +130,7 @@ describe('NodeDetailSection', () => {
|
|||||||
metadata: { name: 'my-gpu-pod', namespace: 'default', uid: 'uid-pod-1' },
|
metadata: { name: 'my-gpu-pod', namespace: 'default', uid: 'uid-pod-1' },
|
||||||
spec: {
|
spec: {
|
||||||
nodeName: 'gpu-node-1',
|
nodeName: 'gpu-node-1',
|
||||||
containers: [
|
containers: [{ name: 'main', resources: { requests: { 'gpu.intel.com/i915': '1' } } }],
|
||||||
{ name: 'main', resources: { requests: { 'gpu.intel.com/i915': '1' } } },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
status: { phase: 'Running' },
|
status: { phase: 'Running' },
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -109,7 +109,10 @@ describe('OverviewPage', () => {
|
|||||||
name: 'gpu-node-1',
|
name: 'gpu-node-1',
|
||||||
labels: { 'intel.feature.node.kubernetes.io/gpu': 'true' },
|
labels: { 'intel.feature.node.kubernetes.io/gpu': 'true' },
|
||||||
},
|
},
|
||||||
status: { capacity: { 'gpu.intel.com/i915': '1' }, allocatable: { 'gpu.intel.com/i915': '1' } },
|
status: {
|
||||||
|
capacity: { 'gpu.intel.com/i915': '1' },
|
||||||
|
allocatable: { 'gpu.intel.com/i915': '1' },
|
||||||
|
},
|
||||||
};
|
};
|
||||||
vi.mocked(useIntelGpuContext).mockReturnValue(
|
vi.mocked(useIntelGpuContext).mockReturnValue(
|
||||||
makeContext({ loading: false, pluginInstalled: true, gpuNodes: [node] })
|
makeContext({ loading: false, pluginInstalled: true, gpuNodes: [node] })
|
||||||
|
|||||||
@@ -36,9 +36,7 @@ const nonGpuPodRaw = {
|
|||||||
kind: 'Pod',
|
kind: 'Pod',
|
||||||
metadata: { name: 'plain-pod', namespace: 'default' },
|
metadata: { name: 'plain-pod', namespace: 'default' },
|
||||||
spec: {
|
spec: {
|
||||||
containers: [
|
containers: [{ name: 'main', resources: { requests: { cpu: '100m', memory: '128Mi' } } }],
|
||||||
{ name: 'main', resources: { requests: { cpu: '100m', memory: '128Mi' } } },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
status: { phase: 'Running' },
|
status: { phase: 'Running' },
|
||||||
};
|
};
|
||||||
@@ -86,9 +84,7 @@ describe('PodDetailSection', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('renders nothing for a non-GPU pod passed via jsonData', () => {
|
it('renders nothing for a non-GPU pod passed via jsonData', () => {
|
||||||
const { container } = render(
|
const { container } = render(<PodDetailSection resource={{ jsonData: nonGpuPodRaw }} />);
|
||||||
<PodDetailSection resource={{ jsonData: nonGpuPodRaw }} />
|
|
||||||
);
|
|
||||||
expect(container).toBeEmptyDOMElement();
|
expect(container).toBeEmptyDOMElement();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -135,9 +135,7 @@ describe('PodsPage', () => {
|
|||||||
|
|
||||||
it('shows summary section with total count when pods present', () => {
|
it('shows summary section with total count when pods present', () => {
|
||||||
const pods = [makeRunningPod('pod-1'), makeRunningPod('pod-2')];
|
const pods = [makeRunningPod('pod-1'), makeRunningPod('pod-2')];
|
||||||
vi.mocked(useIntelGpuContext).mockReturnValue(
|
vi.mocked(useIntelGpuContext).mockReturnValue(makeContext({ loading: false, gpuPods: pods }));
|
||||||
makeContext({ loading: false, gpuPods: pods })
|
|
||||||
);
|
|
||||||
render(<PodsPage />);
|
render(<PodsPage />);
|
||||||
expect(screen.getByText('Summary')).toBeInTheDocument();
|
expect(screen.getByText('Summary')).toBeInTheDocument();
|
||||||
// 'Total GPU Pods' label is present; '2' appears in multiple places (row value + status label)
|
// 'Total GPU Pods' label is present; '2' appears in multiple places (row value + status label)
|
||||||
@@ -147,9 +145,7 @@ describe('PodsPage', () => {
|
|||||||
|
|
||||||
it('shows "Attention: Pending GPU Pods" section when pending pods exist', () => {
|
it('shows "Attention: Pending GPU Pods" section when pending pods exist', () => {
|
||||||
const pods = [makePendingPod('pending-pod-1')];
|
const pods = [makePendingPod('pending-pod-1')];
|
||||||
vi.mocked(useIntelGpuContext).mockReturnValue(
|
vi.mocked(useIntelGpuContext).mockReturnValue(makeContext({ loading: false, gpuPods: pods }));
|
||||||
makeContext({ loading: false, gpuPods: pods })
|
|
||||||
);
|
|
||||||
render(<PodsPage />);
|
render(<PodsPage />);
|
||||||
expect(screen.getByText('Attention: Pending GPU Pods')).toBeInTheDocument();
|
expect(screen.getByText('Attention: Pending GPU Pods')).toBeInTheDocument();
|
||||||
// Pod name appears in both the main "All GPU Pods" table and the pending attention table
|
// Pod name appears in both the main "All GPU Pods" table and the pending attention table
|
||||||
@@ -166,9 +162,7 @@ describe('PodsPage', () => {
|
|||||||
|
|
||||||
it('shows "All GPU Pods" table with pod name when pods present', () => {
|
it('shows "All GPU Pods" table with pod name when pods present', () => {
|
||||||
const pods = [makeRunningPod('my-workload')];
|
const pods = [makeRunningPod('my-workload')];
|
||||||
vi.mocked(useIntelGpuContext).mockReturnValue(
|
vi.mocked(useIntelGpuContext).mockReturnValue(makeContext({ loading: false, gpuPods: pods }));
|
||||||
makeContext({ loading: false, gpuPods: pods })
|
|
||||||
);
|
|
||||||
render(<PodsPage />);
|
render(<PodsPage />);
|
||||||
expect(screen.getByText('All GPU Pods')).toBeInTheDocument();
|
expect(screen.getByText('All GPU Pods')).toBeInTheDocument();
|
||||||
expect(screen.getByText('my-workload')).toBeInTheDocument();
|
expect(screen.getByText('my-workload')).toBeInTheDocument();
|
||||||
|
|||||||
Reference in New Issue
Block a user