2023-04-10 15:36:59 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2021-12-28 19:30:38 +00:00
|
|
|
/* eslint-disable qunit/require-expect */
|
|
|
|
/* Mirage fixtures are random so we can't expect a set number of assertions */
|
2023-01-31 19:59:05 +00:00
|
|
|
import AdapterError from '@ember-data/adapter/error';
|
2019-05-21 00:19:24 +00:00
|
|
|
import { run } from '@ember/runloop';
|
2023-01-31 19:59:05 +00:00
|
|
|
import {
|
|
|
|
currentURL,
|
|
|
|
click,
|
|
|
|
visit,
|
|
|
|
triggerEvent,
|
|
|
|
waitFor,
|
|
|
|
} from '@ember/test-helpers';
|
2018-05-13 03:01:51 +00:00
|
|
|
import { assign } from '@ember/polyfills';
|
2019-09-26 16:50:01 +00:00
|
|
|
import { module, test } from 'qunit';
|
2019-03-13 00:04:16 +00:00
|
|
|
import { setupApplicationTest } from 'ember-qunit';
|
2019-09-26 18:47:07 +00:00
|
|
|
import { setupMirage } from 'ember-cli-mirage/test-support';
|
2020-07-28 17:59:14 +00:00
|
|
|
import a11yAudit from 'nomad-ui/tests/helpers/a11y-audit';
|
2018-07-11 18:27:23 +00:00
|
|
|
import Allocation from 'nomad-ui/tests/pages/allocations/detail';
|
2017-09-19 14:47:10 +00:00
|
|
|
import moment from 'moment';
|
2021-05-13 17:29:51 +00:00
|
|
|
import formatHost from 'nomad-ui/utils/format-host';
|
2017-09-19 14:47:10 +00:00
|
|
|
|
|
|
|
let job;
|
|
|
|
let node;
|
|
|
|
let allocation;
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
module('Acceptance | allocation detail', function (hooks) {
|
2019-03-13 00:04:16 +00:00
|
|
|
setupApplicationTest(hooks);
|
2019-03-13 01:09:19 +00:00
|
|
|
setupMirage(hooks);
|
2019-03-13 00:04:16 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
hooks.beforeEach(async function () {
|
2017-09-19 14:47:10 +00:00
|
|
|
server.create('agent');
|
|
|
|
|
|
|
|
node = server.create('node');
|
2019-09-04 14:39:56 +00:00
|
|
|
job = server.create('job', {
|
|
|
|
groupsCount: 1,
|
|
|
|
withGroupServices: true,
|
2022-01-20 15:39:02 +00:00
|
|
|
createAllocations: false,
|
2019-09-04 14:39:56 +00:00
|
|
|
});
|
2020-10-12 22:26:54 +00:00
|
|
|
allocation = server.create('allocation', 'withTaskWithPorts', {
|
2022-01-20 15:39:02 +00:00
|
|
|
clientStatus: 'running',
|
2019-09-04 14:39:56 +00:00
|
|
|
});
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2018-05-13 03:01:51 +00:00
|
|
|
// Make sure the node has an unhealthy driver
|
|
|
|
node.update({
|
|
|
|
driver: assign(node.drivers, {
|
|
|
|
docker: {
|
|
|
|
detected: true,
|
2022-01-20 15:39:02 +00:00
|
|
|
healthy: false,
|
|
|
|
},
|
|
|
|
}),
|
2018-05-13 03:01:51 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Make sure a task for the allocation depends on the unhealthy driver
|
|
|
|
server.schema.tasks.first().update({
|
2022-01-20 15:39:02 +00:00
|
|
|
driver: 'docker',
|
2018-05-13 03:01:51 +00:00
|
|
|
});
|
|
|
|
|
2019-03-14 06:44:53 +00:00
|
|
|
await Allocation.visit({ id: allocation.id });
|
2019-03-13 00:04:16 +00:00
|
|
|
});
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('it passes an accessibility audit', async function (assert) {
|
2020-08-25 15:56:02 +00:00
|
|
|
await a11yAudit(assert);
|
2020-07-28 17:59:14 +00:00
|
|
|
});
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('/allocation/:id should name the allocation and link to the corresponding job and node', async function (assert) {
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.ok(
|
|
|
|
Allocation.title.includes(allocation.name),
|
|
|
|
'Allocation name is in the heading'
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
Allocation.details.job,
|
|
|
|
job.name,
|
|
|
|
'Job name is in the subheading'
|
|
|
|
);
|
2019-03-13 00:04:16 +00:00
|
|
|
assert.equal(
|
|
|
|
Allocation.details.client,
|
|
|
|
node.id.split('-')[0],
|
|
|
|
'Node short id is in the subheading'
|
|
|
|
);
|
2020-05-11 16:29:30 +00:00
|
|
|
assert.ok(Allocation.execButton.isPresent);
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2023-02-02 21:29:04 +00:00
|
|
|
assert.equal(
|
|
|
|
document.title,
|
|
|
|
`Allocation ${allocation.name} - Mirage - Nomad`
|
|
|
|
);
|
2019-07-17 20:02:58 +00:00
|
|
|
|
2019-03-14 06:44:53 +00:00
|
|
|
await Allocation.details.visitJob();
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.equal(
|
|
|
|
currentURL(),
|
2022-04-28 18:02:15 +00:00
|
|
|
`/jobs/${job.id}@default`,
|
2021-12-28 16:08:12 +00:00
|
|
|
'Job link navigates to the job'
|
|
|
|
);
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2019-03-14 06:44:53 +00:00
|
|
|
await Allocation.visit({ id: allocation.id });
|
2017-09-26 07:47:16 +00:00
|
|
|
|
2019-03-14 06:44:53 +00:00
|
|
|
await Allocation.details.visitClient();
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.equal(
|
|
|
|
currentURL(),
|
|
|
|
`/clients/${node.id}`,
|
|
|
|
'Client link navigates to the client'
|
|
|
|
);
|
2017-09-19 14:47:10 +00:00
|
|
|
});
|
2018-09-19 23:33:51 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('/allocation/:id should include resource utilization graphs', async function (assert) {
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.equal(
|
|
|
|
Allocation.resourceCharts.length,
|
|
|
|
2,
|
|
|
|
'Two resource utilization graphs'
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
Allocation.resourceCharts.objectAt(0).name,
|
|
|
|
'CPU',
|
|
|
|
'First chart is CPU'
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
Allocation.resourceCharts.objectAt(1).name,
|
|
|
|
'Memory',
|
|
|
|
'Second chart is Memory'
|
|
|
|
);
|
2019-03-13 00:04:16 +00:00
|
|
|
});
|
2017-09-19 14:47:10 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('/allocation/:id should present task lifecycles', async function (assert) {
|
2020-04-30 13:15:19 +00:00
|
|
|
const job = server.create('job', {
|
|
|
|
groupsCount: 1,
|
2020-08-25 17:17:18 +00:00
|
|
|
groupTaskCount: 6,
|
2020-04-30 13:15:19 +00:00
|
|
|
withGroupServices: true,
|
2022-01-20 15:39:02 +00:00
|
|
|
createAllocations: false,
|
2020-04-30 13:15:19 +00:00
|
|
|
});
|
|
|
|
|
2020-10-12 22:26:54 +00:00
|
|
|
const allocation = server.create('allocation', 'withTaskWithPorts', {
|
2020-04-30 13:15:19 +00:00
|
|
|
clientStatus: 'running',
|
2022-01-20 15:39:02 +00:00
|
|
|
jobId: job.id,
|
2020-04-30 13:15:19 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
await Allocation.visit({ id: allocation.id });
|
|
|
|
|
|
|
|
assert.ok(Allocation.lifecycleChart.isPresent);
|
|
|
|
assert.equal(Allocation.lifecycleChart.title, 'Task Lifecycle Status');
|
2020-09-01 16:49:36 +00:00
|
|
|
assert.equal(Allocation.lifecycleChart.phases.length, 4);
|
2020-08-25 17:17:18 +00:00
|
|
|
assert.equal(Allocation.lifecycleChart.tasks.length, 6);
|
2020-04-30 13:15:19 +00:00
|
|
|
|
|
|
|
await Allocation.lifecycleChart.tasks[0].visit();
|
2020-08-25 17:17:18 +00:00
|
|
|
|
|
|
|
const prestartEphemeralTask = server.db.taskStates
|
|
|
|
.where({ allocationId: allocation.id })
|
2020-09-01 17:02:10 +00:00
|
|
|
.sortBy('name')
|
2022-01-20 15:39:02 +00:00
|
|
|
.find((taskState) => {
|
2020-08-25 17:17:18 +00:00
|
|
|
const task = server.db.tasks.findBy({ name: taskState.name });
|
2021-12-28 16:08:12 +00:00
|
|
|
return (
|
|
|
|
task.Lifecycle &&
|
|
|
|
task.Lifecycle.Hook === 'prestart' &&
|
|
|
|
!task.Lifecycle.Sidecar
|
|
|
|
);
|
2020-08-25 17:17:18 +00:00
|
|
|
});
|
|
|
|
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.equal(
|
|
|
|
currentURL(),
|
|
|
|
`/allocations/${allocation.id}/${prestartEphemeralTask.name}`
|
|
|
|
);
|
2020-04-30 13:15:19 +00:00
|
|
|
});
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('/allocation/:id should list all tasks for the allocation', async function (assert) {
|
2019-03-13 00:04:16 +00:00
|
|
|
assert.equal(
|
|
|
|
Allocation.tasks.length,
|
|
|
|
server.db.taskStates.where({ allocationId: allocation.id }).length,
|
|
|
|
'Table lists all tasks'
|
|
|
|
);
|
|
|
|
assert.notOk(Allocation.isEmpty, 'Task table empty state is not shown');
|
2017-09-19 14:47:10 +00:00
|
|
|
});
|
2019-03-13 00:04:16 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('each task row should list high-level information for the task', async function (assert) {
|
2022-08-23 19:50:40 +00:00
|
|
|
const job = server.create('job', {
|
|
|
|
groupsCount: 1,
|
|
|
|
groupTaskCount: 3,
|
|
|
|
withGroupServices: true,
|
|
|
|
createAllocations: false,
|
|
|
|
});
|
|
|
|
|
|
|
|
const allocation = server.create('allocation', 'withTaskWithPorts', {
|
|
|
|
clientStatus: 'running',
|
|
|
|
jobId: job.id,
|
|
|
|
});
|
2019-03-13 00:04:16 +00:00
|
|
|
|
2020-02-14 01:10:01 +00:00
|
|
|
const taskGroup = server.schema.taskGroups.where({
|
|
|
|
jobId: allocation.jobId,
|
2022-01-20 15:39:02 +00:00
|
|
|
name: allocation.taskGroup,
|
2020-02-14 01:10:01 +00:00
|
|
|
}).models[0];
|
|
|
|
|
2022-08-23 19:50:40 +00:00
|
|
|
// Set the expected task states.
|
|
|
|
const states = ['running', 'pending', 'dead'];
|
|
|
|
server.db.taskStates
|
|
|
|
.where({ allocationId: allocation.id })
|
|
|
|
.sortBy('name')
|
|
|
|
.forEach((task, i) => {
|
|
|
|
server.db.taskStates.update(task.id, { state: states[i] });
|
|
|
|
});
|
|
|
|
|
|
|
|
await Allocation.visit({ id: allocation.id });
|
|
|
|
|
|
|
|
Allocation.tasks.forEach((taskRow, i) => {
|
|
|
|
const task = server.db.taskStates
|
|
|
|
.where({ allocationId: allocation.id })
|
|
|
|
.sortBy('name')[i];
|
|
|
|
const events = server.db.taskEvents.where({ taskStateId: task.id });
|
|
|
|
const event = events[events.length - 1];
|
|
|
|
|
|
|
|
const jobTask = taskGroup.tasks.models.find((m) => m.name === task.name);
|
|
|
|
const volumes = jobTask.volumeMounts.map((volume) => ({
|
|
|
|
name: volume.Volume,
|
|
|
|
source: taskGroup.volumes[volume.Volume].Source,
|
|
|
|
}));
|
2020-02-14 01:10:01 +00:00
|
|
|
|
2020-02-14 01:04:12 +00:00
|
|
|
assert.equal(taskRow.name, task.name, 'Name');
|
|
|
|
assert.equal(taskRow.state, task.state, 'State');
|
[ui, feature] Job Page Redesign (#16932)
* [ui] Service job status panel (#16134)
* it begins
* Hacky demo enabled
* Still very hacky but seems deece
* Floor of at least 3 must be shown
* Width from on-high
* Other statuses considered
* More sensible allocTypes listing
* Beginnings of a legend
* Total number of allocs running now maps over job.groups
* Lintfix
* base the number of slots to hold open on actual tallies, which should never exceed totalAllocs
* Versions get yer versions here
* Versions lookin like versions
* Mirage fixup
* Adds Remaining as an alloc chart status and adds historical status option
* Get tests passing again by making job status static for a sec
* Historical status panel click actions moved into their own component class
* job detail tests plz chill
* Testing if percy is fickle
* Hyper-specfic on summary distribution bar identifier
* Perhaps the 2nd allocSummary item no longer exists with the more accurate afterCreate data
* UI Test eschewing the page pattern
* Bones of a new acceptance test
* Track width changes explicitly with window-resize
* testlintfix
* Alloc counting tests
* Alloc grouping test
* Alloc grouping with complex resizing
* Refined the list of showable statuses
* PR feedback addressed
* renamed allocation-row to allocation-status-row
* [ui, job status] Make panel status mode a queryParam (#16345)
* queryParam changing
* Test for QP in panel
* Adding @tracked to legacy controller
* Move the job of switching to Historical out to larger context
* integration test mock passed func
* [ui] Service job deployment status panel (#16383)
* A very fast and loose deployment panel
* Removing Unknown status from the panel
* Set up oldAllocs list in constructor, rather than as a getter/tracked var
* Small amount of template cleanup
* Refactored latest-deployment new logic back into panel.js
* Revert now-unused latest-deployment component
* margin bottom when ungrouped also
* Basic integration tests for job deployment status panel
* Updates complete alloc colour to green for new visualizations only (#16618)
* Updates complete alloc colour to green for new visualizations only
* Pale green instead of dark green for viz in general
* [ui] Job Deployment Status: History and Update Props (#16518)
* Deployment history wooooooo
* Styled deployment history
* Update Params
* lintfix
* Types and groups for updateParams
* Live-updating history
* Harden with types, error states, and pending states
* Refactor updateParams to use trigger component
* [ui] Deployment History search (#16608)
* Functioning searchbox
* Some nice animations for history items
* History search test
* Fixing up some old mirage conventions
* some a11y rule override to account for scss keyframes
* Split panel into deploying and steady components
* HandleError passed from job index
* gridified panel elements
* TotalAllocs added to deploying.js
* Width perc to px
* [ui] Splitting deployment allocs by status, health, and canary status (#16766)
* Initial attempt with lots of scratchpad work
* Style mods per UI discussion
* Fix canary overflow bug
* Dont show canary or health for steady/prev-alloc blocks
* Steady state
* Thanks Julie
* Fixes steady-state versions
* Legen, wait for it...
* Test fixes now that we have a minimum block size
* PR prep
* Shimmer effect on pending and unplaced allocs (#16801)
* Shimmer effect on pending and unplaced
* Dont show animation in the legend
* [ui, deployments] Linking allocblocks and legends to allocation / allocations index routes (#16821)
* Conditional link-to component and basic linking to allocations and allocation routes
* Job versions filter added to allocations index page
* Steady state legends link
* Legend links
* Badge count links for versions
* Fix: faded class on steady-state legend items
* version link now wont show completed ones
* Fix a11y violations with link labels
* Combining some template conditional logic
* [ui, deployments] Conversions on long nanosecond update params (#16882)
* Conversions on long nanosecond nums
* Early return in updateParamGroups comp prop
* [ui, deployments] Mirage Actively Deploying Job and Deployment Integration Tests (#16888)
* Start of deployment alloc test scaffolding
* Bit of test cleanup and canary for ungrouped allocs
* Flakey but more robust integrations for deployment panel
* De-flake acceptance tests and add an actively deploying job to mirage
* Jitter-less alloc status distribution removes my bad math
* bugfix caused by summary.desiredTotal non-null
* More interesting mirage active deployment alloc breakdown
* Further tests for previous-allocs row
* Previous alloc legend tests
* Percy snapshots added to integration test
* changelog
2023-04-25 02:45:39 +00:00
|
|
|
assert.equal(taskRow.message, event.message, 'Event Message');
|
2020-02-14 01:04:12 +00:00
|
|
|
assert.equal(
|
|
|
|
taskRow.time,
|
|
|
|
moment(event.time / 1000000).format("MMM DD, 'YY HH:mm:ss ZZ"),
|
|
|
|
'Event Time'
|
|
|
|
);
|
|
|
|
|
2022-08-23 19:50:40 +00:00
|
|
|
const expectStats = task.state === 'running';
|
|
|
|
assert.equal(taskRow.hasCpuMetrics, expectStats, 'CPU metrics');
|
|
|
|
assert.equal(taskRow.hasMemoryMetrics, expectStats, 'Memory metrics');
|
|
|
|
|
2020-02-14 01:10:01 +00:00
|
|
|
const volumesText = taskRow.volumes;
|
2022-01-20 15:39:02 +00:00
|
|
|
volumes.forEach((volume) => {
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.ok(
|
|
|
|
volumesText.includes(volume.name),
|
|
|
|
`Found label ${volume.name}`
|
|
|
|
);
|
|
|
|
assert.ok(
|
|
|
|
volumesText.includes(volume.source),
|
|
|
|
`Found value ${volume.source}`
|
|
|
|
);
|
2020-02-14 01:10:01 +00:00
|
|
|
});
|
2019-03-13 00:04:16 +00:00
|
|
|
});
|
2017-10-31 04:02:40 +00:00
|
|
|
});
|
2017-09-29 00:05:41 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('each task row should link to the task detail page', async function (assert) {
|
2021-12-28 16:08:12 +00:00
|
|
|
const task = server.db.taskStates
|
|
|
|
.where({ allocationId: allocation.id })
|
|
|
|
.sortBy('name')[0];
|
2018-06-06 21:25:48 +00:00
|
|
|
|
2019-03-14 06:44:53 +00:00
|
|
|
await Allocation.tasks.objectAt(0).clickLink();
|
2018-06-06 21:25:48 +00:00
|
|
|
|
2021-12-28 19:30:38 +00:00
|
|
|
// Make sure the allocation is pending in order to ensure there are no tasks
|
2018-06-06 21:25:48 +00:00
|
|
|
assert.equal(
|
|
|
|
currentURL(),
|
|
|
|
`/allocations/${allocation.id}/${task.name}`,
|
|
|
|
'Task name in task row links to task detail'
|
|
|
|
);
|
|
|
|
|
2019-03-14 06:44:53 +00:00
|
|
|
await Allocation.visit({ id: allocation.id });
|
|
|
|
await Allocation.tasks.objectAt(0).clickRow();
|
2018-06-06 21:25:48 +00:00
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
currentURL(),
|
|
|
|
`/allocations/${allocation.id}/${task.name}`,
|
|
|
|
'Task row links to task detail'
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('tasks with an unhealthy driver have a warning icon', async function (assert) {
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.ok(
|
|
|
|
Allocation.firstUnhealthyTask().hasUnhealthyDriver,
|
|
|
|
'Warning is shown'
|
|
|
|
);
|
2019-03-13 00:04:16 +00:00
|
|
|
});
|
2018-05-13 03:01:51 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('proxy task has a proxy tag', async function (assert) {
|
2019-09-05 19:09:32 +00:00
|
|
|
// Must create a new job as existing one has loaded and it contains the tasks
|
|
|
|
job = server.create('job', {
|
|
|
|
groupsCount: 1,
|
|
|
|
withGroupServices: true,
|
2022-01-20 15:39:02 +00:00
|
|
|
createAllocations: false,
|
2019-09-05 19:09:32 +00:00
|
|
|
});
|
|
|
|
|
2020-10-12 22:26:54 +00:00
|
|
|
allocation = server.create('allocation', 'withTaskWithPorts', {
|
2019-09-04 14:39:56 +00:00
|
|
|
clientStatus: 'running',
|
2022-01-20 15:39:02 +00:00
|
|
|
jobId: job.id,
|
2019-09-04 14:39:56 +00:00
|
|
|
});
|
|
|
|
|
2020-08-28 00:58:24 +00:00
|
|
|
const taskState = allocation.taskStates.models.sortBy('name')[0];
|
2019-09-05 19:09:32 +00:00
|
|
|
const task = server.schema.tasks.findBy({ name: taskState.name });
|
|
|
|
task.update('kind', 'connect-proxy:task');
|
|
|
|
task.save();
|
2019-09-04 14:39:56 +00:00
|
|
|
|
|
|
|
await Allocation.visit({ id: allocation.id });
|
|
|
|
|
|
|
|
assert.ok(Allocation.tasks[0].hasProxyTag);
|
|
|
|
});
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('when there are no tasks, an empty state is shown', async function (assert) {
|
2019-03-13 00:04:16 +00:00
|
|
|
// Make sure the allocation is pending in order to ensure there are no tasks
|
2021-12-28 16:08:12 +00:00
|
|
|
allocation = server.create('allocation', 'withTaskWithPorts', {
|
2022-01-20 15:39:02 +00:00
|
|
|
clientStatus: 'pending',
|
2021-12-28 16:08:12 +00:00
|
|
|
});
|
2019-03-14 06:44:53 +00:00
|
|
|
await Allocation.visit({ id: allocation.id });
|
2018-11-10 01:13:08 +00:00
|
|
|
|
|
|
|
assert.ok(Allocation.isEmpty, 'Task table empty state is shown');
|
|
|
|
});
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('when the allocation has not been rescheduled, the reschedule events section is not rendered', async function (assert) {
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.notOk(
|
|
|
|
Allocation.hasRescheduleEvents,
|
|
|
|
'Reschedule Events section exists'
|
|
|
|
);
|
2019-03-13 00:04:16 +00:00
|
|
|
});
|
2018-05-04 21:31:04 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('ports are listed', async function (assert) {
|
2020-10-12 22:26:54 +00:00
|
|
|
const allServerPorts = allocation.taskResources.models[0].resources.Ports;
|
2019-09-04 14:39:56 +00:00
|
|
|
|
|
|
|
allServerPorts.sortBy('Label').forEach((serverPort, index) => {
|
|
|
|
const renderedPort = Allocation.ports[index];
|
|
|
|
|
|
|
|
assert.equal(renderedPort.name, serverPort.Label);
|
|
|
|
assert.equal(renderedPort.to, serverPort.To);
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.equal(
|
|
|
|
renderedPort.address,
|
|
|
|
formatHost(serverPort.HostIP, serverPort.Value)
|
|
|
|
);
|
2019-09-04 14:39:56 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('services are listed', async function (assert) {
|
2021-12-28 16:08:12 +00:00
|
|
|
const taskGroup = server.schema.taskGroups.findBy({
|
2022-01-20 15:39:02 +00:00
|
|
|
name: allocation.taskGroup,
|
2021-12-28 16:08:12 +00:00
|
|
|
});
|
2019-09-04 14:39:56 +00:00
|
|
|
|
|
|
|
assert.equal(Allocation.services.length, taskGroup.services.length);
|
|
|
|
|
|
|
|
taskGroup.services.models.sortBy('name').forEach((serverService, index) => {
|
|
|
|
const renderedService = Allocation.services[index];
|
|
|
|
|
|
|
|
assert.equal(renderedService.name, serverService.name);
|
|
|
|
assert.equal(renderedService.port, serverService.portLabel);
|
2022-09-07 14:23:39 +00:00
|
|
|
assert.equal(renderedService.tags, (serverService.tags || []).join(' '));
|
2019-09-04 14:39:56 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('when the allocation is not found, an error message is shown, but the URL persists', async function (assert) {
|
2019-03-14 06:44:53 +00:00
|
|
|
await Allocation.visit({ id: 'not-a-real-allocation' });
|
2017-09-29 00:05:41 +00:00
|
|
|
|
|
|
|
assert.equal(
|
2020-01-20 20:57:01 +00:00
|
|
|
server.pretender.handledRequests
|
2022-01-20 15:39:02 +00:00
|
|
|
.filter((request) => !request.url.includes('policy'))
|
2020-01-20 20:57:01 +00:00
|
|
|
.findBy('status', 404).url,
|
2017-09-29 00:05:41 +00:00
|
|
|
'/v1/allocation/not-a-real-allocation',
|
2018-03-12 18:26:37 +00:00
|
|
|
'A request to the nonexistent allocation is made'
|
2017-09-29 00:05:41 +00:00
|
|
|
);
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.equal(
|
|
|
|
currentURL(),
|
|
|
|
'/allocations/not-a-real-allocation',
|
|
|
|
'The URL persists'
|
|
|
|
);
|
2018-07-11 18:27:23 +00:00
|
|
|
assert.ok(Allocation.error.isShown, 'Error message is shown');
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.equal(
|
|
|
|
Allocation.error.title,
|
|
|
|
'Not Found',
|
|
|
|
'Error message is for 404'
|
|
|
|
);
|
2017-09-29 00:05:41 +00:00
|
|
|
});
|
2019-05-21 00:19:24 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('allocation can be stopped', async function (assert) {
|
2019-05-21 00:19:24 +00:00
|
|
|
await Allocation.stop.idle();
|
|
|
|
await Allocation.stop.confirm();
|
|
|
|
|
|
|
|
assert.equal(
|
2022-01-13 02:26:02 +00:00
|
|
|
server.pretender.handledRequests
|
2022-01-20 15:39:02 +00:00
|
|
|
.reject((request) => request.url.includes('fuzzy'))
|
2022-01-13 02:26:02 +00:00
|
|
|
.findBy('method', 'POST').url,
|
2019-05-21 00:19:24 +00:00
|
|
|
`/v1/allocation/${allocation.id}/stop`,
|
|
|
|
'Stop request is made for the allocation'
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('allocation can be restarted', async function (assert) {
|
2022-08-24 22:43:44 +00:00
|
|
|
await Allocation.restartAll.idle();
|
2019-05-21 00:19:24 +00:00
|
|
|
await Allocation.restart.idle();
|
|
|
|
await Allocation.restart.confirm();
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
server.pretender.handledRequests.findBy('method', 'PUT').url,
|
|
|
|
`/v1/client/allocation/${allocation.id}/restart`,
|
|
|
|
'Restart request is made for the allocation'
|
|
|
|
);
|
2022-08-24 22:43:44 +00:00
|
|
|
|
|
|
|
await Allocation.restart.idle();
|
|
|
|
await Allocation.restartAll.idle();
|
|
|
|
await Allocation.restartAll.confirm();
|
|
|
|
|
|
|
|
assert.ok(
|
|
|
|
server.pretender.handledRequests.filterBy(
|
|
|
|
'requestBody',
|
|
|
|
JSON.stringify({ AllTasks: true })
|
|
|
|
),
|
|
|
|
'Restart all tasks request is made for the allocation'
|
|
|
|
);
|
2019-05-21 00:19:24 +00:00
|
|
|
});
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('while an allocation is being restarted, the stop button is disabled', async function (assert) {
|
2019-05-21 00:19:24 +00:00
|
|
|
server.pretender.post('/v1/allocation/:id/stop', () => [204, {}, ''], true);
|
|
|
|
|
|
|
|
await Allocation.stop.idle();
|
|
|
|
|
|
|
|
run.later(() => {
|
|
|
|
assert.ok(Allocation.stop.isRunning, 'Stop is loading');
|
|
|
|
assert.ok(Allocation.restart.isDisabled, 'Restart is disabled');
|
2022-08-24 22:43:44 +00:00
|
|
|
assert.ok(Allocation.restartAll.isDisabled, 'Restart All is disabled');
|
2019-05-21 00:19:24 +00:00
|
|
|
server.pretender.resolve(server.pretender.requestReferences[0].request);
|
|
|
|
}, 500);
|
|
|
|
|
|
|
|
await Allocation.stop.confirm();
|
|
|
|
});
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('if stopping or restarting fails, an error message is shown', async function (assert) {
|
2019-05-21 00:19:24 +00:00
|
|
|
server.pretender.post('/v1/allocation/:id/stop', () => [403, {}, '']);
|
|
|
|
|
|
|
|
await Allocation.stop.idle();
|
|
|
|
await Allocation.stop.confirm();
|
|
|
|
|
|
|
|
assert.ok(Allocation.inlineError.isShown, 'Inline error is shown');
|
|
|
|
assert.ok(
|
|
|
|
Allocation.inlineError.title.includes('Could Not Stop Allocation'),
|
|
|
|
'Title is descriptive'
|
|
|
|
);
|
|
|
|
assert.ok(
|
|
|
|
/ACL token.+?allocation lifecycle/.test(Allocation.inlineError.message),
|
|
|
|
'Message mentions ACLs and the appropriate permission'
|
|
|
|
);
|
|
|
|
|
|
|
|
await Allocation.inlineError.dismiss();
|
|
|
|
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.notOk(
|
|
|
|
Allocation.inlineError.isShown,
|
|
|
|
'Inline error is no longer shown'
|
|
|
|
);
|
2019-05-21 00:19:24 +00:00
|
|
|
});
|
2023-01-31 19:59:05 +00:00
|
|
|
|
|
|
|
test('when navigating to an allocation, if the allocation no longer exists it does a redirect to previous page', async function (assert) {
|
|
|
|
await click('[data-test-breadcrumb="jobs.job.index"]');
|
|
|
|
await click('[data-test-tab="allocations"] > a');
|
|
|
|
|
|
|
|
const component = this.owner.lookup('component:allocation-row');
|
|
|
|
const router = this.owner.lookup('service:router');
|
|
|
|
const allocRoute = this.owner.lookup('route:allocations.allocation');
|
|
|
|
const originalMethod = allocRoute.goBackToReferrer;
|
|
|
|
allocRoute.goBackToReferrer = () => {
|
|
|
|
assert.step('Transition dispatched.');
|
|
|
|
router.transitionTo('jobs.job.allocations');
|
|
|
|
};
|
|
|
|
|
|
|
|
component.onClick = () =>
|
|
|
|
router.transitionTo('allocations.allocation', 'aaa');
|
|
|
|
|
|
|
|
server.get('/allocation/:id', function () {
|
|
|
|
return new AdapterError([
|
|
|
|
{
|
|
|
|
detail: `alloc not found`,
|
|
|
|
status: 404,
|
|
|
|
},
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
component.onClick();
|
|
|
|
|
2023-03-02 18:52:16 +00:00
|
|
|
await waitFor('.flash-message.alert-critical');
|
2023-01-31 19:59:05 +00:00
|
|
|
|
|
|
|
assert.verifySteps(['Transition dispatched.']);
|
|
|
|
assert
|
2023-03-02 18:52:16 +00:00
|
|
|
.dom('.flash-message.alert-critical')
|
2023-01-31 19:59:05 +00:00
|
|
|
.exists('A toast error message pops up.');
|
|
|
|
|
|
|
|
// Clean-up
|
|
|
|
allocRoute.goBackToReferrer = originalMethod;
|
|
|
|
});
|
2017-09-29 00:05:41 +00:00
|
|
|
});
|
2018-04-10 01:40:53 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
module('Acceptance | allocation detail (rescheduled)', function (hooks) {
|
2019-03-13 00:04:16 +00:00
|
|
|
setupApplicationTest(hooks);
|
2019-03-14 06:44:53 +00:00
|
|
|
setupMirage(hooks);
|
2019-03-13 00:04:16 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
hooks.beforeEach(async function () {
|
2018-05-04 21:31:04 +00:00
|
|
|
server.create('agent');
|
|
|
|
|
|
|
|
node = server.create('node');
|
|
|
|
job = server.create('job', { createAllocations: false });
|
|
|
|
allocation = server.create('allocation', 'rescheduled');
|
|
|
|
|
2019-03-14 06:44:53 +00:00
|
|
|
await Allocation.visit({ id: allocation.id });
|
2019-03-13 00:04:16 +00:00
|
|
|
});
|
2018-05-04 21:31:04 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('when the allocation has been rescheduled, the reschedule events section is rendered', async function (assert) {
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.ok(
|
|
|
|
Allocation.hasRescheduleEvents,
|
|
|
|
'Reschedule Events section exists'
|
|
|
|
);
|
2019-03-13 00:04:16 +00:00
|
|
|
});
|
2018-05-04 21:31:04 +00:00
|
|
|
});
|
2018-12-11 01:28:35 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
module('Acceptance | allocation detail (not running)', function (hooks) {
|
2019-03-13 00:04:16 +00:00
|
|
|
setupApplicationTest(hooks);
|
2019-03-14 06:44:53 +00:00
|
|
|
setupMirage(hooks);
|
2019-03-13 00:04:16 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
hooks.beforeEach(async function () {
|
2018-12-11 01:28:35 +00:00
|
|
|
server.create('agent');
|
|
|
|
|
|
|
|
node = server.create('node');
|
|
|
|
job = server.create('job', { createAllocations: false });
|
|
|
|
allocation = server.create('allocation', { clientStatus: 'pending' });
|
|
|
|
|
2019-03-14 06:44:53 +00:00
|
|
|
await Allocation.visit({ id: allocation.id });
|
2019-03-13 00:04:16 +00:00
|
|
|
});
|
2018-12-11 01:28:35 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('when the allocation is not running, the utilization graphs are replaced by an empty message', async function (assert) {
|
2019-03-13 00:04:16 +00:00
|
|
|
assert.equal(Allocation.resourceCharts.length, 0, 'No resource charts');
|
|
|
|
assert.equal(
|
|
|
|
Allocation.resourceEmptyMessage,
|
|
|
|
"Allocation isn't running",
|
|
|
|
'Empty message is appropriate'
|
|
|
|
);
|
|
|
|
});
|
2020-05-11 16:29:30 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('the exec and stop/restart buttons are absent', async function (assert) {
|
2020-05-11 16:29:30 +00:00
|
|
|
assert.notOk(Allocation.execButton.isPresent);
|
|
|
|
assert.notOk(Allocation.stop.isPresent);
|
|
|
|
assert.notOk(Allocation.restart.isPresent);
|
2022-08-24 22:43:44 +00:00
|
|
|
assert.notOk(Allocation.restartAll.isPresent);
|
2020-05-11 16:29:30 +00:00
|
|
|
});
|
2018-12-11 01:28:35 +00:00
|
|
|
});
|
2019-04-22 23:10:21 +00:00
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
module('Acceptance | allocation detail (preemptions)', function (hooks) {
|
2019-04-22 23:10:21 +00:00
|
|
|
setupApplicationTest(hooks);
|
|
|
|
setupMirage(hooks);
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
hooks.beforeEach(async function () {
|
2019-04-22 23:10:21 +00:00
|
|
|
server.create('agent');
|
|
|
|
node = server.create('node');
|
|
|
|
job = server.create('job', { createAllocations: false });
|
|
|
|
});
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('shows a dedicated section to the allocation that preempted this allocation', async function (assert) {
|
2019-04-22 23:10:21 +00:00
|
|
|
allocation = server.create('allocation', 'preempted');
|
2021-12-28 16:08:12 +00:00
|
|
|
const preempter = server.schema.find(
|
|
|
|
'allocation',
|
|
|
|
allocation.preemptedByAllocation
|
|
|
|
);
|
2019-04-22 23:10:21 +00:00
|
|
|
const preempterJob = server.schema.find('job', preempter.jobId);
|
|
|
|
const preempterClient = server.schema.find('node', preempter.nodeId);
|
|
|
|
|
|
|
|
await Allocation.visit({ id: allocation.id });
|
|
|
|
assert.ok(Allocation.wasPreempted, 'Preempted allocation section is shown');
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.equal(
|
|
|
|
Allocation.preempter.status,
|
|
|
|
preempter.clientStatus,
|
|
|
|
'Preempter status matches'
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
Allocation.preempter.name,
|
|
|
|
preempter.name,
|
|
|
|
'Preempter name matches'
|
|
|
|
);
|
2019-04-22 23:10:21 +00:00
|
|
|
assert.equal(
|
|
|
|
Allocation.preempter.priority,
|
|
|
|
preempterJob.priority,
|
|
|
|
'Preempter priority matches'
|
|
|
|
);
|
|
|
|
|
|
|
|
await Allocation.preempter.visit();
|
|
|
|
assert.equal(
|
|
|
|
currentURL(),
|
|
|
|
`/allocations/${preempter.id}`,
|
|
|
|
'Clicking the preempter id navigates to the preempter allocation detail page'
|
|
|
|
);
|
|
|
|
|
|
|
|
await Allocation.visit({ id: allocation.id });
|
2022-02-17 10:56:29 +00:00
|
|
|
|
2019-04-22 23:10:21 +00:00
|
|
|
await Allocation.preempter.visitJob();
|
|
|
|
assert.equal(
|
|
|
|
currentURL(),
|
2022-05-13 21:01:27 +00:00
|
|
|
`/jobs/${preempterJob.id}@default`,
|
2019-04-22 23:10:21 +00:00
|
|
|
'Clicking the preempter job link navigates to the preempter job page'
|
|
|
|
);
|
|
|
|
|
|
|
|
await Allocation.visit({ id: allocation.id });
|
|
|
|
await Allocation.preempter.visitClient();
|
|
|
|
assert.equal(
|
|
|
|
currentURL(),
|
|
|
|
`/clients/${preempterClient.id}`,
|
|
|
|
'Clicking the preempter client link navigates to the preempter client page'
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('shows a dedicated section to the allocations this allocation preempted', async function (assert) {
|
2019-04-22 23:10:21 +00:00
|
|
|
allocation = server.create('allocation', 'preempter');
|
|
|
|
await Allocation.visit({ id: allocation.id });
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.ok(
|
|
|
|
Allocation.preempted,
|
|
|
|
'The allocations this allocation preempted are shown'
|
|
|
|
);
|
2019-04-22 23:10:21 +00:00
|
|
|
});
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('each preempted allocation in the table lists basic allocation information', async function (assert) {
|
2019-04-22 23:10:21 +00:00
|
|
|
allocation = server.create('allocation', 'preempter');
|
|
|
|
await Allocation.visit({ id: allocation.id });
|
|
|
|
|
|
|
|
const preemption = allocation.preemptedAllocations
|
2022-01-20 15:39:02 +00:00
|
|
|
.map((id) => server.schema.find('allocation', id))
|
2019-04-22 23:10:21 +00:00
|
|
|
.sortBy('modifyIndex')
|
|
|
|
.reverse()[0];
|
|
|
|
const preemptionRow = Allocation.preemptions.objectAt(0);
|
|
|
|
|
|
|
|
assert.equal(
|
|
|
|
Allocation.preemptions.length,
|
|
|
|
allocation.preemptedAllocations.length,
|
|
|
|
'The preemptions table has a row for each preempted allocation'
|
|
|
|
);
|
|
|
|
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.equal(
|
|
|
|
preemptionRow.shortId,
|
|
|
|
preemption.id.split('-')[0],
|
|
|
|
'Preemption short id'
|
|
|
|
);
|
2019-04-22 23:10:21 +00:00
|
|
|
assert.equal(
|
|
|
|
preemptionRow.createTime,
|
|
|
|
moment(preemption.createTime / 1000000).format('MMM DD HH:mm:ss ZZ'),
|
|
|
|
'Preemption create time'
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
preemptionRow.modifyTime,
|
|
|
|
moment(preemption.modifyTime / 1000000).fromNow(),
|
|
|
|
'Preemption modify time'
|
|
|
|
);
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.equal(
|
|
|
|
preemptionRow.status,
|
|
|
|
preemption.clientStatus,
|
|
|
|
'Client status'
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
preemptionRow.jobVersion,
|
|
|
|
preemption.jobVersion,
|
|
|
|
'Job Version'
|
|
|
|
);
|
2019-04-22 23:10:21 +00:00
|
|
|
assert.equal(
|
|
|
|
preemptionRow.client,
|
|
|
|
server.db.nodes.find(preemption.nodeId).id.split('-')[0],
|
|
|
|
'Node ID'
|
|
|
|
);
|
|
|
|
|
|
|
|
await preemptionRow.visitClient();
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.equal(
|
|
|
|
currentURL(),
|
|
|
|
`/clients/${preemption.nodeId}`,
|
|
|
|
'Node links to node page'
|
|
|
|
);
|
2019-04-22 23:10:21 +00:00
|
|
|
});
|
|
|
|
|
2022-01-20 15:39:02 +00:00
|
|
|
test('when an allocation both preempted allocations and was preempted itself, both preemptions sections are shown', async function (assert) {
|
2019-04-22 23:10:21 +00:00
|
|
|
allocation = server.create('allocation', 'preempter', 'preempted');
|
|
|
|
await Allocation.visit({ id: allocation.id });
|
2021-12-28 16:08:12 +00:00
|
|
|
assert.ok(
|
|
|
|
Allocation.preempted,
|
|
|
|
'The allocations this allocation preempted are shown'
|
|
|
|
);
|
2019-04-22 23:10:21 +00:00
|
|
|
assert.ok(Allocation.wasPreempted, 'Preempted allocation section is shown');
|
|
|
|
});
|
|
|
|
});
|
2022-09-07 14:23:39 +00:00
|
|
|
|
|
|
|
module('Acceptance | allocation detail (services)', function (hooks) {
|
|
|
|
setupApplicationTest(hooks);
|
|
|
|
setupMirage(hooks);
|
|
|
|
|
|
|
|
hooks.beforeEach(async function () {
|
|
|
|
server.create('feature', { name: 'Dynamic Application Sizing' });
|
|
|
|
server.createList('agent', 3, 'withConsulLink', 'withVaultLink');
|
|
|
|
server.createList('node', 5);
|
|
|
|
server.createList('job', 1, { createRecommendations: true });
|
2022-09-08 20:03:56 +00:00
|
|
|
const job = server.create('job', {
|
2022-09-07 14:23:39 +00:00
|
|
|
withGroupServices: true,
|
|
|
|
withTaskServices: true,
|
|
|
|
name: 'Service-haver',
|
|
|
|
id: 'service-haver',
|
|
|
|
namespaceId: 'default',
|
|
|
|
});
|
|
|
|
|
2022-09-08 20:03:56 +00:00
|
|
|
const currentAlloc = server.db.allocations.findBy({ jobId: job.id });
|
|
|
|
const otherAlloc = server.db.allocations.reject((j) => j.jobId !== job.id);
|
|
|
|
|
2022-09-07 14:23:39 +00:00
|
|
|
server.db.serviceFragments.update({
|
|
|
|
healthChecks: [
|
|
|
|
{
|
|
|
|
Status: 'success',
|
|
|
|
Check: 'check1',
|
|
|
|
Timestamp: 99,
|
2022-09-08 20:03:56 +00:00
|
|
|
Alloc: currentAlloc.id,
|
2022-09-07 14:23:39 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Status: 'failure',
|
|
|
|
Check: 'check2',
|
|
|
|
Output: 'One',
|
|
|
|
propThatDoesntMatter:
|
|
|
|
'this object will be ignored, since it shared a Check name with a later one.',
|
|
|
|
Timestamp: 98,
|
2022-09-08 20:03:56 +00:00
|
|
|
Alloc: currentAlloc.id,
|
2022-09-07 14:23:39 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Status: 'success',
|
|
|
|
Check: 'check2',
|
|
|
|
Output: 'Two',
|
|
|
|
Timestamp: 99,
|
2022-09-08 20:03:56 +00:00
|
|
|
Alloc: currentAlloc.id,
|
2022-09-07 14:23:39 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
Status: 'failure',
|
|
|
|
Check: 'check3',
|
|
|
|
Output: 'Oh no!',
|
|
|
|
Timestamp: 99,
|
2022-09-08 20:03:56 +00:00
|
|
|
Alloc: currentAlloc.id,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Status: 'success',
|
|
|
|
Check: 'check3',
|
|
|
|
Output: 'Wont be seen',
|
|
|
|
propThatDoesntMatter:
|
|
|
|
'this object will be ignored, in spite of its later timestamp, since it exists on a different alloc',
|
|
|
|
Timestamp: 100,
|
|
|
|
Alloc: otherAlloc.id,
|
2022-09-07 14:23:39 +00:00
|
|
|
},
|
|
|
|
],
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
test('Allocation has a list of services with active checks', async function (assert) {
|
|
|
|
await visit('jobs/service-haver@default');
|
|
|
|
await click('.allocation-row');
|
|
|
|
assert.dom('[data-test-service]').exists();
|
|
|
|
assert.dom('.service-sidebar').exists();
|
|
|
|
assert.dom('.service-sidebar').doesNotHaveClass('open');
|
|
|
|
assert
|
|
|
|
.dom('[data-test-service-status-bar]')
|
|
|
|
.exists('At least one allocation has service health');
|
|
|
|
await click('[data-test-service-status-bar]');
|
|
|
|
assert.dom('.service-sidebar').hasClass('open');
|
|
|
|
assert
|
|
|
|
.dom('table.health-checks tr[data-service-health="success"]')
|
|
|
|
.exists({ count: 2 }, 'Two successful health checks');
|
|
|
|
assert
|
|
|
|
.dom('table.health-checks tr[data-service-health="failure"]')
|
|
|
|
.exists({ count: 1 }, 'One failing health check');
|
|
|
|
assert
|
|
|
|
.dom(
|
|
|
|
'table.health-checks tr[data-service-health="failure"] td.service-output'
|
|
|
|
)
|
|
|
|
.containsText('Oh no!');
|
|
|
|
|
|
|
|
await triggerEvent('.page-layout', 'keydown', { key: 'Escape' });
|
|
|
|
assert.dom('.service-sidebar').doesNotHaveClass('open');
|
|
|
|
});
|
|
|
|
});
|