mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 01:18:37 +00:00
Merge pull request #10418 from appwrite/feat-version-tests
Allow running tests with specific response format
This commit is contained in:
commit
4766d42c16
3 changed files with 50 additions and 4 deletions
28
.github/workflows/tests.yml
vendored
28
.github/workflows/tests.yml
vendored
|
|
@ -8,7 +8,15 @@ env:
|
|||
IMAGE: appwrite-dev
|
||||
CACHE_KEY: appwrite-dev-${{ github.event.pull_request.head.sha }}
|
||||
|
||||
on: [ pull_request ]
|
||||
on:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
response_format:
|
||||
description: 'Response format version to test (e.g., 1.5.0, 1.4.0)'
|
||||
required: false
|
||||
type: string
|
||||
default: ''
|
||||
|
||||
jobs:
|
||||
check_database_changes:
|
||||
|
|
@ -100,7 +108,10 @@ jobs:
|
|||
run: docker compose exec -T appwrite vars
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: docker compose exec appwrite test /usr/src/code/tests/unit
|
||||
run: |
|
||||
docker compose exec \
|
||||
-e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \
|
||||
appwrite test /usr/src/code/tests/unit
|
||||
|
||||
e2e_general_test:
|
||||
name: E2E General Test
|
||||
|
|
@ -132,7 +143,10 @@ jobs:
|
|||
done
|
||||
|
||||
- name: Run General Tests
|
||||
run: docker compose exec -T appwrite test /usr/src/code/tests/e2e/General --debug
|
||||
run: |
|
||||
docker compose exec -T \
|
||||
-e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \
|
||||
appwrite test /usr/src/code/tests/e2e/General --debug
|
||||
|
||||
- name: Failure Logs
|
||||
if: failure()
|
||||
|
|
@ -208,6 +222,7 @@ jobs:
|
|||
docker compose exec -T \
|
||||
-e _APP_DATABASE_SHARED_TABLES \
|
||||
-e _APP_DATABASE_SHARED_TABLES_V1 \
|
||||
-e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \
|
||||
appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude-group devKeys,screenshots
|
||||
|
||||
- name: Failure Logs
|
||||
|
|
@ -296,6 +311,7 @@ jobs:
|
|||
docker compose exec -T \
|
||||
-e _APP_DATABASE_SHARED_TABLES \
|
||||
-e _APP_DATABASE_SHARED_TABLES_V1 \
|
||||
-e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \
|
||||
appwrite test /usr/src/code/tests/e2e/Services/${{ matrix.service }} --debug --exclude-group devKeys,screenshots
|
||||
|
||||
- name: Failure Logs
|
||||
|
|
@ -337,6 +353,7 @@ jobs:
|
|||
docker compose exec -T \
|
||||
-e _APP_DATABASE_SHARED_TABLES \
|
||||
-e _APP_DATABASE_SHARED_TABLES_V1 \
|
||||
-e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \
|
||||
appwrite test /usr/src/code/tests/e2e/Services/Projects --debug --group=devKeys
|
||||
|
||||
- name: Failure Logs
|
||||
|
|
@ -392,6 +409,7 @@ jobs:
|
|||
docker compose exec -T \
|
||||
-e _APP_DATABASE_SHARED_TABLES \
|
||||
-e _APP_DATABASE_SHARED_TABLES_V1 \
|
||||
-e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \
|
||||
appwrite test /usr/src/code/tests/e2e/Services/Projects --debug --group=devKeys
|
||||
|
||||
- name: Failure Logs
|
||||
|
|
@ -434,6 +452,7 @@ jobs:
|
|||
docker compose exec -T \
|
||||
-e _APP_DATABASE_SHARED_TABLES \
|
||||
-e _APP_DATABASE_SHARED_TABLES_V1 \
|
||||
-e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \
|
||||
appwrite test /usr/src/code/tests/e2e/Services/Sites --debug --group=screenshots
|
||||
|
||||
- name: Failure Logs
|
||||
|
|
@ -490,6 +509,7 @@ jobs:
|
|||
docker compose exec -T \
|
||||
-e _APP_DATABASE_SHARED_TABLES \
|
||||
-e _APP_DATABASE_SHARED_TABLES_V1 \
|
||||
-e _APP_E2E_RESPONSE_FORMAT="${{ github.event.inputs.response_format }}" \
|
||||
appwrite test /usr/src/code/tests/e2e/Services/Sites --debug --group=screenshots
|
||||
|
||||
- name: Failure Logs
|
||||
|
|
@ -498,4 +518,4 @@ jobs:
|
|||
echo "=== Appwrite Worker Builds Logs ==="
|
||||
docker compose logs appwrite-worker-builds
|
||||
echo "=== OpenRuntimes Executor Logs ==="
|
||||
docker compose logs openruntimes-executor
|
||||
docker compose logs openruntimes-executor
|
||||
|
|
@ -108,6 +108,20 @@ class Client
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Response Format
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self $this
|
||||
*/
|
||||
public function setResponseFormat(string $value): self
|
||||
{
|
||||
$this->addHeader('X-Appwrite-Response-Format', $value);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $status true
|
||||
* @return self $this
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use Appwrite\Tests\Retryable;
|
|||
use PHPUnit\Framework\TestCase;
|
||||
use Tests\E2E\Client;
|
||||
use Utopia\Database\Helpers\ID;
|
||||
use Utopia\System\System;
|
||||
|
||||
abstract class Scope extends TestCase
|
||||
{
|
||||
|
|
@ -23,6 +24,17 @@ abstract class Scope extends TestCase
|
|||
{
|
||||
$this->client = new Client();
|
||||
$this->client->setEndpoint($this->endpoint);
|
||||
|
||||
$format = System::getEnv('_APP_E2E_RESPONSE_FORMAT');
|
||||
if (!empty($format)) {
|
||||
if (
|
||||
!\preg_match('/^\d+\.\d+\.\d+$/', $format) ||
|
||||
!\version_compare($format, APP_VERSION_STABLE, '<=')
|
||||
) {
|
||||
throw new \Exception('E2E response format must be ' . APP_VERSION_STABLE . ' or lower.');
|
||||
}
|
||||
$this->client->setResponseFormat($format);
|
||||
}
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
|
|
|
|||
Loading…
Reference in a new issue