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

Make pastDateExpression test more stable #836

Merged
merged 1 commit into from
May 16, 2023

Conversation

snuyanzin
Copy link
Collaborator

No description provided.

@kingthorin
Copy link
Collaborator

Is this a timezone issue?

@snuyanzin
Copy link
Collaborator Author

i suspect kind of NTP...
there are 3 times when new Date() is called via datafaker's api and then a check that second is between first and last...

@bodiam
Copy link
Contributor

bodiam commented May 15, 2023

You triggered a new build?

Seems the code isn't completely repeatable:

  ["name.nameWithMiddle"="Gavin Durgan Bauch Jr."]
but the following map entries had different values:
  ["name.nameWithMiddle"="Gavin Durgan Bauch and Sons" (expected: "Gavin Durgan Bauch Jr.")]

@snuyanzin
Copy link
Collaborator Author

yes, somehow it appeared today not only for this PR

@bodiam
Copy link
Contributor

bodiam commented May 15, 2023

Well, at least it's nice that it's consistently failing...

@bodiam
Copy link
Contributor

bodiam commented May 15, 2023

I just tried it locally, with Java 20 on a Mac, and it seems to work fine.

@bodiam
Copy link
Contributor

bodiam commented May 15, 2023

Correction: I can reproduce this quite often.

This never fails though:

    @RepeatedTest(10000)
    void name() {
        Faker faker1 = new Faker(new Random(0));
        Faker faker2 = new Faker(new Random(0));

        assertThat(faker1.name().nameWithMiddle()).isEqualTo(faker2.name().nameWithMiddle());
    }

But having a RepeatedTest(100) on the shouldCreateRepeatableValues makes it fail (in)consistently: around 30-60% of the tests fail.

Could it somehow be a caching or concurrency issue?

@snuyanzin
Copy link
Collaborator Author

looks like the issue is with concurrent tests
#837 should improve it

@bodiam
Copy link
Contributor

bodiam commented May 15, 2023

I just went through the git history, and git d9c2cc262d29deb3552c9f49ab71edf0b3f6dc30 caused it. Before this, the tests worked fine, but after this one, the test started breaking (ironically called: "Make FakeValuesService thread safe")

@snuyanzin snuyanzin merged commit 9cd1d73 into datafaker-net:main May 16, 2023
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.

3 participants