Skip to content

Commit

Permalink
TritonDataCenter#95 Machines resize tests failing on COAL
Browse files Browse the repository at this point in the history
  • Loading branch information
Marsell Kukuljevic committed May 22, 2021
1 parent 4d1097b commit 06361c9
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions test/machines/resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function (suite, client, other, machine, pkgDown, pkgSame, pkgUp, cb) {
return cb();
}

suite.test('Resize Machine to insuficient capacity fails', function (t) {
suite.test('Resize Machine to insufficient capacity fails', function (t) {
t.ok(pkgUp, 'Resize up package OK');

return client.post('/my/machines/' + machine, {
Expand All @@ -40,12 +40,23 @@ function (suite, client, other, machine, pkgDown, pkgSame, pkgUp, cb) {
t.equal(body.code, 'ValidationFailed');
t.equal(body.message, 'Invalid VM update parameters');

t.equal(body.errors.length, 1);
var error = body.errors[0];
var errors = body.errors;

t.equal(error.field, 'ram');
t.equal(error.code, 'InsufficientCapacity');
}
errors.forEach(function (bErr) {
t.equal(bErr.code, 'InsufficientCapacity');
});

if (errors.length === 1) {
t.equal(errors[0].field, 'ram');
} else if (errors.length === 2) {
var fields = errors.map(function (bErr) {
return bErr.field;
}).sort();
t.deepEqual(fields, ['quota', 'ram']);
} else {
t.fail('Unexpected capacity field');
}
}

t.end();
});
Expand Down

0 comments on commit 06361c9

Please sign in to comment.