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

Fix flaky tests #131

Merged
merged 2 commits into from
Sep 20, 2024
Merged

Fix flaky tests #131

merged 2 commits into from
Sep 20, 2024

Conversation

hirasso
Copy link
Member

@hirasso hirasso commented Sep 18, 2024

Description

Something is wrong with the CI:

  • It failed when I merged the latest dependabot PR
  • after I pulled the current master to my local machine, I sometimes got an error for the test allows for custom queue size

I'm creating this PR just to test what's wrong.

Checks

  • The PR is submitted to the master branch

Copy link

github-actions bot commented Sep 18, 2024

Playwright test results

passed  88 passed
skipped  4 skipped

Details

stats  92 tests across 8 suites
duration  
commit  5c38bd7

Skipped tests

chromium → preload-plugin.spec.ts → active links → preloads links on touchstart
firefox → preload-plugin.spec.ts → active links → preloads links on touchstart
webkit → preload-plugin.spec.ts → active links → preloads links on touchstart
ios → preload-plugin.spec.ts → active links → preloads links on hover

@hirasso
Copy link
Member Author

hirasso commented Sep 18, 2024

...seems to be working alright... @daun, I can't make sense of the test that was failing:

it('allows custom queue size', async () => {
let size = 5;
let items = 5;
let duration = 100;
let elapsed = 0;
const { add, next } = createQueue(size);
const timer = createTimer();
const test = () => sleep(duration).then(() => (elapsed = timer())).then(next);
for (let i = 0; i < items; i++) {
add(() => test()); // add different function with each iteration = sequential
}
await sleep((items + 1) * duration);
const [min, max] = pad(items * duration / size);
expect(elapsed).to.be.gte(min);
expect(elapsed).to.be.lte(max);
});
});

Would you like to explain what exactly it is testing? Alternatively, some code comments could help our future selfs.

@daun
Copy link
Member

daun commented Sep 18, 2024

What‘s the error you‘re getting locally?

The particular test tries to confirm that the priority queue can have a custom length (i.e. preload max 5 links at once).

@hirasso
Copy link
Member Author

hirasso commented Sep 19, 2024

CleanShot 2024-09-19 at 08 49 05@2x

Yesterday, elapsed also was was 104 instead of 106, once

@daun
Copy link
Member

daun commented Sep 19, 2024

Alright, so we‘ll need to add some slack around the number checks I guess?

@hirasso
Copy link
Member Author

hirasso commented Sep 19, 2024

Yes! I think increasing the padding in pad could help. As I don't understand exactly how this is supposed to work, I'd be grateful if you would take care of it.

@hirasso hirasso closed this Sep 19, 2024
@hirasso hirasso reopened this Sep 20, 2024
@daun daun changed the title Test CI Fix flaky tests Sep 20, 2024
@daun
Copy link
Member

daun commented Sep 20, 2024

Looking good now :)

@daun daun merged commit 56ad6d1 into master Sep 20, 2024
2 checks passed
@hirasso
Copy link
Member Author

hirasso commented Sep 20, 2024

👌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants