1
0
Fork 0
mirror of synced 2024-06-01 18:39:57 +12:00

Rename FlakyTest attribute to Retry

This commit is contained in:
Jake Barnby 2022-08-30 23:10:15 +12:00
parent 3a5db3e45f
commit f4d916a4d2
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
5 changed files with 11 additions and 11 deletions

View file

@ -2,7 +2,7 @@
namespace Tests\E2E\Services\Account;
use Appwrite\Tests\FlakyTest;
use Appwrite\Tests\Retry;
use Tests\E2E\Client;
trait AccountBase
@ -518,7 +518,7 @@ trait AccountBase
/**
* @depends testUpdateAccountName
*/
#[FlakyTest(retries: 1)]
#[Retry(count: 1)]
public function testUpdateAccountPassword($data): array
{
$email = $data['email'] ?? '';

View file

@ -2,7 +2,7 @@
namespace Tests\E2E\Services\Functions;
use Appwrite\Tests\FlakyTest;
use Appwrite\Tests\Retry;
use CURLFile;
use Tests\E2E\Client;
use Tests\E2E\Scopes\ProjectCustom;
@ -1207,7 +1207,7 @@ class FunctionsCustomServerTest extends Scope
$this->assertEquals(204, $response['headers']['status-code']);
}
#[FlakyTest(retries: 1)]
#[Retry(count: 1)]
public function testCreateCustomRubyExecution()
{
$name = 'ruby-3.1';

View file

@ -2,7 +2,7 @@
namespace Tests\E2E\Services\Webhooks;
use Appwrite\Tests\FlakyTest;
use Appwrite\Tests\Retry;
use CURLFile;
use Tests\E2E\Client;
@ -297,7 +297,7 @@ trait WebhooksBase
/**
* @depends testCreateCollection
*/
#[FlakyTest(retries: 1)]
#[Retry(count: 1)]
public function testDeleteDocument(array $data): array
{
$actorsId = $data['actorsId'];

View file

@ -8,9 +8,9 @@ namespace Appwrite\Tests;
* Requires that the test class extends {@see TestCase} and has trait {@see Retryable}.
*/
#[\Attribute(\Attribute::TARGET_METHOD)]
class FlakyTest
class Retry
{
public function __construct(protected int $retries = 1)
public function __construct(protected int $count = 1)
{
}
}

View file

@ -5,13 +5,13 @@ namespace Appwrite\Tests;
use PHPUnit\Framework\TestCase;
/**
* Allows test methods annotated with {@see FlakyTest} to be retried.
* Allows test methods annotated with {@see Retry} to be retried.
*/
trait Retryable
{
/**
* Custom runBare, hides and defers to PHPUnit {@see TestCase} runBare function,
* accounting for any retries configured by the {@see FlakyTest} annotation.
* accounting for any retries configured by the {@see Retry} annotation.
*
* @return void
* @throws \ReflectionException
@ -49,7 +49,7 @@ trait Retryable
$name->setAccessible(true);
$name = $name->getValue($this);
$method = $root->getMethod($name);
$attributes = $method->getAttributes(FlakyTest::class);
$attributes = $method->getAttributes(Retry::class);
$attribute = $attributes[0] ?? null;
$args = $attribute?->getArguments();
$retries = $args['retries'] ?? 0;