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

Run tests in isolation (using Docker) #194

Merged
merged 9 commits into from
Dec 3, 2017
Merged

Conversation

sstok
Copy link
Member

@sstok sstok commented Nov 13, 2017

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

This makes the tests less dependent on the developer’s system. and FINALLY! Fixes the ICU versioning problem.

Note: this is a proof of concept, I am open to any suggestions 👍

This makes the tests less dependent on the developer’s system. and FINALLY! Fixes
the ICU versioning problem.
@sstok
Copy link
Member Author

sstok commented Nov 13, 2017

HAHAHA IT WORKED!

pdo_pgsql \
pgsql \
bcmath \
intl \
Copy link
Contributor

Choose a reason for hiding this comment

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

xdebug?

Copy link
Member Author

@sstok sstok Nov 13, 2017

Choose a reason for hiding this comment

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

It depends, I'm not sure this is required for the qa tools 🤔 maybe for the main dev image it's handy for remote debugging and coverage (although php-dbg is more recommended now).

Copy link
Contributor

Choose a reason for hiding this comment

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

TIL php-dbg can collect coverage data. 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

BTW @jakzal confirmed in jakzal/phpqa#18 (comment) you can already use phpdbg from his image so this can be ignored.

Makefile Outdated
test-full:
export SYMFONY_DEPRECATIONS_HELPER=strict

# These tasks should be executed in paralel.
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

@sstok sstok Nov 13, 2017

Choose a reason for hiding this comment

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

Yes, I know. I already tried this in the past with the script symfony/symfony uses but failed to make it work then 😃

If you can help with this that would be great 👍
FYI I am away from ⌨️ on Wednesday and Thursday.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just tried it, don't think you actually need to mess with parallel here, DB specific tests here are 7sec on my system in total while the regular part is ~30s.

@sstok sstok force-pushed the docker-travis branch 3 times, most recently from 0438fee to b99ea9c Compare November 14, 2017 12:34
@dkarlovi dkarlovi mentioned this pull request Nov 16, 2017
@dkarlovi
Copy link
Contributor

IMO once you merge this, you should consider tagging to see what happens (with the mono-repo and all).

@sstok
Copy link
Member Author

sstok commented Nov 17, 2017

The splitting of commits is not automated yet 😛 I will try to contact Fabien if he can set this up for RollerworksSearch 👍

@dkarlovi
Copy link
Contributor

Don't know what exactly he does to set it up, but the splitsh-lite tool was made available for your own use, you can do it on your own if he doesn't have time to do it.

I took the scripts from enqueue-dev.

Makefile Outdated

dist: cs-full phpstan test-full
dist: install cs-full phpstan test-full
Copy link
Contributor

Choose a reason for hiding this comment

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

Install probably not needed here, especially since there's no composer.phar on all systems (mine, for example).

Makefile Outdated
ci: cs-full-check phpstan test-full

install:
composer.phar install --no-progress --no-interaction --no-suggest --optimize-autoloader --ansi
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use composer from Docker or something? Hardcoding composer.phar here doesn't seem right

Makefile Outdated
test-full:
export SYMFONY_DEPRECATIONS_HELPER=strict

# These tasks should be executed in paralel.
Copy link
Contributor

Choose a reason for hiding this comment

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

Just tried it, don't think you actually need to mess with parallel here, DB specific tests here are 7sec on my system in total while the regular part is ~30s.

Makefile Outdated
phpdbg -qrr vendor/bin/phpunit --verbose --configuration travis/mysql.travis.xml --coverage-php build/cov/coverage-phpunit-mysql.cov
phpdbg -qrr phpcov.phar merge --clover build/logs/clover.xml build/cov

test-isolated: docker-up
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd go with simpler labels for targets you wish developers to use directly. For example, if you'd document the development workflow, you'd want to use simpler labels for human use, sort of like public methods vs private methods. :)

Makefile Outdated
test-with-coverage:
export SYMFONY_DEPRECATIONS_HELPER=strict

curl -Ls https://phar.phpunit.de/phpcov.phar > phpcov.phar
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually not needed as the qa image contains it.

volumes:
- pg-data:/var/lib/postgresql/data:rw
ports:
- "5432:5433"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this an error? Exporting a port on a off-by-one port?

Copy link
Member Author

@sstok sstok Nov 23, 2017

Choose a reason for hiding this comment

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

This is only used for the host. Some people (including me) have a local instance running.
The docker instances still use the original port.

In fact I have been pulling out my hairs why the hell I can't connect from the host to this server instance 💀 or MariaDB for that matter. Elasticsearch connects without any issues.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I thought so. If you're only changing the port to avoid collisions, I'd go with something way off instead of just off by one (because it might be considered a typo).

For example, prefixing all ports with 5?

MySQL: 53306
PgSQL: 55432
Elastic: 59200
etc.

That way you see from a mile away it's very different, there's a really low chance of collisions and you can actually document the difference easily. :)

@sstok
Copy link
Member Author

sstok commented Nov 25, 2017

I tagged the sub-splits manually for now. I am working on a more permanent solution 👍

@sstok
Copy link
Member Author

sstok commented Dec 3, 2017

Good news HubKit now allows to split a monolith repository while merging, and... can synchronize a release for all split repositories! So finally no more outdated releases 🎉

I am continuing work on RollerworksSearch 👍

@dkarlovi
Copy link
Contributor

dkarlovi commented Dec 3, 2017

Very nice, LGTM! 🏁

@sstok sstok merged commit 8e51b5d into rollerworks:master Dec 3, 2017
@sstok sstok deleted the docker-travis branch December 3, 2017 18:52
@sstok
Copy link
Member Author

sstok commented Dec 3, 2017

Ah shoot I forgot to remove the WIP commits 😫 that's what I get for working after 7 PM 🤦‍♂️

volumes:
- esdata:/usr/share/elasticsearch/data
ports:
- "9200:9200"
Copy link
Contributor

@dkarlovi dkarlovi Dec 5, 2017

Choose a reason for hiding this comment

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

Note, this was not prefixed with 5. :( (using a prefix here)

Copy link
Member Author

@sstok sstok Dec 5, 2017

Choose a reason for hiding this comment

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

For some reasons this broke the tests 😐 (using a prefix for this port).

Copy link
Contributor

Choose a reason for hiding this comment

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

I know, tried to change it. 😢 Will submit a PR to fix it once I figure out what it is.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

But... 59200 < 65535? That's why I proposed 5 as a prefix, and not 6, for example.

Copy link
Contributor

Choose a reason for hiding this comment

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

Either specify both ports (HOST:CONTAINER), or just the container port (a random host port will be chosen).

See #200

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

2 participants