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

Removed hard dependencies on doctrine odm to run the tests #2703

Merged
merged 7 commits into from
May 3, 2019

Conversation

Toflar
Copy link
Contributor

@Toflar Toflar commented Apr 6, 2019

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #2484
License MIT
Doc PR

@Toflar Toflar force-pushed the optional-mongodb-tests branch 2 times, most recently from dd6c1d1 to b40effc Compare April 7, 2019 08:57
Copy link
Member

@soyuka soyuka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it! Many thanks for this @Toflar it wasn't an easy task haha!

WDYT @api-platform/core-team ? IMO it'd be good to have this especially that new contributors won't have to install mongodb to run the tests!

@Toflar Toflar changed the title [WIP] Removed hard dependencies on doctrine odm to run the tests Removed hard dependencies on doctrine odm to run the tests Apr 8, 2019
@Toflar
Copy link
Contributor Author

Toflar commented Apr 8, 2019

Finally 😄 Cleaned up, rebased and squashed. The code coverage drop is because mongodb is now its own phpunit config. But I don't understand why we're testing on both, travis and circleci anyway? 😄

Copy link
Contributor

@teohhanhui teohhanhui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor stuff but otherwise great work! 🎉

.circleci/config.yml Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
/**
* @group mongodb
*/
public function testLoadDefaultConfigWithOdm()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public function testLoadDefaultConfigWithOdm()
public function testLoadDefaultConfigWithMongoDbOdm()

Because there are other ones.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -13,7 +13,7 @@
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak_vendors" />
<server name="KERNEL_DIR" value="tests/Fixtures/app/" />
<server name="KERNEL_CLASS" value="AppKernel" />
<server name="APP_ENV" value="test_mongodb" />
<server name="APP_ENV" value="mongodb" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, tests are green so you tell me 😄

Copy link
Contributor

@teohhanhui teohhanhui Apr 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Toflar But the config wouldn't get applied correctly. So the APP_ENV should be reverted to test_mongodb. 😄

Copy link
Contributor

@teohhanhui teohhanhui Apr 9, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or better, rename the config files, since we do the same for elasticsearch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Toflar I think we should rename the config files instead, for consistency.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alanpoulain Can you advise why there is config_common.yml (imported from config_orm.yml and config_services_mongodb.yml), config_orm.yml (imported from config_test.yml) and config_mongodb.yml (I don't see where this is imported uhh, there is already a mongodb environment previously)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note https://github.com/api-platform/core/blob/v2.4.2/tests/Fixtures/app/AppKernel.php#L97

It's very confusing if we name config files the same way when it's not environment-specific.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay @Toflar, so my suggestion is that we should merge mongodb and test_mongodb environments into one mongodb environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's what I was trying 😄 So I revert the latest commit again?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes... But we need to make sure the relevant parts of the old test_mongodb environment are merged in, e.g.:

tests/Fixtures/app/config/config_test_mongodb.yml
tests/Fixtures/app/config/config_services_mongodb.yml
tests/Fixtures/app/config/routing_test_mongodb.yml

And the old files removed.

Co-Authored-By: Toflar <yanick.witschi@terminal42.ch>
@Toflar
Copy link
Contributor Author

Toflar commented Apr 30, 2019

There we go. Ping @teohhanhui :) The code coverage drop is related to the fact that the mongodb testsuite is now separated so...

@alanpoulain
Copy link
Member

I don't understand why you asked this modification @teohhanhui.
The test configuration was separated from the environment configuration mongodb because the PHPUnit tests don't need the same configuration as the Behat tests.
That's what is done today for the ORM part.

@teohhanhui
Copy link
Contributor

teohhanhui commented Apr 30, 2019

The test configuration was separated from the environment configuration mongodb because the PHPUnit tests don't need the same configuration as the Behat tests.

Yes, I understand, but we don't need two environments when one is enough. If one environment can be reused for both, it simplifies things.

That's what is done today for the ORM part.

It's just one test environment for both phpunit and behat.

@soyuka
Copy link
Member

soyuka commented May 3, 2019

lmao what's the status on these discussion guys? I'd like to merge this asap because it's really good for DX.

@Toflar
Copy link
Contributor Author

Toflar commented May 3, 2019

Imho it's ready, I don't know what Teoh and Alan want me to change. We can also get this sorted on Slack maybe?

@alanpoulain
Copy link
Member

I understand the POV of @teohhanhui but we need to be uniform then. Why having a config_orm.yml?
And I think the coverage should not drop. We need to launch the MongoDB tests in CircleCI and merge its coverage with the others.

@teohhanhui
Copy link
Contributor

but we need to be uniform then. Why having a config_orm.yml?

Oh, that's a separate issue about the config file naming. I don't think we care about that in this PR. The main thing I asked for is one environment for mongodb, and as far as I could tell, that's already done.

We need to launch the MongoDB tests in CircleCI and merge its coverage with the others.

I can take care of that in another PR. We need to do the same for elasticsearch, right?

@teohhanhui teohhanhui merged commit 09e8006 into api-platform:2.4 May 3, 2019
@teohhanhui
Copy link
Contributor

Thanks @Toflar! 🎉 🚀

@Toflar Toflar deleted the optional-mongodb-tests branch May 3, 2019 13:39
@soyuka
Copy link
Member

soyuka commented May 5, 2019

❤️ 🚀

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

Successfully merging this pull request may close these issues.

None yet

5 participants