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

[ui, tests] Various acceptance test fixups #25030

Closed
wants to merge 3 commits into from
Closed
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
15 changes: 15 additions & 0 deletions ui/mirage/factories/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ export default Factory.extend({
// When true, the job will have no versions or deployments (and in turn no latest deployment)
noDeployments: false,

// When true, the job will have a previous stable version. Useful for testing "start job" loop.
withPreviousStableVersion: false,

// When true, an evaluation with a high modify index and placement failures is created
failedPlacements: false,

Expand Down Expand Up @@ -317,8 +320,20 @@ export default Factory.extend({
version: index,
noActiveDeployment: job.noActiveDeployment,
activeDeployment: job.activeDeployment,
stable: true,
});
});

if (job.withPreviousStableVersion) {
server.create('job-version', {
job,
namespace: job.namespace,
version: 1,
noActiveDeployment: job.noActiveDeployment,
activeDeployment: job.activeDeployment,
stable: true,
});
}
}

if (job.activeDeployment) {
Expand Down
10 changes: 9 additions & 1 deletion ui/tests/acceptance/job-detail-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
allocStatusDistribution: {
running: 1,
},
withPreviousStableVersion: true,
})
);

Expand All @@ -39,6 +40,7 @@
allocStatusDistribution: {
running: 1,
},
withPreviousStableVersion: true,
})
);

Expand All @@ -52,6 +54,7 @@
running: 1,
failed: 1,
},
withPreviousStableVersion: true,
})
);

Expand All @@ -65,6 +68,7 @@
type: 'sysbatch',
createAllocations: false,
noActiveDeployment: true,
withPreviousStableVersion: true,
});
}
);
Expand All @@ -80,6 +84,7 @@
namespaceId: namespace.name,
createAllocations: false,
noActiveDeployment: true,
withPreviousStableVersion: true,
});
}
);
Expand All @@ -95,6 +100,7 @@
namespaceId: namespace.name,
createAllocations: false,
noActiveDeployment: true,
withPreviousStableVersion: true,
});
}
);
Expand All @@ -109,6 +115,7 @@
running: 1,
},
noActiveDeployment: true,
withPreviousStableVersion: true,
});
return server.db.jobs.where({ parentId: parent.id })[0];
});
Expand Down Expand Up @@ -212,6 +219,7 @@
server.create('job', 'parameterized', {
shallow: true,
noActiveDeployment: true,
withPreviousStableVersion: true,
}),
{
'the default sort is submitTime descending': async (job, assert) => {
Expand Down Expand Up @@ -292,7 +300,7 @@
moduleForJob(
'Acceptance | job detail (service)',
'allocations',
() => server.create('job', { type: 'service', noActiveDeployment: true }),
() => server.create('job', { type: 'service', noActiveDeployment: true, withPreviousStableVersion: true }),

Check failure on line 303 in ui/tests/acceptance/job-detail-test.js

View workflow job for this annotation

GitHub Actions / pre-test

Replace `·server.create('job',·{·type:·'service',·noActiveDeployment:·true,·withPreviousStableVersion:·true` with `⏎····server.create('job',·{⏎······type:·'service',⏎······noActiveDeployment:·true,⏎······withPreviousStableVersion:·true,⏎···`
{
'the subnav links to deployment': async (job, assert) => {
await JobDetail.tabFor('deployments').visit();
Expand Down
3 changes: 1 addition & 2 deletions ui/tests/acceptance/task-logs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,8 @@

test('the stdout log immediately starts streaming', async function (assert) {
await TaskLogs.visit({ id: allocation.id, name: task.name });
const node = server.db.nodes.find(allocation.nodeId);
const logUrlRegex = new RegExp(

Check failure on line 65 in ui/tests/acceptance/task-logs-test.js

View workflow job for this annotation

GitHub Actions / pre-test

Replace `⏎······`/v1/client/fs/logs/${allocation.id}`⏎····` with ``/v1/client/fs/logs/${allocation.id}``
`${node.httpAddr}/v1/client/fs/logs/${allocation.id}`
`/v1/client/fs/logs/${allocation.id}`
);
assert.ok(
server.pretender.handledRequests.filter((req) =>
Expand Down
6 changes: 5 additions & 1 deletion ui/tests/helpers/module-for-job.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ export default function moduleForJob(

test('the title buttons are dependent on job status', async function (assert) {
if (job.status === 'dead') {
assert.ok(JobDetail.start.isPresent);
if (job.stopped) {
assert.ok(JobDetail.start.isPresent);
} else {
assert.ok(JobDetail.revert.isPresent);
}
assert.ok(JobDetail.purge.isPresent);
assert.notOk(JobDetail.stop.isPresent);
assert.notOk(JobDetail.execButton.isPresent);
Expand Down
6 changes: 6 additions & 0 deletions ui/tests/integration/components/job-page/periodic-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ module('Integration | Component | job-page/periodic', function (hooks) {
childrenCount: 0,
createAllocations: false,
status: 'dead',
withPreviousStableVersion: true,
stopped: true,
});
await this.store.findAll('job');

Expand All @@ -223,6 +225,8 @@ module('Integration | Component | job-page/periodic', function (hooks) {
childrenCount: 0,
createAllocations: false,
status: 'dead',
withPreviousStableVersion: true,
stopped: true,
});
await this.store.findAll('job');

Expand All @@ -243,6 +247,8 @@ module('Integration | Component | job-page/periodic', function (hooks) {
childrenCount: 0,
createAllocations: false,
status: 'dead',
withPreviousStableVersion: true,
stopped: true,
});
await this.store.findAll('job');

Expand Down
17 changes: 14 additions & 3 deletions ui/tests/integration/components/job-page/service-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ module('Integration | Component | job-page/service', function (hooks) {
test('Starting a job sends a post request for the job using the current definition', async function (assert) {
assert.expect(1);

const mirageJob = makeMirageJob(this.server, { status: 'dead' });
const mirageJob = makeMirageJob(this.server, {
status: 'dead',
withPreviousStableVersion: true,
stopped: true,
});
await this.store.findAll('job');

const job = this.store.peekAll('job').findBy('plainId', mirageJob.id);
Expand All @@ -129,7 +133,11 @@ module('Integration | Component | job-page/service', function (hooks) {

this.server.pretender.post('/v1/job/:id', () => [403, {}, '']);

const mirageJob = makeMirageJob(this.server, { status: 'dead' });
const mirageJob = makeMirageJob(this.server, {
status: 'dead',
withPreviousStableVersion: true,
stopped: true,
});
await this.store.findAll('job');

const job = this.store.peekAll('job').findBy('plainId', mirageJob.id);
Expand All @@ -144,7 +152,10 @@ module('Integration | Component | job-page/service', function (hooks) {
test('Purging a job sends a purge request for the job', async function (assert) {
assert.expect(1);

const mirageJob = makeMirageJob(this.server, { status: 'dead' });
const mirageJob = makeMirageJob(this.server, {
status: 'dead',
withPreviousStableVersion: true,
});
await this.store.findAll('job');

const job = this.store.peekAll('job').findBy('plainId', mirageJob.id);
Expand Down
Loading