Rename FlakyTest attribute to Retry
This commit is contained in:
parent
3a5db3e45f
commit
f4d916a4d2
|
@ -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'] ?? '';
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue