mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix: adjust testCreateIndexes index count for MongoDB maxIndexLength=1024
MongoDB's maxIndexLength (1024) allows the 512+512 index to succeed, resulting in 5 indexes instead of 4. Use conditional count and assertContains for position-independent key checks. Verified: 830/830 Database tests pass locally on MongoDB with paratest. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
93bc3871df
commit
dd1a3d8222
Generated
+18
-18
@@ -3797,16 +3797,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "utopia-php/database",
|
"name": "utopia-php/database",
|
||||||
"version": "5.2.1",
|
"version": "5.3.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/utopia-php/database.git",
|
"url": "https://github.com/utopia-php/database.git",
|
||||||
"reference": "adfdf201144353a1d2ce14bb197ab746079894e0"
|
"reference": "5e49f32ebb6e40a78209231564c40e5068810429"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/adfdf201144353a1d2ce14bb197ab746079894e0",
|
"url": "https://api.github.com/repos/utopia-php/database/zipball/5e49f32ebb6e40a78209231564c40e5068810429",
|
||||||
"reference": "adfdf201144353a1d2ce14bb197ab746079894e0",
|
"reference": "5e49f32ebb6e40a78209231564c40e5068810429",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -3849,9 +3849,9 @@
|
|||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/utopia-php/database/issues",
|
"issues": "https://github.com/utopia-php/database/issues",
|
||||||
"source": "https://github.com/utopia-php/database/tree/5.2.1"
|
"source": "https://github.com/utopia-php/database/tree/5.3.0"
|
||||||
},
|
},
|
||||||
"time": "2026-02-16T11:01:13+00:00"
|
"time": "2026-02-17T11:50:01+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "utopia-php/detector",
|
"name": "utopia-php/detector",
|
||||||
@@ -5385,16 +5385,16 @@
|
|||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
{
|
{
|
||||||
"name": "appwrite/sdk-generator",
|
"name": "appwrite/sdk-generator",
|
||||||
"version": "1.9.2",
|
"version": "1.9.3",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/appwrite/sdk-generator.git",
|
"url": "https://github.com/appwrite/sdk-generator.git",
|
||||||
"reference": "74de906ea5051030c5299a5d4aa74d963a531130"
|
"reference": "5a8a304e404c84539f3ac6562c736f8c7ef2bef2"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/74de906ea5051030c5299a5d4aa74d963a531130",
|
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/5a8a304e404c84539f3ac6562c736f8c7ef2bef2",
|
||||||
"reference": "74de906ea5051030c5299a5d4aa74d963a531130",
|
"reference": "5a8a304e404c84539f3ac6562c736f8c7ef2bef2",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -5430,9 +5430,9 @@
|
|||||||
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
|
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/appwrite/sdk-generator/issues",
|
"issues": "https://github.com/appwrite/sdk-generator/issues",
|
||||||
"source": "https://github.com/appwrite/sdk-generator/tree/1.9.2"
|
"source": "https://github.com/appwrite/sdk-generator/tree/1.9.3"
|
||||||
},
|
},
|
||||||
"time": "2026-02-16T06:59:54+00:00"
|
"time": "2026-02-17T11:48:05+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "brianium/paratest",
|
"name": "brianium/paratest",
|
||||||
@@ -6778,16 +6778,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "12.5.11",
|
"version": "12.5.12",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "9b518cb40f9474572c9f0178e96ff3dc1cf02bf1"
|
"reference": "418e06b3b46b0d54bad749ff4907fc7dfb530199"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9b518cb40f9474572c9f0178e96ff3dc1cf02bf1",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/418e06b3b46b0d54bad749ff4907fc7dfb530199",
|
||||||
"reference": "9b518cb40f9474572c9f0178e96ff3dc1cf02bf1",
|
"reference": "418e06b3b46b0d54bad749ff4907fc7dfb530199",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -6856,7 +6856,7 @@
|
|||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.11"
|
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.12"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -6880,7 +6880,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2026-02-10T12:32:02+00:00"
|
"time": "2026-02-16T08:34:36+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "psr/cache",
|
"name": "psr/cache",
|
||||||
|
|||||||
@@ -839,6 +839,7 @@ class OpenAPI3 extends Format
|
|||||||
case 'string':
|
case 'string':
|
||||||
case 'datetime':
|
case 'datetime':
|
||||||
case 'payload':
|
case 'payload':
|
||||||
|
case 'id':
|
||||||
$type = 'string';
|
$type = 'string';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -819,6 +819,7 @@ class Swagger2 extends Format
|
|||||||
switch ($rule['type']) {
|
switch ($rule['type']) {
|
||||||
case 'string':
|
case 'string':
|
||||||
case 'datetime':
|
case 'datetime':
|
||||||
|
case 'id':
|
||||||
$type = 'string';
|
$type = 'string';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ abstract class Model
|
|||||||
public const TYPE_PAYLOAD = 'payload';
|
public const TYPE_PAYLOAD = 'payload';
|
||||||
public const TYPE_ARRAY = 'array';
|
public const TYPE_ARRAY = 'array';
|
||||||
public const TYPE_ENUM = 'enum';
|
public const TYPE_ENUM = 'enum';
|
||||||
|
public const TYPE_ID = 'id';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class Document extends Any
|
|||||||
'example' => '5e5ea5c16897e',
|
'example' => '5e5ea5c16897e',
|
||||||
])
|
])
|
||||||
->addRule('$sequence', [
|
->addRule('$sequence', [
|
||||||
'type' => self::TYPE_STRING,
|
'type' => self::TYPE_ID,
|
||||||
'description' => 'Document sequence ID.',
|
'description' => 'Document sequence ID.',
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'example' => '1',
|
'example' => '1',
|
||||||
@@ -85,7 +85,7 @@ class Document extends Any
|
|||||||
|
|
||||||
if (!$document->isEmpty()) {
|
if (!$document->isEmpty()) {
|
||||||
$sequence = $document->getAttribute('$sequence', '');
|
$sequence = $document->getAttribute('$sequence', '');
|
||||||
$document->setAttribute('$sequence', (string)$sequence);
|
$document->setAttribute('$sequence', $sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($document->getAttributes() as $attribute) {
|
foreach ($document->getAttributes() as $attribute) {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class Row extends Any
|
|||||||
'example' => '5e5ea5c16897e',
|
'example' => '5e5ea5c16897e',
|
||||||
])
|
])
|
||||||
->addRule('$sequence', [
|
->addRule('$sequence', [
|
||||||
'type' => self::TYPE_STRING,
|
'type' => self::TYPE_ID,
|
||||||
'description' => 'Row sequence ID.',
|
'description' => 'Row sequence ID.',
|
||||||
'default' => '',
|
'default' => '',
|
||||||
'example' => '1',
|
'example' => '1',
|
||||||
@@ -83,7 +83,7 @@ class Row extends Any
|
|||||||
$document->removeAttribute('$collection');
|
$document->removeAttribute('$collection');
|
||||||
$document->removeAttribute('$tenant');
|
$document->removeAttribute('$tenant');
|
||||||
$sequence = $document->getAttribute('$sequence', '');
|
$sequence = $document->getAttribute('$sequence', '');
|
||||||
$document->setAttribute('$sequence', (string)$sequence);
|
$document->setAttribute('$sequence', $sequence);
|
||||||
|
|
||||||
foreach ($document->getAttributes() as $column) {
|
foreach ($document->getAttributes() as $column) {
|
||||||
if (\is_array($column)) {
|
if (\is_array($column)) {
|
||||||
|
|||||||
@@ -2198,11 +2198,13 @@ trait DatabasesBase
|
|||||||
]), []);
|
]), []);
|
||||||
|
|
||||||
$this->assertIsArray($collectionResponse['body']['indexes']);
|
$this->assertIsArray($collectionResponse['body']['indexes']);
|
||||||
$this->assertCount(4, $collectionResponse['body']['indexes']);
|
$expectedIndexCount = $this->getMaxIndexLength() < 1024 ? 4 : 5; // MongoDB accepts tooLong index
|
||||||
$this->assertEquals($titleIndex['body']['key'], $collectionResponse['body']['indexes'][0]['key']);
|
$this->assertCount($expectedIndexCount, $collectionResponse['body']['indexes']);
|
||||||
$this->assertEquals($releaseYearIndex['body']['key'], $collectionResponse['body']['indexes'][1]['key']);
|
$indexKeys = array_column($collectionResponse['body']['indexes'], 'key');
|
||||||
$this->assertEquals($releaseWithDate1['body']['key'], $collectionResponse['body']['indexes'][2]['key']);
|
$this->assertContains($titleIndex['body']['key'], $indexKeys);
|
||||||
$this->assertEquals($releaseWithDate2['body']['key'], $collectionResponse['body']['indexes'][3]['key']);
|
$this->assertContains($releaseYearIndex['body']['key'], $indexKeys);
|
||||||
|
$this->assertContains($releaseWithDate1['body']['key'], $indexKeys);
|
||||||
|
$this->assertContains($releaseWithDate2['body']['key'], $indexKeys);
|
||||||
|
|
||||||
$this->assertEventually(function () use ($databaseId, $collectionId) {
|
$this->assertEventually(function () use ($databaseId, $collectionId) {
|
||||||
$collResp = $this->client->call(Client::METHOD_GET, $this->getContainerUrl($databaseId, $collectionId), array_merge([
|
$collResp = $this->client->call(Client::METHOD_GET, $this->getContainerUrl($databaseId, $collectionId), array_merge([
|
||||||
|
|||||||
Reference in New Issue
Block a user