-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
added dockerized test setup #13360
added dockerized test setup #13360
Conversation
tests/docker-compose.yml
Outdated
- POSTGRES_PASSWORD=postgres | ||
|
||
#sqlsrv: | ||
# image: microsoft/mssql-server-linux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you going to enable it as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I tried, but you need to install some additional system packages first - it just did not work right away. Let me know if you've some input here, I've never worked with MSSQL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no experience with dockerizing it or even running it under Linux.
TL;drSo, theoretically this is a complete setup. You can view an example GitHub build here - they're not green yet. I've split the setup into 3 stacks: default, mssql and cubrid. We can add more later. There are 4 test jobs, which are run in parallel. Whenever possible I've used pre-built images. Currently there are different base-images, I intentionally left it in this state, because it shows a few issues we should sort out, before continuing. Choosing a base imageThere are several options how to create a Docker image for testing. You can build from different base-images, like Basically you need to install the required PHP-extensions for Yii (that's why some tests fail, because this is just a vanilla PHP) and for some suites also additional extensions. I'd say it's not really possible to build a Yii image with all extensions (pdo_mssql, pdo_cubrid, xcache etc...) just because some are not available for In tests, there are dependencies from i.e. log suite to db, which make tests fail which would actually run on a vanilla PHP. I thought about also putting them into group Depending on how you wanna build the image you also need composer and some other tools, like npm or yarn, i.e. for testing asset bundling via webpack. But that's a separate topic. Tests do not pass on Travis now, this is just because of changed DB credentials and hosts (should be easy to fix) While I could easily write 5x times more :) I'd like stop here and also CC: @mikehaertl and @motin - your experience and feedback about Docker, PHP & Yii is very welcome. Would be really nice if you could give it a try and just report if the things start to work. |
Love it. Every open source project should offer a way of running database-dependent tests without having to follow extensive complicated instructions on how to set up databases and credentials. @schmunk42, please supply a single shell-script that will run all tests with all database engines in sequence and I'll verify that it works over here :) |
Squashed commits: [c42f30c] updated base image, added docs & local test script [88f0c40] debug [6220c94] fixed network isolation [c63c7c3] test mssql only on test/mssql branch [74efc78] fixed isolation in after_script [02b895b] updated test setup [3335f39] updated retry [bd123b2] updated service checks [45e4c90] updated build [d54da7a] updated after_script [5a4c726] 🏭 wait for mysql [08db878] fixed typo [ea53c1e] updated build stages [9807ce3] fixed typos [cf9f64e] fixed mssql testing [08001d6] added db create for mssql [62f6b65] run travis (gitlab simulation) only in travis branch [cf63da4] streamlined build [76808ac] updated test jobs [18d79b5] fixed test error [7b2bce6] updated build & composer.lock [244623a] updated build [86bd71b] fixed cleanup [86ab2e8] fixed cleanup [091d4b8] fixed tests [2d315b5] fixed build config [2913644] fixed project names [f53b823] refactored build config [5a791fb] refactored docker db-tests [b4479b0] revert [a975fa5] updated gitlab build [4e4e5e4] updated mssql setup [d6ff03b] added sleep workaround [578b102] removed host volumes in test [928f50b] fixed path [967ab10] updated tests [520f317] bootstrap cubrid [5f245e1] 🏭 fixed cubrid tests [940dbbc] 🏭 pinned cubrid version 9.3.6.0002 [8d5ea69] 📝 dockerized test commands [9954b54] updated cubrid [fb3afac] updated docs [3f63ced] updated isolation [bdc3c83] 🏭 build cubrid [b777911] 🏭 disabled mssql, updated cubrid [36534e7] added travis-a-like stage [6546f02] updated GitLab build [c046096] updated test setup - added mssql and cubrid stack [5a0e635] disabled host-volume [75cf342] fixed test [8de0794] fixed testing [465d27a] added stages [63aa950] added script [68eecef] fixed typo [00e4b88] updated Docker build [f9072cc] added dockerized test setup
45e4c90
to
f5ab85c
Compare
This should be ready to try out locally. |
Example build pipelines
|
- added git files to dockerignore - updated local testing - updated build on branches
2b702dd
to
7718868
Compare
updated build branches See merge request !1
tests/data/config.php
Outdated
@@ -16,29 +16,29 @@ | |||
$config = [ | |||
'databases' => [ | |||
'cubrid' => [ | |||
'dsn' => 'cubrid:dbname=demodb;host=localhost;port=33000', | |||
'dsn' => 'cubrid:dbname=demodb;host=cubrid;port=33000', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the problem here?
Example build: https://git.hrzg.de/schmunk42/yii2/pipelines/18450/builds |
You can't really fake localhost in the dockerized setup.
It also makes no sense to build the database servers into the PHP image.
Can we just create another config file, which is loaded via ENV bar?
Von meinem iPhone gesendet
… Am 28.01.2017 um 11:58 schrieb Alexander Makarov ***@***.***>:
@samdark commented on this pull request.
In tests/data/config.php:
> @@ -16,29 +16,29 @@
$config = [
'databases' => [
'cubrid' => [
- 'dsn' => 'cubrid:dbname=demodb;host=localhost;port=33000',
+ 'dsn' => 'cubrid:dbname=demodb;host=cubrid;port=33000',
What is the problem here?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Yes, we can. Why not? |
Was just a discussion :)
I'll add it to the PR...
Von meinem iPhone gesendet
… Am 28.01.2017 um 16:36 schrieb Alexander Makarov ***@***.***>:
Yes, we can. Why not?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
…docker-testing # Conflicts: # tests/framework/db/sqlite/QueryBuilderTest.php
About composer.lock - https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file You should update it from time to time and always for a release. A developer who wants to run |
@@ -1,6 +1,10 @@ | |||
<?php | |||
namespace yiiunit\framework\console\controllers; | |||
|
|||
/** | |||
* @group db |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this must be on the class phpdoc, not here.
Current build state: |
Anything more? |
I think it's OK to merge. @cebe ? |
Merged, thank you for this great addition! :) |
You're welcome :) Auto-pull also works already, see: https://gitlab.com/yiisoft-contrib/yii2/pipelines/6851144 I'll look after the tests from time to time. db, cache and mysql are green AFAIR. You can push i.e. to The "exotic" databases still need some testing of the testing... |
@schmunk42 is there a way to integrate these tests with GitHub? Some failures are about differences in intl/ICU data used. gitlab has newer version. Tests should be adjusted. |
Yes, I know. I've meant displaying links and results in pull requests etc. |
Hmm, there's a build badge, but further integration is limited AFAIR. [update] |
@samdark You could run tests also on Travis, but we didn't want to touch the existing Travis setup. Could work with a |
I see. I'd let travis alone as it is. It is sometimes weird but that gives additional cases to fix which is good. |
OK, we'll be able to see these issues better, when we have the base images. Since we then can test multiple versions easily. CC: @mikehaertl |
essential
optional
related: Codeception/Codeception#3739