diff --git a/lib/shared/drive-constraints.js b/lib/shared/drive-constraints.js index 1f7cb763..4469ac8b 100644 --- a/lib/shared/drive-constraints.js +++ b/lib/shared/drive-constraints.js @@ -375,7 +375,7 @@ exports.getDriveImageCompatibilityStatuses = (drive, image) => { type: exports.COMPATIBILITY_STATUS_TYPES.ERROR, message: exports.COMPATIBILITY_STATUS_MESSAGES.LOCKED }) - } else if (!_.isNil(drive) && !exports.isDriveLargeEnough(drive, image)) { + } else if (!_.isNil(drive) && !_.isNil(drive.size) && !exports.isDriveLargeEnough(drive, image)) { statusList.push({ type: exports.COMPATIBILITY_STATUS_TYPES.ERROR, message: exports.COMPATIBILITY_STATUS_MESSAGES.TOO_SMALL diff --git a/tests/shared/drive-constraints.spec.js b/tests/shared/drive-constraints.spec.js index d8f42c4a..c5a28d09 100644 --- a/tests/shared/drive-constraints.spec.js +++ b/tests/shared/drive-constraints.spec.js @@ -1021,6 +1021,18 @@ describe('Shared: DriveConstraints', function () { }) }) + describe('given the drive size is null', () => { + it('should not return the too small error', function () { + this.image.size.final.value = this.drive.size + 1 + this.drive.size = null + + const result = constraints.getDriveImageCompatibilityStatuses(this.drive, this.image) + const expectedTuples = [] + + expectStatusTypesAndMessagesToBe(result, expectedTuples) + }) + }) + describe('given the drive is locked', () => { it('should return the locked drive error', function () { this.drive.protected = true