Skip to content

Commit

Permalink
add test, remove modified column from sled instances
Browse files Browse the repository at this point in the history
  • Loading branch information
david-crespo committed Aug 20, 2024
1 parent b450a05 commit cb91b6b
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
7 changes: 2 additions & 5 deletions app/pages/project/instances/InstancesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export function InstancesPage() {
),
}),
colHelper.accessor('memory', {
header: 'RAM',
header: 'Memory',
cell: (info) => {
const memory = filesize(info.getValue(), { output: 'object', base: 2 })
return (
Expand All @@ -119,10 +119,7 @@ export function InstancesPage() {
},
}),
colHelper.accessor(
(i) => ({
runState: i.runState,
timeRunStateUpdated: i.timeRunStateUpdated,
}),
(i) => ({ runState: i.runState, timeRunStateUpdated: i.timeRunStateUpdated }),
{
header: 'status',
cell: (info) => <InstanceStatusCell value={info.getValue()} />,
Expand Down
5 changes: 3 additions & 2 deletions app/pages/system/inventory/sled/SledInstancesTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,17 @@ const staticCols = [
)
},
}),
// we don't show run state last update time like on project instances because
// it's not in this response
colHelper.accessor('state', {
header: 'status',
cell: (info) => <InstanceStatusBadge key="run-state" status={info.getValue()} />,
cell: (info) => <InstanceStatusBadge status={info.getValue()} />,
}),
colHelper.accessor((i) => R.pick(i, ['memory', 'ncpus']), {
header: 'specs',
cell: (info) => <InstanceResourceCell value={info.getValue()} />,
}),
colHelper.accessor('timeCreated', Columns.timeCreated),
colHelper.accessor('timeModified', Columns.timeModified),
]

export function SledInstancesTab() {
Expand Down
26 changes: 25 additions & 1 deletion test/e2e/instance.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* Copyright Oxide Computer Company
*/
import { expect, refreshInstance, sleep, test } from './utils'
import { expect, expectRowVisible, refreshInstance, sleep, test } from './utils'

test('can delete a failed instance', async ({ page }) => {
await page.goto('/projects/mock-project/instances')
Expand Down Expand Up @@ -78,3 +78,27 @@ test('delete from instance detail', async ({ page }) => {
await expect(page.getByRole('cell', { name: 'db1' })).toBeVisible()
await expect(page.getByRole('cell', { name: 'you-fail' })).toBeHidden()
})

test('instance table', async ({ page }) => {
await page.goto('/projects/mock-project/instances')

const table = page.getByRole('table')
await expectRowVisible(table, {
name: 'db1',
CPU: '2 vCPU',
Memory: '4 GiB',
status: 'running0s',
})
await expectRowVisible(table, {
name: 'you-fail',
CPU: '4 vCPU',
Memory: '6 GiB',
status: 'failed0s',
})
await expectRowVisible(table, {
name: 'not-there-yet',
CPU: '2 vCPU',
Memory: '8 GiB',
status: 'starting0s',
})
})

0 comments on commit cb91b6b

Please sign in to comment.