Speed up slow acceptance tests with shallow jobs and generally less models

This commit is contained in:
Michael Lange 2019-04-11 20:08:43 -07:00
parent 6988dc1b5c
commit 9358713560
4 changed files with 12 additions and 10 deletions

View file

@ -13,6 +13,7 @@ const makeSearchAllocations = server => {
.map((_, index) => {
server.create('allocation', {
id: index < 5 ? `ffffff-dddddd-${index}` : `111111-222222-${index}`,
shallow: true,
});
});
};
@ -28,7 +29,7 @@ module('Acceptance | job allocations', function(hooks) {
});
test('lists all allocations for the job', async function(assert) {
server.createList('allocation', Allocations.pageSize - 1);
server.createList('allocation', Allocations.pageSize - 1, { shallow: true });
allocations = server.schema.allocations.where({ jobId: job.id }).models;
await Allocations.visit({ id: job.id });

View file

@ -8,26 +8,26 @@ import JobDetail from 'nomad-ui/tests/pages/jobs/detail';
import JobsList from 'nomad-ui/tests/pages/jobs/list';
moduleForJob('Acceptance | job detail (batch)', 'allocations', () =>
server.create('job', { type: 'batch' })
server.create('job', { type: 'batch', shallow: true })
);
moduleForJob('Acceptance | job detail (system)', 'allocations', () =>
server.create('job', { type: 'system' })
server.create('job', { type: 'system', shallow: true })
);
moduleForJob('Acceptance | job detail (periodic)', 'children', () =>
server.create('job', 'periodic')
server.create('job', 'periodic', { shallow: true })
);
moduleForJob('Acceptance | job detail (parameterized)', 'children', () =>
server.create('job', 'parameterized')
server.create('job', 'parameterized', { shallow: true })
);
moduleForJob('Acceptance | job detail (periodic child)', 'allocations', () => {
const parent = server.create('job', 'periodic');
const parent = server.create('job', 'periodic', { childrenCount: 1, shallow: true });
return server.db.jobs.where({ parentId: parent.id })[0];
});
moduleForJob('Acceptance | job detail (parameterized child)', 'allocations', () => {
const parent = server.create('job', 'parameterized');
const parent = server.create('job', 'parameterized', { childrenCount: 1, shallow: true });
return server.db.jobs.where({ parentId: parent.id })[0];
});

View file

@ -11,7 +11,7 @@ module('Acceptance | namespaces (disabled)', function(hooks) {
hooks.beforeEach(function() {
server.create('agent');
server.create('node');
server.createList('job', 5);
server.createList('job', 5, { createAllocations: false });
});
test('the namespace switcher is not in the gutter menu', async function(assert) {

View file

@ -15,7 +15,7 @@ module('Acceptance | regions (only one)', function(hooks) {
hooks.beforeEach(function() {
server.create('agent');
server.create('node');
server.createList('job', 5);
server.createList('job', 2, { createAllocations: false, noDeployments: true });
});
test('when there is only one region, the region switcher is not shown in the nav bar', async function(assert) {
@ -68,7 +68,8 @@ module('Acceptance | regions (many)', function(hooks) {
hooks.beforeEach(function() {
server.create('agent');
server.create('node');
server.createList('job', 5);
server.createList('job', 2, { createAllocations: false, noDeployments: true });
server.create('allocation');
server.create('region', { id: 'global' });
server.create('region', { id: 'region-2' });
});