Add script to invoke E2E tests on CI using ProdCon results (#1354)

This commit is contained in:
Nate McMaster 2018-08-29 19:37:09 -07:00 committed by GitHub
parent 05291af90b
commit f6fc60a0ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 127 additions and 3 deletions

View File

@ -0,0 +1,25 @@
phases:
- phase: Windows
queue:
name: DotNetCore-Windows
timeoutInMinutes: 120
variables:
CI: true
steps:
- task: NodeTool@0
displayName: Install Node 10.x
inputs:
versionSpec: 10.x
- powershell: <
test/Cli.FunctionalTests/run-tests.ps1
-AssetRootUrl $(PB_AssetRootUrl)
-RestoreSources $(PB_RestoreSource)
-PackageVersionsFile $(PB_PackageVersionPropsUrl)
condition: ne(variables['PB_SKipTests'], 'true')
displayName: Run e2e tests
- task: PublishTestResults@2
displayName: Publish test results
condition: always()
inputs:
testRunner: vstest
testResultsFiles: 'artifacts/logs/**/*.trx'

View File

@ -3,10 +3,11 @@
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<LangVersion>latest</LangVersion>
<RestoreSources>
https://api.nuget.org/v3/index.json;
$(DotNetRestoreSources)
</RestoreSources>
</PropertyGroup>
<ItemGroup>

View File

@ -0,0 +1,2 @@
<!-- Intentionally empty. -->
<Project />

View File

@ -0,0 +1,2 @@
<!-- Intentionally empty. -->
<Project />

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
</packageSources>
</configuration>

View File

@ -1 +1,5 @@
# Cli.FunctionalTests
This folder contains tests for ASP.NET Core scenarios in the .NET Core CLI.
This tests in this folder is meant to be kept in isolation from the rest of the repo, and are not invoked during the course of a regular build.

View File

@ -0,0 +1,84 @@
<#
.SYNOPSIS
This script runs the tests in this project on complete build of the .NET Core CLI
.PARAMETER AssetRootUrl
The blob feed for the .NET Core CLI
.PARAMETER RestoreSources
A list of additional NuGet feeds
.PARAMETER SdkVersion
The version of the .NET Core CLI to test. If not specified, the version will be determined automatically if possible.
.PARAMETER PackageVersionsFile
A URL or filepath to a list of package versions
#>
param(
$AssetRootUrl = 'https://dotnetcli.blob.core.windows.net/dotnet',
$RestoreSources = 'https://dotnet.myget.org/F/dotnet-core/api/v3/index.json',
$SdkVersion = $null,
$PackageVersionsFile = $null
)
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version 1
$repoRoot = Resolve-Path "$PSScriptRoot/../../"
Import-Module "$repoRoot/scripts/common.psm1" -Scope Local -Force
$AssetRootUrl = $AssetRootUrl.TrimEnd('/')
Push-Location $PSScriptRoot
try {
New-Item -Type Directory "$PSScriptRoot/obj/" -ErrorAction Ignore | Out-Null
$pkgPropsFile = $PackageVersionsFile
if ($PackageVersionsFile -like 'http*') {
$pkgPropsFile = "$PSScriptRoot/obj/packageversions.props"
Remove-Item $pkgPropsFile -ErrorAction Ignore
Invoke-WebRequest -UseBasicParsing $PackageVersionsFile -OutFile $pkgPropsFile
}
if (-not $SdkVersion) {
$cliManifestUrl = "$AssetRootUrl/orchestration-metadata/manifests/cli.xml"
Write-Host "No SDK version was specified. Attempting to determine the version from $cliManifestUrl"
$cliXml = "$PSScriptRoot/obj/cli.xml"
Remove-Item $cliXml -ErrorAction Ignore
Invoke-WebRequest -UseBasicParsing $cliManifestUrl -OutFile $cliXml
[xml] $cli = Get-Content $cliXml
$SdkVersion = $cli.Build.ProductVersion
}
Write-Host "SDK: $SdkVersion"
@{ sdk = @{ version = $SdkVersion } } | ConvertTo-Json | Set-Content "$PSScriptRoot/global.json"
$dotnetRoot = "$repoRoot/.dotnet"
$dotnet = "$dotnetRoot/dotnet.exe"
if (-not (Test-Path "$dotnetRoot/sdk/$SdkVersion/dotnet.dll")) {
Remote-Item -Recurse -Force $dotnetRoot -ErrorAction Ignore | Out-Null
$cliUrl = "$AssetRootUrl/Sdk/$SdkVersion/dotnet-sdk-$SdkVersion-win-x64.zip"
Write-Host "Downloading $cliUrl"
Invoke-WebRequest -UseBasicParsing $cliUrl -OutFile "$PSScriptRoot/obj/dotnet.zip"
Expand-Archive "$PSScriptRoot/obj/dotnet.zip" -DestinationPath $dotnetRoot
}
# Set a clean test environment
$env:DOTNET_ROOT = $dotnetRoot
$env:DOTNET_MULTILEVEL_LOOKUP = 0
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 0
$env:MSBuildSdksPath = ''
$env:PATH="$dotnetRoot;$env:PATH"
Invoke-Block { & $dotnet test `
--logger "console;verbosity=detailed" `
--logger "trx;LogFile=$repoRoot/artifacts/logs/e2etests.trx" `
"-p:DotNetRestoreSources=$RestoreSources" `
"-p:DotNetPackageVersionPropsPath=$pkgPropsFile" `
"-bl:$repoRoot/artifacts/logs/e2etests.binlog" }
}
finally {
Pop-Location
}