-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
ci: Add test retry logic for flaky tests #9218
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
2ca702f
feat: Add test retry logic for flaky tests
dplewis dc172d6
update tests with es6 logic
dplewis f221852
bump jasmine to 5.1.0
dplewis ad63776
clean up
dplewis d70b5a0
Revert "bump jasmine to 5.1.0"
dplewis f330c33
lint
dplewis ed48bf1
Merge branch 'alpha' into flaky-retry
mtrezza df7feee
remove idempotency ttl timeout
dplewis 75c2a2c
remove unnecessary files
dplewis 3d4e10c
Merge branch 'alpha' into flaky-retry
dplewis f8db8b6
Update jasmine.json
dplewis 50d89b5
Merge branch 'alpha' into flaky-retry
mtrezza db98a52
add more flaky tests
dplewis 0f12927
improve logging and increase number of retries
dplewis 3e682dc
another test
dplewis dc5579d
show number of times a failed test retried
dplewis 755e5e7
Merge branch 'alpha' into flaky-retry
dplewis 24636dc
add email verification flaky tests
dplewis c2f4694
Merge branch 'alpha' into flaky-retry
mtrezza 4066089
another email verification flaky test
dplewis 9e9b6f4
Remove fixed tests
dplewis 66bf11e
Merge branch 'alpha' into flaky-retry
mtrezza f06874a
Merge branch 'alpha' into flaky-retry
mtrezza 719f80d
Merge branch 'alpha' into flaky-retry
mtrezza e6b6fd1
Update CurrentSpecReporter.js
mtrezza File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,13 @@ const emailAdapter = { | |
const appName = 'test'; | ||
const publicServerURL = 'http://localhost:8378/1'; | ||
|
||
describe('Regex Vulnerabilities', function () { | ||
beforeEach(async function () { | ||
describe('Regex Vulnerabilities', () => { | ||
let objectId; | ||
let sessionToken; | ||
let partialSessionToken; | ||
let user; | ||
|
||
beforeEach(async () => { | ||
await reconfigureServer({ | ||
maintenanceKey: 'test2', | ||
verifyUserEmails: true, | ||
|
@@ -38,13 +43,13 @@ describe('Regex Vulnerabilities', function () { | |
email: '[email protected]', | ||
}), | ||
}); | ||
this.objectId = signUpResponse.data.objectId; | ||
this.sessionToken = signUpResponse.data.sessionToken; | ||
this.partialSessionToken = this.sessionToken.slice(0, 3); | ||
objectId = signUpResponse.data.objectId; | ||
sessionToken = signUpResponse.data.sessionToken; | ||
partialSessionToken = sessionToken.slice(0, 3); | ||
}); | ||
|
||
describe('on session token', function () { | ||
it('should not work with regex', async function () { | ||
describe('on session token', () => { | ||
it('should not work with regex', async () => { | ||
try { | ||
await request({ | ||
url: `${serverURL}/users/me`, | ||
|
@@ -53,7 +58,7 @@ describe('Regex Vulnerabilities', function () { | |
body: JSON.stringify({ | ||
...keys, | ||
_SessionToken: { | ||
$regex: this.partialSessionToken, | ||
$regex: partialSessionToken, | ||
}, | ||
_method: 'GET', | ||
}), | ||
|
@@ -65,43 +70,43 @@ describe('Regex Vulnerabilities', function () { | |
} | ||
}); | ||
|
||
it('should work with plain token', async function () { | ||
it('should work with plain token', async () => { | ||
const meResponse = await request({ | ||
url: `${serverURL}/users/me`, | ||
method: 'POST', | ||
headers, | ||
body: JSON.stringify({ | ||
...keys, | ||
_SessionToken: this.sessionToken, | ||
_SessionToken: sessionToken, | ||
_method: 'GET', | ||
}), | ||
}); | ||
expect(meResponse.data.objectId).toEqual(this.objectId); | ||
expect(meResponse.data.sessionToken).toEqual(this.sessionToken); | ||
expect(meResponse.data.objectId).toEqual(objectId); | ||
expect(meResponse.data.sessionToken).toEqual(sessionToken); | ||
}); | ||
}); | ||
|
||
describe('on verify e-mail', function () { | ||
describe('on verify e-mail', () => { | ||
beforeEach(async function () { | ||
const userQuery = new Parse.Query(Parse.User); | ||
this.user = await userQuery.get(this.objectId, { useMasterKey: true }); | ||
user = await userQuery.get(objectId, { useMasterKey: true }); | ||
}); | ||
|
||
it('should not work with regex', async function () { | ||
expect(this.user.get('emailVerified')).toEqual(false); | ||
it('should not work with regex', async () => { | ||
expect(user.get('emailVerified')).toEqual(false); | ||
await request({ | ||
url: `${serverURL}/apps/test/[email protected]&token[$regex]=`, | ||
method: 'GET', | ||
}); | ||
await this.user.fetch({ useMasterKey: true }); | ||
expect(this.user.get('emailVerified')).toEqual(false); | ||
await user.fetch({ useMasterKey: true }); | ||
expect(user.get('emailVerified')).toEqual(false); | ||
}); | ||
|
||
it('should work with plain token', async function () { | ||
expect(this.user.get('emailVerified')).toEqual(false); | ||
it('should work with plain token', async () => { | ||
expect(user.get('emailVerified')).toEqual(false); | ||
const current = await request({ | ||
method: 'GET', | ||
url: `http://localhost:8378/1/classes/_User/${this.user.id}`, | ||
url: `http://localhost:8378/1/classes/_User/${user.id}`, | ||
json: true, | ||
headers: { | ||
'X-Parse-Application-Id': 'test', | ||
|
@@ -115,18 +120,18 @@ describe('Regex Vulnerabilities', function () { | |
url: `${serverURL}/apps/test/[email protected]&token=${current._email_verify_token}`, | ||
method: 'GET', | ||
}); | ||
await this.user.fetch({ useMasterKey: true }); | ||
expect(this.user.get('emailVerified')).toEqual(true); | ||
await user.fetch({ useMasterKey: true }); | ||
expect(user.get('emailVerified')).toEqual(true); | ||
}); | ||
}); | ||
|
||
describe('on password reset', function () { | ||
beforeEach(async function () { | ||
this.user = await Parse.User.logIn('[email protected]', 'somepassword'); | ||
describe('on password reset', () => { | ||
beforeEach(async () => { | ||
user = await Parse.User.logIn('[email protected]', 'somepassword'); | ||
}); | ||
|
||
it('should not work with regex', async function () { | ||
expect(this.user.id).toEqual(this.objectId); | ||
it('should not work with regex', async () => { | ||
expect(user.id).toEqual(objectId); | ||
await request({ | ||
url: `${serverURL}/requestPasswordReset`, | ||
method: 'POST', | ||
|
@@ -137,7 +142,7 @@ describe('Regex Vulnerabilities', function () { | |
email: '[email protected]', | ||
}), | ||
}); | ||
await this.user.fetch({ useMasterKey: true }); | ||
await user.fetch({ useMasterKey: true }); | ||
const passwordResetResponse = await request({ | ||
url: `${serverURL}/apps/test/[email protected]&token[$regex]=`, | ||
method: 'GET', | ||
|
@@ -162,8 +167,8 @@ describe('Regex Vulnerabilities', function () { | |
} | ||
}); | ||
|
||
it('should work with plain token', async function () { | ||
expect(this.user.id).toEqual(this.objectId); | ||
it('should work with plain token', async () => { | ||
expect(user.id).toEqual(objectId); | ||
await request({ | ||
url: `${serverURL}/requestPasswordReset`, | ||
method: 'POST', | ||
|
@@ -176,7 +181,7 @@ describe('Regex Vulnerabilities', function () { | |
}); | ||
const current = await request({ | ||
method: 'GET', | ||
url: `http://localhost:8378/1/classes/_User/${this.user.id}`, | ||
url: `http://localhost:8378/1/classes/_User/${user.id}`, | ||
json: true, | ||
headers: { | ||
'X-Parse-Application-Id': 'test', | ||
|
@@ -204,7 +209,7 @@ describe('Regex Vulnerabilities', function () { | |
}, | ||
}); | ||
const userAgain = await Parse.User.logIn('[email protected]', 'newpassword'); | ||
expect(userAgain.id).toEqual(this.objectId); | ||
expect(userAgain.id).toEqual(objectId); | ||
}); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
let retry = 0; | ||
const isFlaky = true; | ||
|
||
describe('flaky', () => { | ||
it('example', () => { | ||
if (retry >= 1) { | ||
expect(isFlaky).toBe(true); | ||
return; | ||
} | ||
retry += 1; | ||
expect(isFlaky).toBe(false); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[ | ||
"flaky example", | ||
dplewis marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"ParseLiveQuery handle invalid websocket payload length" | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.