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

ci: Find duplicate and slow tests #9188

Merged
merged 23 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
dd37911
test: Find duplicate specs and analyze slow tests
dplewis Jul 8, 2024
311b20c
Merge branch 'alpha' into display-slow-tests
dplewis Jul 9, 2024
a77d341
remove timeout
dplewis Jul 9, 2024
f471e95
output duplicates
dplewis Jul 9, 2024
e6e6841
more duplicate tests
dplewis Jul 9, 2024
72312ca
Merge branch 'alpha' into display-slow-tests
dplewis Jul 9, 2024
80b3529
Merge branch 'alpha' into display-slow-tests
mtrezza Jul 9, 2024
4a1f227
Update spec/support/CurrentSpecReporter.js
mtrezza Jul 9, 2024
220b6a5
Update spec/support/CurrentSpecReporter.js
mtrezza Jul 9, 2024
af66be7
Update spec/support/CurrentSpecReporter.js
mtrezza Jul 9, 2024
702608f
Update spec/support/CurrentSpecReporter.js
mtrezza Jul 9, 2024
be72594
Update spec/support/CurrentSpecReporter.js
mtrezza Jul 9, 2024
a93cb3e
Update CurrentSpecReporter.js
mtrezza Jul 9, 2024
d7f1a29
Merge branch 'alpha' into display-slow-tests
mtrezza Jul 9, 2024
291c8cb
Update CurrentSpecReporter.js
mtrezza Jul 9, 2024
6cc001e
Merge branch 'alpha' into display-slow-tests
mtrezza Jul 9, 2024
c13517e
Merge branch 'alpha' into display-slow-tests
mtrezza Jul 9, 2024
6504b26
remove duplicate tests
dplewis Jul 9, 2024
4cbf09f
remove more duplicate tests
dplewis Jul 9, 2024
2a3ddbe
reduce execution time to 1 second
dplewis Jul 9, 2024
6ab4d85
change back 2 seconds limit was curious about 1 second
dplewis Jul 9, 2024
04c95e5
revert DB specific tests
dplewis Jul 9, 2024
756d110
Merge branch 'alpha' into display-slow-tests
mtrezza Jul 16, 2024
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
3 changes: 1 addition & 2 deletions .nvmrc
mtrezza marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
10.14.2

20.15.0
29 changes: 0 additions & 29 deletions spec/Auth.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,35 +141,6 @@ describe('Auth', () => {
expect(userAuth.user.id).toBe(user.id);
});

it('should load auth without a config', async () => {
const user = new Parse.User();
await user.signUp({
username: 'hello',
password: 'password',
});
expect(user.getSessionToken()).not.toBeUndefined();
const userAuth = await getAuthForSessionToken({
sessionToken: user.getSessionToken(),
});
expect(userAuth.user instanceof Parse.User).toBe(true);
expect(userAuth.user.id).toBe(user.id);
});

it('should load auth with a config', async () => {
const user = new Parse.User();
await user.signUp({
username: 'hello',
password: 'password',
});
expect(user.getSessionToken()).not.toBeUndefined();
const userAuth = await getAuthForSessionToken({
sessionToken: user.getSessionToken(),
config: Config.get('test'),
});
expect(userAuth.user instanceof Parse.User).toBe(true);
expect(userAuth.user.id).toBe(user.id);
});

describe('getRolesForUser', () => {
const rolesNumber = 100;

Expand Down
27 changes: 2 additions & 25 deletions spec/AuthenticationAdapters.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,29 +469,6 @@ describe('AuthenticationProviders', function () {
expect(providerOptions).toEqual(options.facebook);
});

it('should throw error when Facebook request appId is wrong data type', async () => {
const httpsRequest = require('../lib/Adapters/Auth/httpsRequest');
spyOn(httpsRequest, 'get').and.callFake(() => {
return Promise.resolve({ id: 'a' });
});
const options = {
facebook: {
appIds: 'abcd',
appSecret: 'secret_sauce',
},
};
const authData = {
access_token: 'badtoken',
};
const { adapter, appIds, providerOptions } = authenticationLoader.loadAuthAdapter(
'facebook',
options
);
await expectAsync(adapter.validateAppId(appIds, authData, providerOptions)).toBeRejectedWith(
new Parse.Error(Parse.Error.OBJECT_NOT_FOUND, 'appIds must be an array.')
);
});

it('should handle Facebook appSecret for validating appIds', async () => {
const httpsRequest = require('../lib/Adapters/Auth/httpsRequest');
spyOn(httpsRequest, 'get').and.callFake(() => {
Expand Down Expand Up @@ -1652,7 +1629,7 @@ describe('apple signin auth adapter', () => {
}
});

it('(using client id as string) should throw error with with invalid jwt issuer', async () => {
it('(using client id as string) should throw error with with invalid jwt issuer with token', async () => {
const fakeClaim = {
iss: 'https://not.apple.com',
sub: 'the_user_id',
Expand Down Expand Up @@ -2208,7 +2185,7 @@ describe('facebook limited auth adapter', () => {
}
});

it('(using client id as string) should throw error with with invalid jwt issuer', async () => {
it('(using client id as string) with token', async () => {
const fakeClaim = {
iss: 'https://not.facebook.com',
sub: 'the_user_id',
Expand Down
10 changes: 0 additions & 10 deletions spec/AuthenticationAdaptersV2.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,16 +369,6 @@ describe('Auth Adapter features', () => {
expect(spy).toHaveBeenCalled();
});

it('should throw if no triggers found', async () => {
await reconfigureServer({ auth: { wrongAdapter } });
const user = new Parse.User();
await expectAsync(
user.save({ authData: { wrongAdapter: { id: 'wrongAdapter' } } })
).toBeRejectedWithError(
'Adapter is not configured. Implement either validateAuthData or all of the following: validateSetUp, validateLogin and validateUpdate'
);
});

it('should throw if policy does not match one of default/solo/additional', async () => {
const adapterWithBadPolicy = {
validateAppId: () => Promise.resolve(),
Expand Down
23 changes: 1 addition & 22 deletions spec/CloudCode.Validator.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,27 +194,6 @@ describe('cloud validator', () => {
});
});

it('set params on cloud functions', done => {
Parse.Cloud.define(
'hello',
() => {
return 'Hello world!';
},
{
fields: ['a'],
}
);
Parse.Cloud.run('hello', {})
.then(() => {
fail('function should have failed.');
})
.catch(error => {
expect(error.code).toEqual(Parse.Error.VALIDATION_ERROR);
expect(error.message).toEqual('Validation failed. Please specify data for a.');
done();
});
});

it('allow params on cloud functions', done => {
Parse.Cloud.define(
'hello',
Expand Down Expand Up @@ -1629,7 +1608,7 @@ describe('cloud validator', () => {
}
});

it('Logs on invalid config', () => {
it('Logs on multiple invalid configs', () => {
const fields = [
{
field: 'otherKey',
Expand Down
1 change: 1 addition & 0 deletions spec/CloudCode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('Cloud Code', () => {
});

it('cloud code must be valid type', async () => {
spyOn(console, 'error').and.callFake(() => {});
await expectAsync(reconfigureServer({ cloud: true })).toBeRejectedWith(
"argument 'cloud' must either be a string or a function"
);
Expand Down
4 changes: 2 additions & 2 deletions spec/InstallationsRouter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('InstallationsRouter', () => {
});
});

it_exclude_dbs(['postgres'])('query installations with count = 1', done => {
it_exclude_dbs(['postgres'])('query installations with count = 1 (Mongo)', done => {
const config = Config.get('test');
const androidDeviceRequest = {
installationId: '12345678-abcd-abcd-abcd-123456789abc',
Expand Down Expand Up @@ -166,7 +166,7 @@ describe('InstallationsRouter', () => {
});
});

it_only_db('postgres')('query installations with count = 1', async () => {
it_only_db('postgres')('query installations with count = 1 (Postgres)', async () => {
const config = Config.get('test');
const androidDeviceRequest = {
installationId: '12345678-abcd-abcd-abcd-123456789abc',
Expand Down
4 changes: 2 additions & 2 deletions spec/MongoStorageAdapter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
await expectAsync(adapter.getClass('UnknownClass')).toBeRejectedWith(undefined);
});

it_only_mongodb_version('<5.1>=6')('should use index for caseInsensitive query', async () => {
it_only_mongodb_version('<5.1>=6')('should use index for caseInsensitive query (Mongo <5.1>=6)', async () => {
const user = new Parse.User();
user.set('username', 'Bugs');
user.set('password', 'Bunny');
Expand Down Expand Up @@ -424,7 +424,7 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
expect(postIndexPlan.executionStats.executionStages.stage).toBe('FETCH');
});

it_only_mongodb_version('>=5.1<6')('should use index for caseInsensitive query', async () => {
it_only_mongodb_version('>=5.1<6')('should use index for caseInsensitive query (Mongo >=5.1<6)', async () => {
const user = new Parse.User();
user.set('username', 'Bugs');
user.set('password', 'Bunny');
Expand Down
48 changes: 0 additions & 48 deletions spec/ParseFile.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -789,59 +789,11 @@ describe('Parse.File testing', () => {
headers: {
'Content-Type': 'application/octet-stream',
'X-Parse-Application-Id': 'test',
Range: 'bytes=abc-efs',
},
}).catch(e => e);
expect(file.headers['content-range']).toBeUndefined();
});

it('supports bytes range if start and end undefined', async () => {
const headers = {
'Content-Type': 'application/octet-stream',
'X-Parse-Application-Id': 'test',
'X-Parse-REST-API-Key': 'rest',
};
const response = await request({
method: 'POST',
headers: headers,
url: 'http://localhost:8378/1//files/file.txt ',
body: repeat('argle bargle', 100),
});
const b = response.data;
const file = await request({
url: b.url,
headers: {
'Content-Type': 'application/octet-stream',
'X-Parse-Application-Id': 'test',
},
}).catch(e => e);
expect(file.headers['content-range']).toBeUndefined();
});

it('supports bytes range if end is greater than size', async () => {
const headers = {
'Content-Type': 'application/octet-stream',
'X-Parse-Application-Id': 'test',
'X-Parse-REST-API-Key': 'rest',
};
const response = await request({
method: 'POST',
headers: headers,
url: 'http://localhost:8378/1//files/file.txt ',
body: repeat('argle bargle', 100),
});
const b = response.data;
const file = await request({
url: b.url,
headers: {
'Content-Type': 'application/octet-stream',
'X-Parse-Application-Id': 'test',
Range: 'bytes=0-2000',
},
}).catch(e => e);
expect(file.headers['content-range']).toBe('bytes 0-1212/1212');
});

it('supports bytes range if end is greater than size', async () => {
const headers = {
'Content-Type': 'application/octet-stream',
Expand Down
1 change: 0 additions & 1 deletion spec/ParseLiveQuery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,6 @@ describe('ParseLiveQuery', function () {
await obj2.save();
obj2.set('foo', 'bart');
await obj2.save();
await sleep(2000);
expect(createSpy).toHaveBeenCalledTimes(1);
expect(updateSpy).toHaveBeenCalledTimes(1);
});
Expand Down
29 changes: 0 additions & 29 deletions spec/ParseLiveQueryServer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1633,35 +1633,6 @@ describe('ParseLiveQueryServer', function () {
});
});

it('matches CLP when find is restricted to userIds', done => {
const parseLiveQueryServer = new ParseLiveQueryServer({});
const acl = new Parse.ACL();
acl.setReadAccess(testUserId, true);
// Mock sessionTokenCache will return false when sessionToken is undefined
const client = {
sessionToken: 'sessionToken',
getSubscriptionInfo: jasmine.createSpy('getSubscriptionInfo').and.returnValue({
sessionToken: 'userId',
}),
};
const requestId = 0;

parseLiveQueryServer
._matchesCLP(
{
find: { userId: true },
},
{ className: 'Yolo' },
client,
requestId,
'find'
)
.then(isMatched => {
expect(isMatched).toBe(true);
done();
});
});

it('matches CLP when find is restricted to userIds', done => {
const parseLiveQueryServer = new ParseLiveQueryServer({});
const acl = new Parse.ACL();
Expand Down
4 changes: 2 additions & 2 deletions spec/ParseQuery.Aggregate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ describe('Parse.Query Aggregate testing', () => {
});

it_exclude_dbs(['postgres'])(
'can group by any date field (it does not work if you have dirty data)', // rows in your collection with non date data in the field that is supposed to be a date
'can group by any date field (it does not work if you have dirty data) (Mongo)', // rows in your collection with non date data in the field that is supposed to be a date
done => {
const obj1 = new TestObject({ dateField2019: new Date(1990, 11, 1) });
const obj2 = new TestObject({ dateField2019: new Date(1990, 5, 1) });
Expand Down Expand Up @@ -440,7 +440,7 @@ describe('Parse.Query Aggregate testing', () => {
);

it_only_db('postgres')(
'can group by any date field (it does not work if you have dirty data)', // rows in your collection with non date data in the field that is supposed to be a date
'can group by any date field (it does not work if you have dirty data) (Postgres)', // rows in your collection with non date data in the field that is supposed to be a date
done => {
const obj1 = new TestObject({ dateField2019: new Date(1990, 11, 1) });
const obj2 = new TestObject({ dateField2019: new Date(1990, 5, 1) });
Expand Down
Loading
Loading