forked from Azure/azure-cosmos-dotnet-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UpdateContracts.ps1
55 lines (46 loc) · 3.9 KB
/
UpdateContracts.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
if(!(Test-Path -Path .\Microsoft.Azure.Cosmos)){
Write-Error "Please run script from root of the enlistment"
}
#Run the Cosmos DB SDK GA contract tests
$projResult = dotnet test '.\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\Microsoft.Azure.Cosmos.Tests.csproj' --filter "TestCategory=UpdateContract" --configuration Release
$updatedContractFile = ".\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Release\netcoreapp2.1\Contracts\DotNetSDKAPIChanges.json"
if(!(Test-Path -Path $updatedContractFile)){
Write-Error ("The contract file did not get updated with the build. Please fix the test to output the contract file: " + $updatedContractFile)
}else{
Copy-Item -Path $updatedContractFile -Destination ".\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\Contracts\DotNetSDKAPI.json"
Write-Output ("Updated contract " + $updatedContractFile)
}
$updatedContractFolder = ".\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Release\netcoreapp2.1\BaselineTest\TestOutput\*"
if(!(Test-Path -Path $updatedContractFolder)){
Write-Error ("The contract file did not get updated with the build. Please fix the test to output the contract file: " + $updatedContractFile)
}else{
Copy-Item -Path $updatedContractFolder -Destination ".\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\BaselineTest\TestBaseline" -Recurse
Write-Output ("Updated contract " + $updatedContractFolder)
}
#Run the Cosmos DB SDK Emulator contract tests
$projResult = dotnet test '.\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\Microsoft.Azure.Cosmos.EmulatorTests.csproj' --filter "TestCategory=UpdateContract" --configuration Release
$updatedContractFolder = ".\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\bin\Release\netcoreapp2.1\BaselineTest\TestOutput\*"
if(!(Test-Path -Path $updatedContractFolder)){
Write-Error ("The contract file did not get updated with the build. Please fix the test to output the contract file: " + $updatedContractFile)
}else{
Copy-Item -Path $updatedContractFolder -Destination ".\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.EmulatorTests\BaselineTest\TestBaseline" -Recurse
Write-Output ("Updated contract " + $updatedContractFolder)
}
#Run the Cosmos DB SDK Preview contract tests
$projResult = dotnet test '.\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\Microsoft.Azure.Cosmos.Tests.csproj' --filter "TestCategory=UpdateContract" --configuration Release -p:IsPreview=true
$updatedContractFile = ".\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\bin\Release\netcoreapp2.1\Contracts\DotNetPreviewSDKAPIChanges.json"
if(!(Test-Path -Path $updatedContractFile)){
Write-Error ("The contract file did not get updated with the preview build. Please fix the test to output the contract file: " + $updatedContractFile)
}else{
Copy-Item -Path $updatedContractFile -Destination ".\Microsoft.Azure.Cosmos\tests\Microsoft.Azure.Cosmos.Tests\Contracts\DotNetPreviewSDKAPI.json"
Write-Output ("Updated contract " + $updatedContractFile)
}
#Run the Encryption SDK contract tests
$projResult = dotnet test '.\Microsoft.Azure.Cosmos.Encryption\tests\Microsoft.Azure.Cosmos.Encryption.Tests\Microsoft.Azure.Cosmos.Encryption.Tests.csproj' --filter "TestCategory=UpdateContract" --configuration Release
$updatedContractFile = ".\Microsoft.Azure.Cosmos.Encryption\tests\Microsoft.Azure.Cosmos.Encryption.Tests\bin\Release\netcoreapp2.1\Contracts\DotNetSDKEncryptionAPIChanges.json"
if(!(Test-Path -Path $updatedContractFile)){
Write-Error ("The contract file did not get updated with the build. Please fix the test to output the contract file: " + $updatedContractFile)
}else{
Copy-Item -Path $updatedContractFile -Destination ".\Microsoft.Azure.Cosmos.Encryption\tests\Microsoft.Azure.Cosmos.Encryption.Tests\Contracts\DotNetSDKEncryptionAPI.json"
Write-Output ("Updated contract " + $updatedContractFile)
}