[ui] Parallelize ember tests (#17442)

* Exam to parallelize tests

* Logging to try to solve test flakiness

* Logging in another failure

* Hardening for one test and snapshot for another

* Explicitly set the first one as the servicedAlloc instead of randomly picking

* A wild CircleCI test failure appears

* de-log
This commit is contained in:
Phil Renaud 2023-06-07 17:01:35 -04:00 committed by GitHub
parent 134e70cbab
commit 944f30674d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 60 additions and 54 deletions

View File

@ -49,7 +49,7 @@ jobs:
- name: Ember tests
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
run: mkdir -p /tmp/test-reports && cd ui && yarn test
run: mkdir -p /tmp/test-reports && cd ui && yarn exam
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
path: "/tmp/test-reports"

File diff suppressed because one or more lines are too long

View File

@ -52,9 +52,9 @@ export default Factory.extend({
});
}
if (!service.allocId) {
const servicedAlloc = pickOne(
server.db.allocations.filter((a) => a.jobId === 'service-haver') || []
);
const servicedAlloc = (server.db.allocations.filter(
(a) => a.jobId === 'service-haver'
) || [])[0];
if (servicedAlloc) {
service.update({
allocId: servicedAlloc.id,

View File

@ -20,6 +20,7 @@
"build-storybook": "STORYBOOK=true ember build && build-storybook -s dist",
"storybook": "STORYBOOK=true start-storybook -p 6006 -s dist",
"test": "npm-run-all lint test:*",
"exam": "ember exam --split=4 --parallel",
"test:ember": "percy exec -- ember test",
"local:qunitdom": "ember test --server --query=dockcontainer",
"local:exam": "ember exam --server --load-balance --parallel=4",

View File

@ -38,11 +38,13 @@ module('Acceptance | job services', function (hooks) {
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'
);
const serviceName = find(
'[data-test-service-level="group"][data-test-service-provider="nomad"]'
).getAttribute('data-test-service-name');
await find('[data-test-service-level="group"] a').click();
await find(
'[data-test-service-level="group"][data-test-service-provider="nomad"] a'
).click();
await settled();
assert.ok(

View File

@ -4,7 +4,7 @@
*/
/* eslint-disable qunit/require-expect */
import { click, currentURL } from '@ember/test-helpers';
import { click, currentURL, findAll } from '@ember/test-helpers';
import { run } from '@ember/runloop';
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
@ -80,7 +80,13 @@ module('Acceptance | task logs', function (hooks) {
run.cancelTimers();
}, 500);
await click('button.logs-sidebar-trigger');
const taskRow = [
...findAll('.task-sub-row').filter((row) => {
return row.textContent.includes(task.name);
}),
][0];
await click(taskRow.querySelector('button.logs-sidebar-trigger'));
assert.ok(TaskLogs.sidebarIsPresent, 'Sidebar is present');
assert