Skip to content

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

Merged
teohhanhui merged 7 commits into
api-platform:2.4from
Toflar:optional-mongodb-tests
May 3, 2019
Merged

Removed hard dependencies on doctrine odm to run the tests#2703
teohhanhui merged 7 commits into
api-platform:2.4from
Toflar:optional-mongodb-tests

Conversation

@Toflar

@Toflar Toflar commented Apr 6, 2019

Copy link
Copy Markdown
Contributor
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

@soyuka soyuka left a comment

Copy link
Copy Markdown
Member

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 force-pushed the optional-mongodb-tests branch from 390bb64 to 64a17c7 Compare April 8, 2019 09:05
@Toflar
Toflar force-pushed the optional-mongodb-tests branch from 64a17c7 to e7f7813 Compare April 8, 2019 09:11
@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

Toflar commented Apr 8, 2019

Copy link
Copy Markdown
Contributor Author

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? 😄

@teohhanhui teohhanhui left a comment

Copy link
Copy Markdown
Contributor

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! 🎉

Comment thread .circleci/config.yml Outdated
Comment thread .circleci/config.yml Outdated
Comment thread .circleci/config.yml Outdated
Comment thread .circleci/config.yml Outdated
Comment thread .travis.yml Outdated
Comment thread .travis.yml Outdated
Comment thread tests/Bridge/Doctrine/MongoDbOdm/CollectionDataProviderTest.php
/**
* @group mongodb
*/
public function testLoadDefaultConfigWithOdm()

Copy link
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread phpunit.mongo.xml
<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
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
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 😄

@teohhanhui teohhanhui Apr 9, 2019

Copy link
Copy Markdown
Contributor

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. 😄

@teohhanhui teohhanhui Apr 9, 2019

Copy link
Copy Markdown
Contributor

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.

@teohhanhui teohhanhui Apr 29, 2019

Copy link
Copy Markdown
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.

@teohhanhui teohhanhui Apr 29, 2019

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread tests/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtensionTest.php Outdated
Comment thread tests/Bridge/Symfony/Bundle/DependencyInjection/ConfigurationTest.php Outdated
Toflar added 2 commits April 9, 2019 10:16
Co-Authored-By: Toflar <yanick.witschi@terminal42.ch>
@Toflar

Toflar commented Apr 30, 2019

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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

teohhanhui commented Apr 30, 2019

Copy link
Copy Markdown
Contributor

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

soyuka commented May 3, 2019

Copy link
Copy Markdown
Member

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

@Toflar

Toflar commented May 3, 2019

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

Thanks @Toflar! 🎉 🚀

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

soyuka commented May 5, 2019

Copy link
Copy Markdown
Member

❤️ 🚀

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.

5 participants