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

createMany and createOne or new->create does not work well together on the CI #482

Open
benblub opened this issue Jul 21, 2023 · 3 comments

Comments

@benblub
Copy link
Contributor

benblub commented Jul 21, 2023

        EmbeddedContentFactory::createMany(5);
        EmbeddedContentFactory::createMany(3, ['type' => EmbeddedContentType::CantonNavigation]);
        EmbeddedContentFactory::createOne(['title' => 'Exact title', 'type' => EmbeddedContentType::Fixture]);

        $this->assertCount(9, EmbeddedContentFactory::repository()->findAll(), 'Expected 9 embedded contents');

This is failing in CI/Github actions = Failed asserting that actual size 8 matches expected size 9.

What is working

        EmbeddedContentFactory::createMany(
            6,
            static function (int $i) {
                if ($i === 1) {
                    return ['title' => 'Exact title', 'type' => EmbeddedContentType::Fixture];
                }

                return ['title' => "Title $i"];
            }
        );
        EmbeddedContentFactory::createMany(3, ['type' => EmbeddedContentType::CantonNavigation]);

        $this->assertCount(9, EmbeddedContentFactory::repository()->findAll(), 'Expected 9 embedded contents');

I trying to understand what the problem can be but since its working local its hard to debug. Did someone know or can lead me the right direction? Not sure this is a bug ..

Additional: DAMA is used, the code is failing early without other code involved.

@benblub
Copy link
Contributor Author

benblub commented Jul 21, 2023

fun fact

If I switch the order there is no error raised

        EmbeddedContentFactory::createOne(['title' => 'Exact title', 'type' => EmbeddedContentType::Fixture]);
        EmbeddedContentFactory::createMany(5);
        EmbeddedContentFactory::createMany(3, ['type' => EmbeddedContentType::CantonNavigation]);

        $this->assertCount(9, EmbeddedContentFactory::repository()->findAll(), 'Expected 9 embedded contents');

@nikophil
Copy link
Member

Hi @benblub

sorry I have no clue why this is happening. I bet this is not related to Foundry, but not really sure. The "fun fact" is really weird 🤯

Maybe if you can create a public reproducer I could give a hand.

I recently heard about https://github.com/mxschmitt/action-tmate which can help to debug your actions by ssh-ing on the runners, maybe this could help!

@benblub
Copy link
Contributor Author

benblub commented Jul 27, 2023

ok will take a look by time, thx

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

No branches or pull requests

2 participants