Fix tests for index limits
This commit is contained in:
parent
2f26f8ae4f
commit
0d2bbb0ae9
|
@ -318,6 +318,7 @@ class DatabaseCustomServerTest extends Scope
|
|||
'name' => 'testLimitException',
|
||||
'read' => ['role:all'],
|
||||
'write' => ['role:all'],
|
||||
'permission' => 'document',
|
||||
]);
|
||||
|
||||
$this->assertEquals($collection['headers']['status-code'], 201);
|
||||
|
@ -339,12 +340,9 @@ class DatabaseCustomServerTest extends Scope
|
|||
]);
|
||||
|
||||
$this->assertEquals($attribute['headers']['status-code'], 201);
|
||||
|
||||
// sleep(4);
|
||||
// \usleep(250000);
|
||||
}
|
||||
|
||||
sleep(20);
|
||||
sleep(5);
|
||||
|
||||
$collection = $this->client->call(Client::METHOD_GET, '/database/collections/' . $collectionId, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
|
@ -352,16 +350,10 @@ class DatabaseCustomServerTest extends Scope
|
|||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]));
|
||||
|
||||
var_dump($collection['body']);
|
||||
|
||||
$this->assertEquals($collection['headers']['status-code'], 200);
|
||||
$this->assertEquals($collection['body']['name'], 'testLimitException');
|
||||
$this->assertIsArray($collection['body']['attributes']);
|
||||
$this->assertIsArray($collection['body']['indexes']);
|
||||
$this->assertIsArray($collection['body']['attributesInQueue']);
|
||||
$this->assertIsArray($collection['body']['indexesInQueue']);
|
||||
$this->assertCount(0, $collection['body']['attributesInQueue']);
|
||||
$this->assertCount(0, $collection['body']['indexesInQueue']);
|
||||
$this->assertCount(64, $collection['body']['attributes']);
|
||||
$this->assertCount(0, $collection['body']['indexes']);
|
||||
|
||||
|
@ -381,13 +373,10 @@ class DatabaseCustomServerTest extends Scope
|
|||
]);
|
||||
|
||||
$this->assertEquals(201, $index['headers']['status-code']);
|
||||
$this->assertEquals("key_attribute{$i}", $index['body']['$id']);
|
||||
|
||||
// sleep(4);
|
||||
// \usleep(250000);
|
||||
$this->assertEquals("key_attribute{$i}", $index['body']['key']);
|
||||
}
|
||||
|
||||
sleep(20);
|
||||
sleep(5);
|
||||
|
||||
$collection = $this->client->call(Client::METHOD_GET, '/database/collections/' . $collectionId, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
|
@ -395,16 +384,10 @@ class DatabaseCustomServerTest extends Scope
|
|||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]));
|
||||
|
||||
var_dump($collection);
|
||||
|
||||
$this->assertEquals($collection['headers']['status-code'], 200);
|
||||
$this->assertEquals($collection['body']['name'], 'testLimitException');
|
||||
$this->assertIsArray($collection['body']['attributes']);
|
||||
$this->assertIsArray($collection['body']['indexes']);
|
||||
$this->assertIsArray($collection['body']['attributesInQueue']);
|
||||
$this->assertIsArray($collection['body']['indexesInQueue']);
|
||||
$this->assertCount(0, $collection['body']['attributesInQueue']);
|
||||
$this->assertCount(0, $collection['body']['indexesInQueue']);
|
||||
$this->assertCount(64, $collection['body']['attributes']);
|
||||
$this->assertCount(61, $collection['body']['indexes']);
|
||||
|
||||
|
@ -413,11 +396,12 @@ class DatabaseCustomServerTest extends Scope
|
|||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), [
|
||||
'id' => 'tooMany',
|
||||
'indexId' => 'tooMany',
|
||||
'type' => 'key',
|
||||
'attributes' => ['attribute62'],
|
||||
'attributes' => ['attribute61'],
|
||||
]);
|
||||
|
||||
$this->assertEquals(400, $tooMany['headers']['status-code']);
|
||||
$this->assertEquals('Index limit exceeded', $tooMany['body']['message']);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue