Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ jobs:
node-version: 18
cache: 'npm'

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4

- name: Build Mock Image
uses: docker/build-push-action@v7
with:
context: .
file: ./config/Dockerfile-mock-webservice
tags: tinify-mock-api:latest
load: true
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Cache node_modules
uses: actions/cache@v4
with:
Expand All @@ -57,7 +70,6 @@ jobs:

- run: npx playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'

- name: Start WordPress
uses: nick-fields/retry@v3
with:
Expand All @@ -73,7 +85,6 @@ jobs:
run: npm run test:playwright
env:
WORDPRESS_PORT: 80${{ matrix.wp }}
PHP_VERSION: ${{ matrix.php }}

- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
Expand Down
3 changes: 2 additions & 1 deletion bin/run-mocks
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash
set -e

port="$1"

docker compose -f config/mocks.docker-compose.yml up -d
docker compose -f config/mocks.docker-compose.yml up -d --wait

mv src/vendor/tinify/Tinify/Client.php src/vendor/tinify/Tinify/Client.php.bak
cp test/fixtures/Client.php src/vendor/tinify/Tinify/Client.php
Expand Down
5 changes: 0 additions & 5 deletions bin/run-wordpress
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,6 @@ EOF
echo "Activating tinify.."
docker compose -f config/docker-compose.yml run --rm wpcli wp plugin activate tiny-compress-images --allow-root

if [ "$WORDPRESS_VERSION_ENV" -ge 55 ]; then
echo "Installing compatible plugins for WordPress ${WORDPRESS_PORT}.."
docker compose -f config/docker-compose.yml run --rm --user 33 wpcli wp plugin install amazon-s3-and-cloudfront --activate --allow-root || exit 1
fi

MAX_ATTEMPTS=10
ATTEMPT=0
until curl -s --head --fail "http://localhost:${WORDPRESS_PORT}" >/dev/null; do
Expand Down
6 changes: 0 additions & 6 deletions config/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ services:
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DEBUG: '1'
AWS_ENDPOINT: http://localstack:4566
AWS_USE_PATH_STYLE_ENDPOINT: true
AWS_ACCESS_KEY_ID: test_key_id
AWS_SECRET_ACCESS_KEY: test_secret_access_key
AWS_REGION: eu-central-1
AWS_DEFAULT_REGION: eu-central-1
volumes:
- wordpress_data:/var/www/html
- ../:/var/www/html/wp-content/plugins/tiny-compress-images
Expand Down
3 changes: 0 additions & 3 deletions config/localstack-init.sh

This file was deleted.

14 changes: 5 additions & 9 deletions config/mocks.docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
services:
localstack:
image: localstack/localstack
volumes:
- './localstack-init.sh:/etc/localstack/init/ready.d/init-aws.sh'
ports:
- 4566:4566
networks:
- tinify

tinify-mock-api:
image: tinify-mock-api
build:
Expand All @@ -17,6 +8,11 @@ services:
- '8100:80'
volumes:
- ../test/mock-tinypng-webservice:/var/www/html
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/"]
interval: 5s
timeout: 3s
retries: 3
networks:
- tinify

Expand Down
21 changes: 0 additions & 21 deletions test/fixtures/class-tiny-config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
if (! defined('TINY_DEBUG')) {
define('TINY_DEBUG', null);
}
define('AWS_REGION', getenv('AWS_REGION'));
define('AWS_ENDPOINT', getenv('AWS_ENDPOINT'));
define('AWS_ACCESS_KEY_ID', getenv('AWS_ACCESS_KEY_ID'));
define('AWS_SECRET_ACCESS_KEY', getenv('AWS_SECRET_ACCESS_KEY'));

class Tiny_Config
{
Expand All @@ -17,23 +13,6 @@ class Tiny_Config
const META_KEY = 'tiny_compress_images';
}

/**
* Filter for adding arguments to the AS3CF AWS client.
* Required to point the client to the LocalStack instance.
*/
add_filter('as3cf_aws_init_client_args', function ($args) {
$args['endpoint'] = AWS_ENDPOINT;
$args['use_path_style_endpoint'] = true;
$args['region'] = AWS_REGION;
return $args;
});

// Force all S3 URLs to use LocalStack instead of s3.amazonaws.com
add_filter('as3cf_aws_s3_url_domain', function ($domain, $bucket, $region, $expires, $args) {
// Replace any AWS domain with LocalStack
return AWS_ENDPOINT . '/' . $bucket;
}, 10, 5);

// ajax hook to delete all attachments as doing it via UI is flaky
add_action( 'wp_ajax_clear_media_library', 'clear_media_library' );
function clear_media_library() {
Expand Down
156 changes: 0 additions & 156 deletions test/integration/compatibility.spec.ts

This file was deleted.

12 changes: 0 additions & 12 deletions test/integration/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,6 @@ export async function getWPVersion(page: Page): Promise<number> {
return parsedText;
}

/**
* @returns {number} retrieves the current PHP version from environment variable
*/
export function getPHPVersion(): number {
const { PHP_VERSION } = process.env;
if (!PHP_VERSION) {
throw Error('PHP_VERSION is not set');
}

return +PHP_VERSION;
}

/**
* @param {Page} page context
* @param {string} pluginSlug slug of the plugin, ex 'tiny-compress-images'
Expand Down
1 change: 1 addition & 0 deletions test/mock-tinypng-webservice/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php
Loading