Skip to content

Commit

Permalink
Side effect: ensure at least one test recommendation is of MemoryMB r…
Browse files Browse the repository at this point in the history
…esource type
  • Loading branch information
philrenaud committed Jul 11, 2022
1 parent 9add4bb commit 7f8abfd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ui/tests/acceptance/optimize-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ module('Acceptance | optimize', function (hooks) {
.flat()
.find((r) => r.resource === 'CPU');

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

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

if (!currentTaskGroupHasCPURecommendation) {
Expand All @@ -85,6 +91,13 @@ module('Acceptance | optimize', function (hooks) {
resource: 'CPU',
});
}
if (!currentTaskGroupHasMemoryRecommendation) {
const currentTaskGroupTask = currentTaskGroup.tasks.models[0];
this.server.create('recommendation', {
task: currentTaskGroupTask,
resource: 'MemoryMB',
});
}

await Optimize.visit();

Expand Down

0 comments on commit 7f8abfd

Please sign in to comment.