diff --git a/tests/integration/models/os.spec.ts b/tests/integration/models/os.spec.ts index 05129fb5e..74959d9de 100644 --- a/tests/integration/models/os.spec.ts +++ b/tests/integration/models/os.spec.ts @@ -9,6 +9,7 @@ import { IS_BROWSER, applicationRetrievalFields, sdkOpts, + TEST_KEY_NAME_PREFIX, } from '../setup'; import { timeSuite } from '../../util'; import type * as BalenaSdk from '../../..'; @@ -986,6 +987,7 @@ describe('OS model', function () { ctx.application[prop], { version: DEFAULT_OS_VERSION, + provisioningKeyName: `${TEST_KEY_NAME_PREFIX}-download-config-by-prop-${prop}`, }, ); expect(config).to.have.property('applicationId'); @@ -1002,6 +1004,8 @@ describe('OS model', function () { it('should be rejected if the version is invalid', function () { const promise = balena.models.os.getConfig(ctx.application.id, { version: 'v1+foo', + // Use a name prefix to make cleaning up the api key easier + provisioningKeyName: `${TEST_KEY_NAME_PREFIX}-download-config-rejected-lte-1-2-0`, }); return expect(promise).to.be.rejected.then((error) => { expect(error).to.have.property('message'); @@ -1014,6 +1018,8 @@ describe('OS model', function () { it('should be rejected if the version is <= 1.2.0', function () { const promise = balena.models.os.getConfig(ctx.application.id, { version: '1.2.0', + // Use a name prefix to make cleaning up the api key easier + provisioningKeyName: `${TEST_KEY_NAME_PREFIX}-download-config-rejected-lte-1-2-0`, }); return expect(promise).to.be.rejected.then((error) => { expect(error).to.have.property('message'); @@ -1033,6 +1039,8 @@ describe('OS model', function () { gateway: '5.6.7.8', netmask: '9.10.11.12', version: '1.26.1', + // Use a name prefix to make cleaning up the api key easier + provisioningKeyName: `${TEST_KEY_NAME_PREFIX}-download-config-1-26-1`, }; return balena.models.os .getConfig(ctx.application.id, configOptions) @@ -1063,6 +1071,8 @@ describe('OS model', function () { gateway: '5.6.7.8', netmask: '9.10.11.12', version: '2.0.8+rev1.prod', + // Use a name prefix to make cleaning up the api key easier + provisioningKeyName: `${TEST_KEY_NAME_PREFIX}-download-config-2-0-8-rev1`, }; return balena.models.os .getConfig(ctx.application.id, configOptions) @@ -1079,7 +1089,7 @@ describe('OS model', function () { }); it('should be able to configure v2 image with a provisioning key name', async function () { - const provisioningKeyName = `provision-key-${Date.now()}`; + const provisioningKeyName = `${TEST_KEY_NAME_PREFIX}-provision-key-v2-${Date.now()}`; const configOptions = { appUpdatePollInterval: 72, network: 'wifi' as const, @@ -1121,6 +1131,7 @@ describe('OS model', function () { gateway: '5.6.7.8', netmask: '9.10.11.12', version: '2.11.8+rev1.prod', + provisioningKeyName: `${TEST_KEY_NAME_PREFIX}-download-config-with-expiry-date`, provisioningKeyExpiryDate, }; @@ -1145,6 +1156,7 @@ describe('OS model', function () { it('should be rejected if the application id does not exist', function () { const promise = balena.models.os.getConfig(999999, { version: DEFAULT_OS_VERSION, + provisioningKeyName: `${TEST_KEY_NAME_PREFIX}-download-config-application-id-not-exists`, }); return expect(promise).to.be.rejectedWith( 'Application not found: 999999', @@ -1154,6 +1166,7 @@ describe('OS model', function () { it('should be rejected if the application name does not exist', function () { const promise = balena.models.os.getConfig('foobarbaz', { version: DEFAULT_OS_VERSION, + provisioningKeyName: `${TEST_KEY_NAME_PREFIX}-download-config-application-name-not-exists`, }); return expect(promise).to.be.rejectedWith( 'Application not found: foobarbaz',