Skip to content

Commit

Permalink
Preview contract: Add preview contract tests to CI (Azure#1674)
Browse files Browse the repository at this point in the history
* Add preview contract validation

* Move all contract tests to folder

* Fix updatecontracts script messages. Add bad contract to verify tests CI..

* Removed code coverage from preview unit tests

* Fixed preview contract
  • Loading branch information
j82w authored Jun 30, 2020
1 parent 3cc081c commit 37763a4
Show file tree
Hide file tree
Showing 26 changed files with 679 additions and 474 deletions.
4 changes: 2 additions & 2 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ Microsoft.Azure.Cosmos/src/Linq @khdang @j82w @sboshra @kirankumarkolli @bchong9
Microsoft.Azure.Cosmos/src/Spatial @lalithamv @sboshra @kirankumarkolli @j82w
Microsoft.Azure.Cosmos/tests @khdang @sboshra @bchong95 @kirankumarkolli @j82w @ealsur @FabianMeiswinkel @kirillg
Microsoft.Azure.Cosmos.Samples @khdang @sboshra @bchong95 @kirankumarkolli @j82w @ealsur @FabianMeiswinkel @kirillg
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/DotNetSDKAPI.json @kirillg @kirankumarkolli
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/DirectContractTests.cs @kirillg @kirankumarkolli
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json @kirillg @kirankumarkolli
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts @kirillg @kirankumarkolli @j82w @ealsur @FabianMeiswinkel
Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Contracts @kirillg @kirankumarkolli @j82w @ealsur @FabianMeiswinkel
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="16.0.102" PrivateAssets="All" />
</ItemGroup>

<PropertyGroup>
<DefineConstants Condition=" '$(IsNightly)' == 'true' or '$(IsPreview)' == 'true' ">$(DefineConstants);PREVIEW</DefineConstants>
</PropertyGroup>

<PropertyGroup>
<SigningType>Product</SigningType>
<SignAssembly>true</SignAssembly>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace Microsoft.Azure.Cosmos.Encryption.Tests
{
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

[TestCategory("Windows")]
[TestCategory("UpdateContract")]
[TestClass]
public class ContractEnforcementTests
{
[TestMethod]
public void ContractChanges()
{
Cosmos.Tests.Contracts.ContractEnforcement.ValidateContractContainBreakingChanges(
dllName: "Microsoft.Azure.Cosmos.Encryption",
baselinePath: "DotNetSDKEncryptionAPI.json",
breakingChangesPath: "DotNetSDKEncryptionAPIChanges.json");
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<IsTestProject>true</IsTestProject>
Expand All @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<Compile Include="..\..\..\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\ContractEnforcement.cs" Link="ContractEnforcement.cs" />
<Compile Include="..\..\..\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\Contracts\ContractEnforcement.cs" Link="Contracts\ContractEnforcement.cs" />
</ItemGroup>

<ItemGroup>
Expand All @@ -27,10 +27,7 @@
</ItemGroup>

<ItemGroup>
<None Include="testbaseline.cmd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="DotNetSDKEncryptionAPI.json">
<None Include="Contracts\DotNetSDKEncryptionAPI.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions Microsoft.Azure.Cosmos/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<EncryptionVersion>1.0.0-preview4</EncryptionVersion>
<HybridRowVersion>1.0.0-preview</HybridRowVersion>
<AboveDirBuildProps>$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))</AboveDirBuildProps>
<DefineConstants Condition=" '$(IsNightly)' == 'true' or '$(IsPreview)' == 'true' ">$(DefineConstants);PREVIEW</DefineConstants>
</PropertyGroup>
<Import Project="$(AboveDirBuildProps)" Condition=" '$(AboveDirBuildProps)' != '' " />
</Project>
1 change: 0 additions & 1 deletion Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@
</PropertyGroup>

<PropertyGroup>
<DefineConstants Condition=" '$(IsNightly)' == 'true' or '$(IsPreview)' == 'true' ">$(DefineConstants);PREVIEW</DefineConstants>
<DefineConstants Condition=" '$(SignAssembly)' == 'true' ">$(DefineConstants);SignAssembly</DefineConstants>
<DefineConstants Condition=" '$(DelaySign)' == 'true' ">$(DefineConstants);DelaySignKeys</DefineConstants>
<DefineConstants>$(DefineConstants);DOCDBCLIENT;COSMOSCLIENT;NETSTANDARD20</DefineConstants>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace Microsoft.Azure.Cosmos.Test.BaselineTest
/// </summary>
/// <typeparam name="TInput">The type of the input for each test (which derives from BaselineTestInput).</typeparam>
/// <typeparam name="TOutput">The type of the output for each test (which derives from BaselineTestOutput).</typeparam>
[TestCategory("UpdateContract")]
public abstract class BaselineTests<TInput, TOutput> where TInput : BaselineTestInput where TOutput : BaselineTestOutput
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
<Result>
<Input>
<Description>PointOperationStatistics</Description>
<CosmosDiagnostics>
<![CDATA[{
<DiagnosticsInternal><![CDATA[{
"ActivityId": "00000000-0000-0000-0000-000000000000",
"StatusCode": 200,
"SubStatusCode": 3,
Expand All @@ -16,11 +15,10 @@
"RequestUri": "http://localhost.com",
"RequestSessionToken": "RequestSessionToken",
"ResponseSessionToken": "ResponseSessionToken"
}]]>
</CosmosDiagnostics>
}]]></DiagnosticsInternal>
</Input>
<Output>
<ToStringOutput><![CDATA[{"Id":"PointOperationStatistics","ActivityId":"00000000-0000-0000-0000-000000000000","ResponseTimeUtc":"2020-01-02T03:04:05.006","StatusCode":200,"SubStatusCode":3,"RequestCharge":4.0,"RequestUri":"http://localhost.com","RequestSessionToken":"RequestSessionToken","ResponseSessionToken":"ResponseSessionToken"}]]></ToStringOutput>
<ToStringOutput><![CDATA[{"Id":"PointOperationStatistics","ActivityId":"00000000-0000-0000-0000-000000000000","ResponseTimeUtc":"2020-01-02T03:04:05.0060000","StatusCode":200,"SubStatusCode":3,"RequestCharge":4.0,"RequestUri":"http://localhost.com","RequestSessionToken":"RequestSessionToken","ResponseSessionToken":"ResponseSessionToken"}]]></ToStringOutput>
</Output>
</Result>
</Results>
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<ContinuationToken><![CDATA[[{"asdf": "asdf"}]]]></ContinuationToken>
</Input>
<Output>
<ParsedToken><![CDATA[[{"asdf":"asdf"}]]]></ParsedToken>
<LatestToken><![CDATA[{"Version":"1.1","QueryPlan":null,"SourceContinuationToken":[{"asdf":"asdf"}]}]]></LatestToken>
<ParsedToken><![CDATA[[{"asdf": "asdf"}]]]></ParsedToken>
<LatestToken><![CDATA[{"Version":"1.1","QueryPlan":null,"SourceContinuationToken":[{"asdf": "asdf"}]}]]></LatestToken>
</Output>
</Result>
<Result>
Expand Down

This file was deleted.

Loading

0 comments on commit 37763a4

Please sign in to comment.