Repository navigation
Make the Docker workers run on older PHP versions and without a host database #413
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -349,6 +349,25 @@ public function test_behat_tags_db_version(): void { | |
| $this->assertSame( $expected, $output ); | ||
| } | ||
|
|
||
| public function test_behat_tags_docker_db_image(): void { | ||
| if ( Utils\is_windows() ) { | ||
| $this->markTestSkipped( 'The scenarios do not run in Docker containers on Windows.' ); | ||
| } | ||
|
|
||
| file_put_contents( $this->temp_dir . DIRECTORY_SEPARATOR . 'features' . DIRECTORY_SEPARATOR . 'db.feature', '@require-mysql @require-mariadb-10.6 @require-mariadb-11.4 @less-than-mariadb-10.5 @less-than-mariadb-11' ); | ||
|
|
||
| $base_expecteds = array( '~@github-api', '~@broken' ); | ||
| if ( 'sqlite' !== getenv( 'WP_CLI_TEST_OBJECT_CACHE' ) ) { | ||
| $base_expecteds[] = '~@require-object-cache'; | ||
| } else { | ||
| $base_expecteds[] = '~@skip-object-cache'; | ||
| } | ||
| $expecteds = array( '~@require-mysql', '~@require-sqlite', '~@skip-mariadb', '~@require-mariadb-11.4', '~@less-than-mariadb-10.5' ); | ||
| $expected = '--tags=' . implode( '&&', array_merge( $base_expecteds, $expecteds ) ); | ||
| $output = $this->run_behat_tags_script( 'WP_CLI_TEST_DBTYPE=mysql WP_CLI_TEST_DOCKER=force WP_CLI_TEST_DOCKER_DB=mariadb:10.11' ); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isolate the test environment. If
|
||
| $this->assertSame( $expected, $output ); | ||
| } | ||
|
|
||
| public function test_behat_tags_os(): void { | ||
| $env_github_token = getenv( 'GITHUB_TOKEN' ); | ||
| $db_type = getenv( 'WP_CLI_TEST_DBTYPE' ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,15 @@ function version_tags( | |
| } | ||
|
|
||
| function get_db_type_and_version() { | ||
| // Docker workers run their own database server of the given image, so it decides. | ||
| $docker_db = getenv( 'WP_CLI_TEST_DOCKER_DB' ); | ||
| if ( getenv( 'WP_CLI_TEST_DOCKER' ) && is_string( $docker_db ) && preg_match( '@^(?:[^/]+/)*(mysql|mariadb)(?::([0-9]+(?:\.[0-9]+)*))?@', $docker_db, $matches ) ) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| return array( | ||
| 'type' => $matches[1], | ||
| 'version' => isset( $matches[2] ) ? $matches[2] : '', | ||
| ); | ||
| } | ||
|
|
||
| // Detect which client binary is available. | ||
| $client_binary = null; | ||
| $output = array(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.