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 seeding and repeat #134

Closed
wants to merge 6 commits into from
Closed

Conversation

IonBazan
Copy link

@IonBazan IonBazan commented Dec 11, 2020

What is the reason for this PR?

This PR tries to rerun the tests without seeding to detect ones that are not generating valid results.

Thanks to this approach, I found following issues:

  • regexify does not handle [.] properly (see Regexify dot issue #133)

  • old and new optional() behavior does not always match

  • PersonTest for mn_MN locale can fail on different regex collations ([А-Я] will not match letter Ё on C collation)

  • BiasedTest is failing with random seed - needs fixing?

  • An improvement to CI (fixes Test randomness #125)

Author's checklist

Summary of changes

There is additional test matrix entry that executes each test 100 times, excluding tests tagged seed and external (downloading external resource) to ensure they work properly with different seeds.

setUp() method in base TestCase class checks if current test is in seed group and seeds random number generator with 1 if needed.

verbose mode was disabled by default to limit "skipped tests" output spam in the --repeat 100 job.

Review checklist

  • All checks have passed
  • Changes are approved by maintainer

@IonBazan IonBazan force-pushed the test-repeat branch 2 times, most recently from 3b2b0e3 to 1f1bdd8 Compare December 11, 2020 07:48
@pimjansen
Copy link

Can we review last comments?

# Conflicts:
#	.github/workflows/tests.yml
#	phpunit.xml.dist
#	test/Faker/Provider/BaseTest.php
@localheinz
Copy link
Member

@IonBazan

The tests are currently failing, can you take another 👀 , please?

I think that it is a good idea to expose failures in the generators by repeatedly running the tests, but perhaps 100 is a bit too much? What do you think?

With this change, we run *221800 instead of 2236 tests on GitHub Actions, and significantly increase the build time.

Perhaps it would make sense to add this as a target to Makefile, so a developer can run this locally (as well or alternatively)?

@localheinz localheinz added the enhancement New feature or request label Dec 21, 2020
@krsriq
Copy link

krsriq commented Dec 21, 2020

@IonBazan apparently there's another regex-dot-related bug. I'll create a PR to fix this shortly.

@krsriq krsriq mentioned this pull request Dec 21, 2020
6 tasks
@krsriq
Copy link

krsriq commented Dec 21, 2020

I think I've fixed this now (was not quite as easy as I had hoped), so once #206 is merged we should be green here.

@IonBazan
Copy link
Author

Thanks @krsriq - seems that it's working fine now!

@localheinz how about we add another pipeline to run these 100x tests on push only (after merge to main branch) instead? This will reduce number of jobs run for PRs, still providing enough confidence to merge PRs with passing builds. If anything goes wrong, we should be still able to catch that once in a while after merges. I will add the task to Makefile to make it easier for developers to test some random-related features.

We will still need to stabilize BiasedTest behavior - does anyone have any experience with this feature?

@IonBazan IonBazan mentioned this pull request Jan 4, 2021
4 tasks
@stale
Copy link

stale bot commented Jan 5, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 1 week if no further activity occurs. Thank you for your contributions.

@bram-pkg
Copy link
Member

Any updates on this, @IonBazan ?

@IonBazan
Copy link
Author

IonBazan commented Jun 1, 2021

@bramceulemans sorry- there is not much to update here because it's just a POC and I believe it's up to the maintainers to decide whether they want to run these checks. I just resolved the conflicts so it's ready to merge if needed.

@bram-pkg
Copy link
Member

bram-pkg commented Jan 2, 2022

@GrahamCampbell @pimjansen

Opinion on this?

@pimjansen
Copy link

I think its a fine addition but it doesnt directly mean that those implementations are always wrong.

But another important thing is that builds fail until we fix those methods as well.

How do we want to handle that? We can raise issues for those tests and silent the pipeline job or we just fix them directly.

I am a fan of the last one

@bram-pkg
Copy link
Member

bram-pkg commented Dec 5, 2022

Closing this as stale for now.

@bram-pkg bram-pkg closed this Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pinned
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test randomness
5 participants