open-nomad/ui/tests/acceptance/job-services-test.js
Phil Renaud e03c5a43be Job Services: fixtures and acceptance tests (#14319)
* Added to subnav and basic table implemented

* Existing services become service fragments, and services tab aggregated beneath job route

* Index page within jobs/job/services

* Watchable services

* Lintfixes

* Links to clients and individual services set up

* Child service route

* Keyboard shortcuts on service page

* Model that shows consul services as well, plus level and provider cols

* lintfix

* Level as query param

* Watch job for service name changes too

* Group level service fixtures established

* Progress at task level and job-linked services

* Task and group services on update

* Fixture side-effect cleanup

* Basic acceptance tests for job services

* Testmodel cleanup

* Disabled mirage logging

* New cluster type specifically for services

* Without explicit job-model binding

* Trying to isolate a tostring error

* Account for new tab in keyboardnav

* More test isolation attempts

* Remove skipped tests and link task to parent group by id

ui: add service health viz to table (#14369)

* ui: add service-status-bar

* test: service-status-bar

* refact: update component api for new data struct

* ui: format service health struct

* ui:  add service health viz to table

* temp: add placeholder to remind conditional watcher

* test: write tests for transformation algorithm

* refact: update transformation algo

* ui: conditionally long poll checks endpoint

* refact: add conditional logic for nomad provider

refact: update service-fragment model to include owner info

ui: differentiate between task and group-level in derived state comp

test: add test to document behavior

refact: update tests for api change

refact: update integration test for API change

chore: remove unsused vars

chore: elvis operator to protect mirage

refact: create refId instead of internalModel

refact: update algo

refact: update conditional template logic

refact: update test for api change:

chore: cant use if and not in hbs conditional
2022-09-07 10:24:33 -04:00

55 lines
1.9 KiB
JavaScript

import { module, test } from 'qunit';
import { find, findAll, currentURL, settled } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { setupMirage } from 'ember-cli-mirage/test-support';
import { allScenarios } from '../../mirage/scenarios/default';
import a11yAudit from 'nomad-ui/tests/helpers/a11y-audit';
import Services from 'nomad-ui/tests/pages/jobs/job/services';
module('Acceptance | job services', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
hooks.beforeEach(async function () {
allScenarios.servicesTestCluster(server);
await Services.visit({ id: 'service-haver@default' });
});
test('Visiting job services', async function (assert) {
assert.expect(3);
assert.dom('.tabs.is-subnav a.is-active').hasText('Services');
assert.dom('.service-list table').exists();
await a11yAudit(assert);
});
test('it shows both consul and nomad, and both task and group services', async function (assert) {
assert.dom('table tr[data-test-service-provider="consul"]').exists();
assert.dom('table tr[data-test-service-provider="nomad"]').exists();
assert.dom('table tr[data-test-service-level="task"]').exists();
assert.dom('table tr[data-test-service-level="group"]').exists();
});
test('Digging into a service', async function (assert) {
const expectedNumAllocs = find(
'[data-test-service-level="group"]'
).getAttribute('data-test-num-allocs');
const serviceName = find('[data-test-service-level="group"]').getAttribute(
'data-test-service-name'
);
await find('[data-test-service-level="group"] a').click();
await settled();
assert.ok(
currentURL().includes(`services/${serviceName}?level=group`),
'correctly traverses to a service instance list'
);
assert.equal(
findAll('tr[data-test-service-row]').length,
expectedNumAllocs,
'Same number of alloc rows as the index shows'
);
});
});