Skip to content

Commit

Permalink
Switch to using resuable container
Browse files Browse the repository at this point in the history
  • Loading branch information
joehoyle committed May 4, 2020
1 parent 8055887 commit 7a46c4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 40 deletions.
8 changes: 4 additions & 4 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* @subpackage JSON API
*/

$test_root = '/wordpress-testing-framework';

require $test_root . '/includes/functions.php';
require '/wp-phpunit/includes/functions.php';

function _manually_load_plugin() {
require dirname( __FILE__ ) . '/../s3-uploads.php';
}
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );


tests_add_filter( 's3_uploads_s3_client_params', function ( array $params ) : array {
$params['endpoint'] = 'http://172.17.0.2:9000';
return $params;
Expand All @@ -35,4 +35,4 @@ function _manually_load_plugin() {
define( 'S3_UPLOADS_REGION', getenv( 'S3_UPLOADS_REGION' ) );
}

require $test_root . '/includes/bootstrap.php';
require '/wp-phpunit/includes/bootstrap.php';
37 changes: 1 addition & 36 deletions tests/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
FROM alpine:3.11

RUN apk add -u --no-cache \
php7 \
php7-pecl-imagick \
php7-dom \
php7-mysqli \
php7-xml \
php7-exif \
php7-simplexml \
mysql \
mysql-client \
imagemagick \
composer \
subversion
FROM humanmade/plugin-tester:latest

RUN apk add minio minio-client --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing

Expand All @@ -24,31 +10,10 @@ ENV S3_UPLOADS_SECRET AWSSECRETKEY
ENV S3_UPLOADS_REGION us-east-1
ENV S3_UPLOADS_BUCKET tests

RUN wget -nv -O /tmp/wordpress.tar.gz https://wordpress.org/wordpress-5.4.tar.gz \
&& mkdir /wordpress \
&& tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C /wordpress \
&& rm /tmp/wordpress.tar.gz

RUN mkdir /wordpress-testing-framework && cd /wordpress-testing-framework \
&& svn co --quiet https://develop.svn.wordpress.org/trunk/tests/phpunit/includes/ \
&& wget -nv -O wp-tests-config.php https://develop.svn.wordpress.org/trunk/wp-tests-config-sample.php \
&& sed -i "s:dirname( __FILE__ ) . '/src/':'/wordpress/':" wp-tests-config.php \
&& sed -i "s/youremptytestdbnamehere/wordpress/" wp-tests-config.php \
&& sed -i "s/yourusernamehere/root/" wp-tests-config.php \
&& sed -i "s/yourpasswordhere//" wp-tests-config.php

RUN mysql_install_db --user=mysql --ldata=/var/lib/mysql
RUN sh -c 'mysqld_safe --datadir=/var/lib/mysql &' && sleep 2 && mysql -u root -e "CREATE DATABASE wordpress"

RUN sh -c '/usr/bin/minio server /data &' && sleep 4 \
&& mcli config host add local http://172.17.0.2:9000 AWSACCESSKEY AWSSECRETKEY \
&& mcli mb local/tests \
&& mcli policy set public local/tests

ENV WP_DEVELOP_DIR=/wordpress-testing-framework/

VOLUME ["/code"]
WORKDIR /code
COPY ./docker-entrypoint.sh /entrypoint.sh
RUN chmod 755 /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

0 comments on commit 7a46c4d

Please sign in to comment.