-
Notifications
You must be signed in to change notification settings - Fork 674
tests: fix flaky test caused by rapid IO reading and writing #2221
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
Open
WilliamBergamin
wants to merge
19
commits into
main
Choose a base branch
from
fix-flaky-file-state-store-2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
a299d6c
tests: attempt to fix flaky behavior in file state store
WilliamBergamin 5c88b25
tests: fix flaky tests caused by rapid file reading and writing
WilliamBergamin 1142d77
fix linting issue
WilliamBergamin eff35a1
trigger tests
WilliamBergamin cd34e8a
trigger tests
WilliamBergamin 2961e5f
try something else
WilliamBergamin 3a90249
fix lint
WilliamBergamin 88518c2
comment out unit test
WilliamBergamin 51ee243
comment some suff
WilliamBergamin 02c4a73
Update file-state-store.spec.ts
WilliamBergamin 9174abb
Update spec-utils.ts
WilliamBergamin 8a1df44
tighten up the PR
WilliamBergamin 937529a
Merge branch 'main' into fix-flaky-file-state-store-2
WilliamBergamin ffb250f
Update packages/oauth/src/state-stores/spec-utils.ts
WilliamBergamin b562ce0
Update packages/oauth/src/state-stores/spec-utils.ts
WilliamBergamin d446a61
Merge branch 'main' into fix-flaky-file-state-store-2
WilliamBergamin 0d83a32
Merge branch 'main' into fix-flaky-file-state-store-2
WilliamBergamin c678ba1
Merge branch 'main' into fix-flaky-file-state-store-2
WilliamBergamin 1826212
Update packages/oauth/src/state-stores/spec-utils.ts
WilliamBergamin 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,11 +53,18 @@ export class StateStoreChaiTestRunner { | |
it('should detect multiple consumption', async () => { | ||
const { stateStore } = this; | ||
const installUrlOptions = { scopes: ['channels:read'] }; | ||
for (let i = 0; i < 200; i++) { | ||
for (let i = 0; i < 100; i++) { | ||
// generate other states | ||
await stateStore.generateStateParam(installUrlOptions, new Date()); | ||
const date = new Date(); | ||
await stateStore.generateStateParam(installUrlOptions, date); | ||
console.log('\tgenerateStateParam:', i, 100, date); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question: Is this |
||
} | ||
const state = await stateStore.generateStateParam(installUrlOptions, new Date()); | ||
|
||
// NOTE: wait 0.5 second to ensure IO operations completed | ||
await new Promise((resolve, _) => setTimeout(resolve, 500)); | ||
WilliamBergamin marked this conversation as resolved.
Show resolved
Hide resolved
WilliamBergamin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
console.log('\tsetTimeout: complete'); | ||
|
||
const result = await stateStore.verifyStateParam(new Date(), state); | ||
assert.exists(result); | ||
let expectedlyReturnedResult: InstallURLOptions = { scopes: [] }; | ||
|
@@ -68,7 +75,7 @@ export class StateStoreChaiTestRunner { | |
} catch (e: any) { | ||
assert.equal(e.code, 'slack_oauth_invalid_state', `${state} ${JSON.stringify(expectedlyReturnedResult)}`); | ||
} | ||
}).timeout(4000); // https://github.com/slackapi/node-slack-sdk/issues/2159#issuecomment-2749367820 | ||
}).timeout(5000); // https://github.com/slackapi/node-slack-sdk/issues/2159#issuecomment-2749367820 | ||
} | ||
}); | ||
} | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is reducing the limit by
100
an arbitrary choice for testing or is there a reason behind it?