Fix tests

This commit is contained in:
Jake Barnby
2022-11-02 13:16:42 +13:00
parent 50c7c7aa7a
commit aaf896f27e
4 changed files with 8 additions and 10 deletions
+2 -2
View File
@@ -3,8 +3,8 @@
"runner.path": "tests/benchmarks",
"runner.file_pattern": "*Bench.php",
"runner.bootstrap": "app/init.php",
"runner.revs": 500,
"runner.iterations": 3,
"runner.revs": 1000,
"runner.iterations": 5,
"runner.warmup": 1,
"report.generators": {
"appwrite": {
+3 -5
View File
@@ -82,7 +82,6 @@ abstract class Base extends Scope
public function createDatabase(array $params = [])
{
// Create database
$database = $this->client->call(Client::METHOD_POST, '/databases', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
@@ -96,8 +95,7 @@ abstract class Base extends Scope
public function createCollection(array $params = [])
{
// Create collection
$movies = $this->client->call(Client::METHOD_POST, '/databases/' . static::$databaseId . '/collections', [
$collection = $this->client->call(Client::METHOD_POST, '/databases/' . static::$databaseId . '/collections', [
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey']
@@ -110,7 +108,7 @@ abstract class Base extends Scope
Permission::write(Role::user($this->getUser()['$id'])),
],
]);
static::$collectionId = $movies['body']['$id'];
static::$collectionId = $collection['body']['$id'];
// Create attribute
$this->client->call(Client::METHOD_POST, '/databases/' . static::$databaseId . '/collections/' . static::$collectionId . '/attributes/string', [
@@ -123,6 +121,7 @@ abstract class Base extends Scope
'required' => true,
]);
// Wait for attribute to be ready
sleep(2);
}
@@ -130,7 +129,6 @@ abstract class Base extends Scope
{
$count = $params['documents'] ?? 1;
// Create documents
for ($i = 0; $i < $count; $i++) {
$response = $this->client->call(Client::METHOD_POST, '/databases/' . static::$databaseId . '/collections/' . static::$collectionId . '/documents', [
'content-type' => 'application/json',
+1 -1
View File
@@ -17,7 +17,7 @@ class AbuseTest extends Scope
use ProjectCustom;
use SideNone;
protected function setUp(): void
public function setUp(): void
{
parent::setUp();
+2 -2
View File
@@ -21,7 +21,7 @@ class UsageTest extends Scope
protected string $projectId;
protected function setUp(): void
public function setUp(): void
{
parent::setUp();
}
@@ -754,7 +754,7 @@ class UsageTest extends Scope
$this->validateDates($response['executionsFailure']);
}
protected function tearDown(): void
public function tearDown(): void
{
$this->usersCount = 0;
$this->requestsCount = 0;