Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user to start failed instances #2439

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/api/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export const genName = (...parts: [string, ...string[]]) => {
}

const instanceActions: Record<string, InstanceState[]> = {
// https://github.com/oxidecomputer/omicron/blob/6dd9802/nexus/src/app/instance.rs#L1960-L1963
start: ['stopped'],
// https://github.com/oxidecomputer/omicron/blob/0496637/nexus/src/app/instance.rs#L2064
start: ['stopped', 'failed'],

// https://github.com/oxidecomputer/omicron/blob/6dd9802/nexus/db-queries/src/db/datastore/instance.rs#L865
delete: ['stopped', 'failed'],
Expand Down
45 changes: 39 additions & 6 deletions test/e2e/instance.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,48 @@ test('can delete a failed instance', async ({ page }) => {

await expect(page).toHaveTitle('Instances / mock-project / Oxide Console')

const row = page.getByRole('row', { name: 'you-fail', exact: false })
await expect(row).toBeVisible()
await expect(row.getByRole('cell', { name: /failed/ })).toBeVisible()
const cell = page.getByRole('cell', { name: 'you-fail' })
await expect(cell).toBeVisible() // just to match hidden check at the end

await row.getByRole('button', { name: 'Row actions' }).click()
await page.getByRole('menuitem', { name: 'Delete' }).click()
const table = page.getByRole('table')
await expectRowVisible(table, {
name: 'you-fail',
state: expect.stringContaining('failed'),
})

await clickRowAction(page, 'you-fail', 'Delete')
await page.getByRole('button', { name: 'Confirm' }).click()

await expect(row).toBeHidden() // bye
await expect(cell).toBeHidden() // bye
})

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

// check the start button disabled message on a running instance
await page
.getByRole('row', { name: 'db1', exact: false })
.getByRole('button', { name: 'Row actions' })
.click()
await page.getByRole('menuitem', { name: 'Start' }).hover()
await expect(
page.getByText('Only stopped or failed instances can be started')
).toBeVisible()
await page.keyboard.press('Escape') // get out of the menu

// now start the failed one
const table = page.getByRole('table')
await expectRowVisible(table, {
name: 'you-fail',
state: expect.stringContaining('failed'),
})

await clickRowAction(page, 'you-fail', 'Start')

await expectRowVisible(table, {
name: 'you-fail',
state: expect.stringContaining('starting'),
})
})

test('can stop and delete a running instance', async ({ page }) => {
Expand Down
Loading