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

test parallel device registration #1196

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ matrix:
# what combinations to test
environment:
matrix:
- nodejs_version: 12
- nodejs_version: 16
TEST_EMAIL: [email protected]
TEST_PASSWORD:
secure: NVtsC140RoZJmrCHqyKc2A==
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/api-key.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import { assertDeepMatchAndLength, timeSuite } from '../../util';
import type * as BalenaSdk from '../../..';

describe('API Key model', function () {
describe.skip('API Key model', function () {
timeSuite(before);

describe('balena.models.apiKey.create()', function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/application-membership.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const keyAlternatives = [
],
] as const;

describe('Application Membership Model', function () {
describe.skip('Application Membership Model', function () {
timeSuite(before);
givenLoggedInUser(before);
givenAnApplication(before);
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
itShouldGetAllTagsByResource,
} from './tags';

describe('Application Model', function () {
describe.skip('Application Model', function () {
timeSuite(before);
givenLoggedInUser(before);
givenInitialOrganization(before);
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/applicationInvite.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const TEST_MESSAGE = 'Hey!, Join my app on balenaCloud';
const TEST_ROLE = 'developer';
const UNKNOWN_ROLE = 'undefined_role';

describe('Application Invite Model', function () {
describe.skip('Application Invite Model', function () {
timeSuite(before);
describe('When user is logged out', function () {
before(() => balena.auth.logout());
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/billing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { timeSuite } from '../../util';
import type * as BalenaSdk from '../../..';

describe('Billing Model', function () {
describe.skip('Billing Model', function () {
timeSuite(before);
describe('Free Account', function () {
givenLoggedInUser(before);
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const itNormalizesDeviceTypes = function () {
});
};

describe('Config Model', function () {
describe.skip('Config Model', function () {
timeSuite(before);
before(function () {
return balena.auth.logout();
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/device-type.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const DEVICE_TYPE_SLUG = 'raspberry-pi2';
const DEVICE_TYPE_ALIAS = 'raspberrypi2';
const DEVICE_TYPE_ID = 1;

describe('Device Type model', function () {
describe.skip('Device Type model', function () {
timeSuite(before);
givenLoggedInUser(before);

Expand Down
34 changes: 15 additions & 19 deletions tests/integration/models/device.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ describe('Device Model', function () {
givenLoggedInUser(before);
givenInitialOrganization(before);

if (IS_BROWSER) {
return;
}

describe('given no applications', function () {
parallel('balena.models.device.getManifestBySlug()', function () {
it('should become the manifest if the slug is valid', async () => {
Expand Down Expand Up @@ -2620,27 +2624,19 @@ describe('Device Model', function () {
});
});

const BATCH_DEVICE_COUNT = 55;
const BATCH_DEVICE_COUNT = 105;
describe(`given ${BATCH_DEVICE_COUNT} registered offline device`, function () {
before(async function () {
this.devices = [];
const REGISTRATION_CHUNK_SIZE = 10;
for (let i = 0; i < BATCH_DEVICE_COUNT; i += REGISTRATION_CHUNK_SIZE) {
this.devices.push(
...(await Promise.all(
_.times(
Math.min(BATCH_DEVICE_COUNT - i, REGISTRATION_CHUNK_SIZE),
).map(async () => {
const uuid = balena.models.device.generateUniqueKey();
const deviceInfo = await balena.models.device.register(
this.application.id,
uuid,
);
return deviceInfo;
}),
)),
);
}
this.devices = await Promise.all(
_.times(BATCH_DEVICE_COUNT).map(async () => {
const uuid = balena.models.device.generateUniqueKey();
const deviceInfo = await balena.models.device.register(
this.application.id,
uuid,
);
return deviceInfo;
}),
);
});

describe('balena.models.device.pinToRelease()', function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/image.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '../setup';
import { timeSuite } from '../../util';

describe('Image Model', function () {
describe.skip('Image Model', function () {
timeSuite(before);
givenLoggedInUser(before);

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/keys.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { balena, givenLoggedInUser } from '../setup';
import { timeSuite } from '../../util';
import type * as BalenaSdk from '../../..';

describe('Key Model', function () {
describe.skip('Key Model', function () {
timeSuite(before);
describe('given no keys', function () {
describe('balena.models.key.getAll()', function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/organization-membership.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const keyAlternatives = [
],
] as const;

describe('Organization Membership Model', function () {
describe.skip('Organization Membership Model', function () {
timeSuite(before);
givenLoggedInUser(before);
givenInitialOrganization(before);
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/organization.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as parallel from 'mocha.parallel';
import { balena, credentials, givenLoggedInUser } from '../setup';
import { timeSuite } from '../../util';

describe('Organization model', function () {
describe.skip('Organization model', function () {
timeSuite(before);
givenLoggedInUser(before);

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/organizationInvite.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const resetOrganizationInvites = async (orgId: number) => {
});
};

describe('Organization Invite Model', function () {
describe.skip('Organization Invite Model', function () {
timeSuite(before);
describe('When user is logged out', function () {
before(() => balena.auth.logout());
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/os.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const describeCacheInvalidationChanges = function (
});
};

describe('OS model', function () {
describe.skip('OS model', function () {
timeSuite(before);
before(function () {
return balena.auth.logout();
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/release.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {

const releaseRetrievalFields = ['id', 'commit'];

describe('Release Model', function () {
describe.skip('Release Model', function () {
timeSuite(before);
givenLoggedInUser(before);

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/models/service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '../setup';
import { timeSuite } from '../../util';

describe('Service Model', function () {
describe.skip('Service Model', function () {
timeSuite(before);
givenLoggedInUser(before);

Expand Down