mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix: Add error details to assertions and handle 409 in relationship setup
- Add response body to assertion messages for debugging 400/409 errors - Re-add 409 handling for relationship creation (race condition in parallel mode) - Use explicit fullName: null instead of empty data for null person documents Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
d617f89642
commit
b3eecac6f9
@@ -518,7 +518,12 @@ trait DatabasesBase
|
||||
'twoWayKey' => 'person_one_to_many',
|
||||
]);
|
||||
|
||||
$this->assertEquals(202, $relation['headers']['status-code']);
|
||||
// Handle 409 if relationship already exists (possible race condition in parallel mode)
|
||||
if ($relation['headers']['status-code'] === 409) {
|
||||
// Relationship already exists, just wait for it to be available
|
||||
} else {
|
||||
$this->assertEquals(202, $relation['headers']['status-code'], 'Relationship creation failed: ' . \json_encode($relation['body'] ?? 'no body'));
|
||||
}
|
||||
|
||||
// Wait for both the relationship attribute and its twoWayKey to be available
|
||||
$this->waitForAttribute($databaseId, $personCollection, 'libraries');
|
||||
@@ -563,30 +568,34 @@ trait DatabasesBase
|
||||
]
|
||||
]);
|
||||
|
||||
$this->assertEquals(201, $person['headers']['status-code']);
|
||||
$this->assertEquals(201, $person['headers']['status-code'], 'Person with libraries creation failed: ' . \json_encode($person['body'] ?? 'no body'));
|
||||
|
||||
// Create two person documents with null fullName for isNull query testing
|
||||
$nullPerson1 = $this->client->call(Client::METHOD_POST, $this->getRecordUrl($databaseId, $personCollection), $serverHeaders, [
|
||||
$this->getRecordIdParam() => ID::unique(),
|
||||
'data' => [],
|
||||
'data' => [
|
||||
'fullName' => null,
|
||||
],
|
||||
'permissions' => [
|
||||
Permission::read(Role::any()),
|
||||
Permission::update(Role::any()),
|
||||
Permission::delete(Role::any()),
|
||||
]
|
||||
]);
|
||||
$this->assertEquals(201, $nullPerson1['headers']['status-code']);
|
||||
$this->assertEquals(201, $nullPerson1['headers']['status-code'], 'Null person 1 creation failed: ' . \json_encode($nullPerson1['body'] ?? 'no body'));
|
||||
|
||||
$nullPerson2 = $this->client->call(Client::METHOD_POST, $this->getRecordUrl($databaseId, $personCollection), $serverHeaders, [
|
||||
$this->getRecordIdParam() => ID::unique(),
|
||||
'data' => [],
|
||||
'data' => [
|
||||
'fullName' => null,
|
||||
],
|
||||
'permissions' => [
|
||||
Permission::read(Role::any()),
|
||||
Permission::update(Role::any()),
|
||||
Permission::delete(Role::any()),
|
||||
]
|
||||
]);
|
||||
$this->assertEquals(201, $nullPerson2['headers']['status-code']);
|
||||
$this->assertEquals(201, $nullPerson2['headers']['status-code'], 'Null person 2 creation failed: ' . \json_encode($nullPerson2['body'] ?? 'no body'));
|
||||
|
||||
// Update onDelete to cascade
|
||||
$this->client->call(Client::METHOD_PATCH, $this->getSchemaUrl($databaseId, $personCollection, 'relationship', 'libraries'), $serverHeaders, [
|
||||
|
||||
Reference in New Issue
Block a user