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: Fix recommendation test to ensure CPU exists #10004

Merged
merged 1 commit into from
Feb 16, 2021
Merged
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
19 changes: 17 additions & 2 deletions ui/tests/acceptance/optimize-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,26 @@ module('Acceptance | optimize', function(hooks) {
});

test('lets recommendations be toggled, reports the choices to the recommendations API, and displays task group recommendations serially', async function(assert) {
await Optimize.visit();

const currentTaskGroup = this.job1.taskGroups.models[0];
const nextTaskGroup = this.job2.taskGroups.models[0];

const currentTaskGroupHasCPURecommendation = currentTaskGroup.tasks.models
.mapBy('recommendations.models')
.flat()
.find(r => r.resource === 'CPU');

// If no CPU recommendation, will not be able to accept recommendation with all memory recommendations turned off

if (!currentTaskGroupHasCPURecommendation) {
const currentTaskGroupTask = currentTaskGroup.tasks.models[0];
this.server.create('recommendation', {
task: currentTaskGroupTask,
resource: 'CPU',
});
}

await Optimize.visit();

assert.equal(Layout.breadcrumbFor('optimize').text, 'Recommendations');

assert.equal(
Expand Down