Skip to content

Commit

Permalink
[INTERNAL] Emulator: Fixes upgrades to internal emulator (#4879)
Browse files Browse the repository at this point in the history
Emulator: Fixes upgrades to internal emulator

Observations: 
- FFCF/AVAD: Emulator defaults resulting in 400/back request =>
Unblocking with `enablePreviousImageForDeleteInFFCF` override
- ReadFeed with Binary now service returning in binary format (related
tests upated)
- Misc escaping changes
- Emulator: Startup times seems regressed (will follow-up later)

On FFCF part: There are two tests
Updates -> Drains changes -> Deletes -> ChangeFeed => 400
Update + Deletes -> Changefeed -> Succeeded with 200 but no previous
image
 
Included `includeIdAndPKForDeletesInFFCFResponse` override working for
both scenarios.
  • Loading branch information
kirankumarkolli authored Nov 10, 2024
1 parent d9c0da8 commit 52891d8
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 53 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FROM c
WHERE STARTSWITH(c.statement, 'The quick brown fox jumps over the lazy dog', false)]]></Query>
</Input>
<Output>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"\/statement\/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"/statement/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
</Output>
</Result>
<Result>
Expand All @@ -18,7 +18,7 @@ FROM c
WHERE STARTSWITH(c['Η γρήγορη καφέ αλεπού πηδάει πάνω από το τεμπέλικο ÏƑκυλί'], 's', false)]]></Query>
</Input>
<Output>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"\/\"Η γρήγορη καφέ αλεπού πηδάει πάνω από το τεμπέλικο ÏƑκυλί\"\/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"/\"Η γρήγορη καφέ αλεπού πηδάει πάνω από το τεμπέλικο ÏƑκυλί\"/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
</Output>
</Result>
<Result>
Expand All @@ -27,7 +27,7 @@ WHERE STARTSWITH(c['Η γρήγορη καφέ αÎ
<Query><![CDATA[SELECT VALUE STARTSWITH(r['ı'], 's', false) FROM root r]]></Query>
</Input>
<Output>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"\/ı\/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
</Output>
</Result>
<Result>
Expand All @@ -36,7 +36,7 @@ WHERE STARTSWITH(c['Η γρήγορη καφέ αÎ
<Query><![CDATA[SELECT VALUE STARTSWITH(r['ZZZzzz'], 's', true) FROM root r]]></Query>
</Input>
<Output>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"\/ZZZzzz\/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"/ZZZzzz/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
</Output>
</Result>
<Result>
Expand All @@ -45,7 +45,7 @@ WHERE STARTSWITH(c['Η γρήγορη καφέ αÎ
<Query><![CDATA[SELECT VALUE STARTSWITH(r[' !"!@#$%^&*()<>?:"{}|ßÁŒÆ12ếàưỏốởặ'], 's', true) FROM root r]]></Query>
</Input>
<Output>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"\/\" !\\\"!@#$%^&*()<>?:\\\"{}|ßÁŒÆ12ếàưỏốởặ\"\/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"/\" !\\\"!@#$%^&*()<>?:\\\"{}|ßÁŒÆ12ếàưỏốởặ\"/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
</Output>
</Result>
<Result>
Expand All @@ -54,7 +54,7 @@ WHERE STARTSWITH(c['Η γρήγορη καφέ αÎ
<Query><![CDATA[SELECT VALUE STARTSWITH(r['Der schnelle Braunfuchs springt über den faulen Hund'], 's', true) FROM root r]]></Query>
</Input>
<Output>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"\/\"Der schnelle Braunfuchs springt über den faulen Hund\"\/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"/\"Der schnelle Braunfuchs springt über den faulen Hund\"/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
</Output>
</Result>
<Result>
Expand All @@ -63,7 +63,7 @@ WHERE STARTSWITH(c['Η γρήγορη καφέ αÎ
<Query><![CDATA[SELECT VALUE STARTSWITH(r['Η γρήγορη καφέ αλεπού πηδάει πάνω από το τεμπέλικο σκυλί'], 's', true) FROM root r]]></Query>
</Input>
<Output>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"\/\"Η γρήγορη καφέ αλεπού πηδάει πάνω από το τεμπέλικο σκυλί\"\/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"/\"Η γρήγορη καφέ αλεπού πηδάει πάνω από το τεμπέλικο σκυλί\"/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
</Output>
</Result>
<Result>
Expand All @@ -72,7 +72,7 @@ WHERE STARTSWITH(c['Η γρήγορη καφέ αÎ
<Query><![CDATA[SELECT VALUE STARTSWITH(r['الثعلب البني السريع يقفز فوق الكلب الكسول'], 's', true) FROM root r]]></Query>
</Input>
<Output>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"\/\"الثعلب البني السريع يقفز فوق الكلب الكسول\"\/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"/\"الثعلب البني السريع يقفز فوق الكلب الكسول\"/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
</Output>
</Result>
<Result>
Expand All @@ -81,7 +81,7 @@ WHERE STARTSWITH(c['Η γρήγορη καφέ αÎ
<Query><![CDATA[SELECT VALUE STARTSWITH(r['Быстрая коричневая лиса прыгает через ленивую собаку'], 's', true) FROM root r]]></Query>
</Input>
<Output>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"\/\"Быстрая коричневая лиса прыгает через ленивую собаку\"\/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"/\"Быстрая коричневая лиса прыгает через ленивую собаку\"/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
</Output>
</Result>
<Result>
Expand All @@ -90,7 +90,7 @@ WHERE STARTSWITH(c['Η γρήγορη καφέ αÎ
<Query><![CDATA[SELECT VALUE STARTSWITH(r['素早く茶色のキツネが怠惰な犬を飛び越えます'], 's', true) FROM root r]]></Query>
</Input>
<Output>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"\/素早く茶色のキツネが怠惰な犬を飛び越えます\/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"/素早く茶色のキツネが怠惰な犬を飛び越えます/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
</Output>
</Result>
<Result>
Expand All @@ -99,7 +99,7 @@ WHERE STARTSWITH(c['Η γρήγορη καφέ αÎ
<Query><![CDATA[SELECT VALUE STARTSWITH(r['तेज, भूरी लोमडी आलसी कुत्ते के उपर कूद गई'], 's', true) FROM root r]]></Query>
</Input>
<Output>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"\/\"तेज, भूरी लोमडी आलसी कुत्ते के उपर कूद गई\"\/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
<IndexMetric><![CDATA[{"UtilizedIndexes":{"SingleIndexes":[{"IndexSpec":"/\"तेज, भूरी लोमडी आलसी कुत्ते के उपर कूद गई\"/?"}],"CompositeIndexes":[]},"PotentialIndexes":{"SingleIndexes":[],"CompositeIndexes":[]}}]]></IndexMetric>
</Output>
</Result>
</Results>
Original file line number Diff line number Diff line change
Expand Up @@ -2349,7 +2349,7 @@ await containerInternal.PatchItemAsync<ToDoActivity>(
catch (CosmosException ex)
{
Assert.AreEqual(HttpStatusCode.BadRequest, ex.StatusCode);
Assert.IsTrue(ex.Message.Contains(@"For Operation(1): Add Operation can only create a child object of an existing node(array or object) and cannot create path recursively, no path found beyond: 'nonExistentParent'. Learn more: https:\/\/aka.ms\/cosmosdbpatchdocs"), ex.Message);
Assert.IsTrue(ex.Message.Contains(@"For Operation(1): Add Operation can only create a child object of an existing node(array or object) and cannot create path recursively, no path found beyond: 'nonExistentParent'. Learn more: https://aka.ms/cosmosdbpatchdocs"), ex.Message);
CosmosItemTests.ValidateCosmosException(ex);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,7 @@ private void ValidateJsonSerializationFormatReadFeed(DocumentClient client, Docu
headers.Add(HttpConstants.HttpHeaders.ContentSerializationFormat, ContentSerializationFormat.CosmosBinary.ToString());
response = ReadDocumentFeedRequestAsync(client, collection.ResourceId, headers).Result;
Assert.AreEqual(HttpStatusCode.OK, response.StatusCode, "Invalid status code");
Assert.IsTrue(response.ResponseBody.ReadByte() < HeadersValidationTests.BinarySerializationByteMarkValue);
//Assert.AreEqual(JsonSerializationFormat.Binary, response.ResponseBody.ReadByte());
Assert.AreEqual((int)JsonSerializationFormat.Binary, response.ResponseBody.ReadByte());
}

private void ValidateJsonSerializationFormatQuery(DocumentClient client, DocumentCollection collection)
Expand Down
6 changes: 3 additions & 3 deletions templates/emulator-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

steps:
- pwsh: |
Write-Host "Downloading Cosmos Emulator - $env:EMULATORMSIURL" -ForegroundColor green
Invoke-WebRequest "$env:EMULATORMSIURL" -OutFile "$env:temp\azure-cosmosdb-emulator.msi"
Write-Host "Downloading Cosmos Emulator - https://aka.ms/cosmosdbemulator-internal" -ForegroundColor green
Invoke-WebRequest https://aka.ms/cosmosdbemulator-internal -OutFile "$env:temp\azure-cosmosdb-emulator.msi"
Write-Host "Finished Downloading Cosmos Emulator - $env:temp\azure-cosmosdb-emulator.msi" -ForegroundColor green
dir "$env:temp"
Expand Down Expand Up @@ -39,7 +39,7 @@ steps:
for ($j=0; $j -lt 3; $j++) {
Write-Host "Attempt $j"
Start-Process "$env:temp\Azure Cosmos DB Emulator\SourceDir\Azure Cosmos DB Emulator\CosmosDB.Emulator.exe" "/NoExplorer /NoUI /DisableRateLimiting /PartitionCount=10 /Consistency=Strong /EnablePreview /EnableSqlComputeEndpoint" -Verb RunAs
Start-Process "$env:temp\Azure Cosmos DB Emulator\SourceDir\Azure Cosmos DB Emulator\CosmosDB.Emulator.exe" "/NoExplorer /NoUI /DisableRateLimiting /PartitionCount=10 /Consistency=Strong /EnablePreview /EnableSqlComputeEndpoint /overrides=enablePreviousImageForDeleteInFFCF:true;" -Verb RunAs
for ($i=0; $i -lt (3+2*$j); $i++) {
$status = Get-CosmosDbEmulatorStatus
Write-Host "Cosmos DB Emulator Status: $status"
Expand Down

0 comments on commit 52891d8

Please sign in to comment.