From 80647baea2cd072d03d76c64571bb4227c4a1206 Mon Sep 17 00:00:00 2001 From: Nalu Tripician <27316859+NaluTripician@users.noreply.github.com> Date: Wed, 3 Apr 2024 12:27:00 -0700 Subject: [PATCH] [Internal] Direct Package: Adds Support for Direct package version 3.33.0 (#4353) * upgraded direct package version * added Taiwan regions * update contracts * fix contracts * fixed more contracts * contracts change * contract change remove * changed baseline files * added space * added region name check test for future verification * nits --------- Co-authored-by: Sourabh Jain --- Directory.Build.props | 2 +- Microsoft.Azure.Cosmos/src/Regions.cs | 10 +++++ .../QueryPlanBaselineTests.GroupBy.xml | 36 ++++++++-------- ...ryPlanBaselineTests.NonValueAggregates.xml | 42 +++++++++---------- .../Contracts/DirectContractTests.cs | 17 +++++++- .../Contracts/DotNetSDKAPI.json | 10 +++++ 6 files changed, 75 insertions(+), 42 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 89cc974a3e..69dc328a70 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,7 +3,7 @@ 3.38.1 3.39.0 preview.1 - 3.32.1 + 3.33.0 2.0.4 2.1.0 preview4 diff --git a/Microsoft.Azure.Cosmos/src/Regions.cs b/Microsoft.Azure.Cosmos/src/Regions.cs index aae88eb22b..28a54b5def 100644 --- a/Microsoft.Azure.Cosmos/src/Regions.cs +++ b/Microsoft.Azure.Cosmos/src/Regions.cs @@ -374,5 +374,15 @@ public static class Regions /// Name of the Azure Spain Central region in the Azure Cosmos DB service. /// public const string SpainCentral = "Spain Central"; + + /// + /// Name of the Azure Taiwan North region in the Azure Cosmos DB service. + /// + public const string TaiwanNorth = "Taiwan North"; + + /// + /// Name of the Azure Taiwan Northwest region in the Azure Cosmos DB service. + /// + public const string TaiwanNorthwest = "Taiwan Northwest"; } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.GroupBy.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.GroupBy.xml index c832978d6f..3059db631a 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.GroupBy.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.GroupBy.xml @@ -311,14 +311,6 @@ GROUP BY c.age, c.name]]> - - min_age - Min - - - max_age - Max - count Count @@ -331,6 +323,14 @@ GROUP BY c.age, c.name]]> team null + + min_age + Min + + + max_age + Max + avg_age Average @@ -504,10 +504,6 @@ GROUP BY UPPER(c.name), SUBSTRING(c.address.city, 0, 3)]]> - - group_name - null - count Count @@ -516,6 +512,10 @@ GROUP BY UPPER(c.name), SUBSTRING(c.address.city, 0, 3)]]> info null + + group_name + null + info @@ -718,17 +718,13 @@ GROUP BY c.name]]> - max_age - Max + count + Count name null - - count - Count - $1 Min @@ -741,6 +737,10 @@ GROUP BY c.name]]> $2 Max + + max_age + Max + avg_age Average diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.NonValueAggregates.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.NonValueAggregates.xml index df0a03b653..29991e9575 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.NonValueAggregates.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/BaselineTest/TestBaseline/QueryPlanBaselineTests.NonValueAggregates.xml @@ -509,11 +509,11 @@ FROM c]]> - min_blah2 + min_blah Min - min_blah + min_blah2 Min @@ -557,11 +557,11 @@ FROM c]]> - max_blah + max_blah2 Max - max_blah2 + max_blah Max @@ -605,11 +605,11 @@ FROM c]]> - avg_blah2 + avg_blah Average - avg_blah + avg_blah2 Average @@ -989,11 +989,11 @@ FROM c]]> - $1 + count_blah Count - count_blah + $1 Count @@ -1181,11 +1181,11 @@ FROM c]]> - max_blah + $1 Max - $1 + max_blah Max @@ -1229,11 +1229,11 @@ FROM c]]> - max_blah + $1 Max - $1 + max_blah Max @@ -1428,15 +1428,15 @@ FROM c]]> - $1 + count_blah Count - count_blah + count_blah2 Count - count_blah2 + $1 Count @@ -1486,11 +1486,11 @@ FROM c]]> Min - min_blah2 + min_blah Min - min_blah + min_blah2 Min @@ -1536,7 +1536,7 @@ FROM c]]> - max_blah + $1 Max @@ -1544,7 +1544,7 @@ FROM c]]> Max - $1 + max_blah Max @@ -1594,11 +1594,11 @@ FROM c]]> Average - avg_blah2 + avg_blah Average - avg_blah + avg_blah2 Average diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DirectContractTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DirectContractTests.cs index c09cf3553c..2b03a74390 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DirectContractTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DirectContractTests.cs @@ -10,13 +10,11 @@ namespace Microsoft.Azure.Cosmos.Contracts using System.Linq; using System.Reflection; using System.Runtime.InteropServices; - using System.Text; using System.Text.RegularExpressions; using Microsoft.Azure.Cosmos.Query.Core.Monads; using Microsoft.Azure.Cosmos.Query.Core.QueryPlan; using Microsoft.Azure.Documents; using Microsoft.VisualStudio.TestTools.UnitTesting; - using Newtonsoft.Json; [TestCategory("Windows")] [TestClass] @@ -81,6 +79,21 @@ public void MappedRegionsTest() CollectionAssert.AreEquivalent(locationNames, cosmosRegions); } + [TestMethod] + public void RegionValueCheck() + { + string[] cosmosRegions = typeof(Regions) + .GetMembers(BindingFlags.Static | BindingFlags.Public) + .Select(e => e.Name) + .ToArray(); + foreach (string region in cosmosRegions) + { + string locationNameValue = typeof(LocationNames).GetField(region).GetValue(null).ToString(); + string regionNameValue = typeof(Regions).GetField(region).GetValue(null).ToString(); + Assert.AreEqual(locationNameValue, regionNameValue); + } + } + [TestMethod] public void RMContractTest() { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json index aef32b7f9c..85b292b8c5 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json @@ -7100,6 +7100,16 @@ "Attributes": [], "MethodInfo": "System.String SwitzerlandWest;IsInitOnly:False;IsStatic:True;" }, + "System.String TaiwanNorth": { + "Type": "Field", + "Attributes": [], + "MethodInfo": "System.String TaiwanNorth;IsInitOnly:False;IsStatic:True;" + }, + "System.String TaiwanNorthwest": { + "Type": "Field", + "Attributes": [], + "MethodInfo": "System.String TaiwanNorthwest;IsInitOnly:False;IsStatic:True;" + }, "System.String UAECentral": { "Type": "Field", "Attributes": [],