Ensure attributes are removed from queue before adding documents
This commit is contained in:
parent
afd347ca6f
commit
4567bc0d77
|
@ -88,6 +88,24 @@ trait DatabaseBase
|
|||
$this->assertEquals($actors['body']['required'], false);
|
||||
$this->assertEquals($actors['body']['array'], true);
|
||||
|
||||
// wait for database worker to create attributes
|
||||
sleep(5);
|
||||
|
||||
$movies = $this->client->call(Client::METHOD_GET, '/database/collections/' . $data['moviesId'], array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), []);
|
||||
|
||||
$this->assertEquals($movies['body']['$id'], $title['body']['$collection']);
|
||||
$this->assertEquals($movies['body']['$id'], $releaseYear['body']['$collection']);
|
||||
$this->assertEquals($movies['body']['$id'], $actors['body']['$collection']);
|
||||
$this->assertIsArray($movies['body']['attributes']);
|
||||
$this->assertCount(3, $movies['body']['attributes']);
|
||||
$this->assertEquals($movies['body']['attributes'][0]['$id'], $title['body']['$id']);
|
||||
$this->assertEquals($movies['body']['attributes'][1]['$id'], $releaseYear['body']['$id']);
|
||||
$this->assertEquals($movies['body']['attributes'][2]['$id'], $actors['body']['$id']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,12 +55,22 @@ class DatabaseCustomServerTest extends Scope
|
|||
'required' => true,
|
||||
]);
|
||||
|
||||
// wait for database worker to finish creating attributes
|
||||
sleep(5);
|
||||
|
||||
$collection = $this->client->call(Client::METHOD_GET, '/database/collections/' . $actors['body']['$id'], array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
'x-appwrite-key' => $this->getProject()['apiKey']
|
||||
]), []);
|
||||
|
||||
$this->assertEquals($collection['body']['$id'], $firstName['body']['$collection']);
|
||||
$this->assertEquals($collection['body']['$id'], $lastName['body']['$collection']);
|
||||
$this->assertIsArray($collection['body']['attributes']);
|
||||
$this->assertCount(2, $collection['body']['attributes']);
|
||||
$this->assertEquals($collection['body']['attributes'][0]['$id'], $firstName['body']['$id']);
|
||||
$this->assertEquals($collection['body']['attributes'][1]['$id'], $lastName['body']['$id']);
|
||||
|
||||
// Add Documents to the collection
|
||||
$document1 = $this->client->call(Client::METHOD_POST, '/database/collections/' . $actors['body']['$id'] . '/documents', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
|
|
Loading…
Reference in a new issue