From bce54e1c13a300d7aa68fe6b9e38dd89b1cac679 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Tue, 25 Sep 2018 17:37:06 +0000 Subject: [PATCH 01/14] Updating submodule(s) Microsoft.Data.Sqlite => 044d5157de9919fced4fa322f8361beafe2e485c [auto-updated: submodules] --- modules/Microsoft.Data.Sqlite | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.Data.Sqlite b/modules/Microsoft.Data.Sqlite index 15095e7a2b..044d5157de 160000 --- a/modules/Microsoft.Data.Sqlite +++ b/modules/Microsoft.Data.Sqlite @@ -1 +1 @@ -Subproject commit 15095e7a2b121996c4fb5e96dc52f8c246fcd85e +Subproject commit 044d5157de9919fced4fa322f8361beafe2e485c From 5dcc74ae773c33f5d095bb566a686e0818ef55a1 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Tue, 25 Sep 2018 18:10:23 +0000 Subject: [PATCH 02/14] Updating submodule(s) EntityFrameworkCore => a82aa36b38f3bef4604dd7013a2284b6db0cd8c0 [auto-updated: submodules] --- modules/EntityFrameworkCore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/EntityFrameworkCore b/modules/EntityFrameworkCore index c9e854248c..a82aa36b38 160000 --- a/modules/EntityFrameworkCore +++ b/modules/EntityFrameworkCore @@ -1 +1 @@ -Subproject commit c9e854248c420b61acb54aedc8e58cd98c4af37a +Subproject commit a82aa36b38f3bef4604dd7013a2284b6db0cd8c0 From 86bbf1fc8bca7cee184b00fa3340be8123294acf Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Tue, 25 Sep 2018 18:57:52 +0000 Subject: [PATCH 03/14] Updating submodule(s) Microsoft.Data.Sqlite => cb9c77ba9fc101779e78615c083dcc942c8290fe [auto-updated: submodules] --- modules/Microsoft.Data.Sqlite | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Microsoft.Data.Sqlite b/modules/Microsoft.Data.Sqlite index 044d5157de..cb9c77ba9f 160000 --- a/modules/Microsoft.Data.Sqlite +++ b/modules/Microsoft.Data.Sqlite @@ -1 +1 @@ -Subproject commit 044d5157de9919fced4fa322f8361beafe2e485c +Subproject commit cb9c77ba9fc101779e78615c083dcc942c8290fe From 925e65f9870731a66f467b325454b33c8a814a9f Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Tue, 25 Sep 2018 15:17:46 -0700 Subject: [PATCH 04/14] Updating submodule(s) Security => 383201902731f07041b9fdc73256b0859d1c3660 [auto-updated: submodules] --- modules/Security | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Security b/modules/Security index 862f781228..3832019027 160000 --- a/modules/Security +++ b/modules/Security @@ -1 +1 @@ -Subproject commit 862f78122885cdb725d4a25f8ce07e34ccb860f4 +Subproject commit 383201902731f07041b9fdc73256b0859d1c3660 From 16824d5125484f2c836723ccec9a29d77bac0d13 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Tue, 25 Sep 2018 15:58:49 -0700 Subject: [PATCH 05/14] Updating submodule(s) IISIntegration => 1eb5da31e5e37efe1c0f3b43f6f8f701d4a284e1 Templating => c6347f035fd9a40fd522c8365f9491603197e589 [auto-updated: submodules] --- modules/IISIntegration | 2 +- modules/Templating | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/IISIntegration b/modules/IISIntegration index 2018a43d63..1eb5da31e5 160000 --- a/modules/IISIntegration +++ b/modules/IISIntegration @@ -1 +1 @@ -Subproject commit 2018a43d63d2dd8896443b2f51db725f4c9b0b4d +Subproject commit 1eb5da31e5e37efe1c0f3b43f6f8f701d4a284e1 diff --git a/modules/Templating b/modules/Templating index 5a22e20bfc..c6347f035f 160000 --- a/modules/Templating +++ b/modules/Templating @@ -1 +1 @@ -Subproject commit 5a22e20bfcdc1a298327519e0196d5e87734ca25 +Subproject commit c6347f035fd9a40fd522c8365f9491603197e589 From b1a209613f2edf100db97c7993d0371aa23d8a19 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Tue, 25 Sep 2018 16:29:26 -0700 Subject: [PATCH 06/14] Updating submodule(s) Common => dd4f9cfd093e59f419a9a8edc9729c6613c9e9b9 [auto-updated: submodules] --- modules/Common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Common b/modules/Common index 8fa555ac5e..dd4f9cfd09 160000 --- a/modules/Common +++ b/modules/Common @@ -1 +1 @@ -Subproject commit 8fa555ac5ec6887c71c7158fb6149370c3c113cc +Subproject commit dd4f9cfd093e59f419a9a8edc9729c6613c9e9b9 From fea578035efb1d15008b99245340898991cae2d3 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Tue, 25 Sep 2018 18:27:19 -0700 Subject: [PATCH 07/14] Updating submodule(s) Common => 7ffe22326472bf9f59a68324c36faf52a8d2d6c2 [auto-updated: submodules] --- modules/Common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Common b/modules/Common index dd4f9cfd09..7ffe223264 160000 --- a/modules/Common +++ b/modules/Common @@ -1 +1 @@ -Subproject commit dd4f9cfd093e59f419a9a8edc9729c6613c9e9b9 +Subproject commit 7ffe22326472bf9f59a68324c36faf52a8d2d6c2 From 1635034fee5622bb850ed0e52efd41b059f31cce Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Wed, 26 Sep 2018 02:44:53 +0000 Subject: [PATCH 08/14] Updating submodule(s) Common => a1aa6090a60f51419a20e8e23dd5ee0b08c0f8e3 [auto-updated: submodules] --- modules/Common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Common b/modules/Common index 6812ed2ea7..a1aa6090a6 160000 --- a/modules/Common +++ b/modules/Common @@ -1 +1 @@ -Subproject commit 6812ed2ea751ac0c8ad0977b2e38706032b7f468 +Subproject commit a1aa6090a60f51419a20e8e23dd5ee0b08c0f8e3 From 6bbc441565b4f171ee8e3a5e71aa3aa993494c4a Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Tue, 25 Sep 2018 19:53:23 -0700 Subject: [PATCH 09/14] Updating submodule(s) Common => b7305c2801855a471db09da408b9c30b998038d5 [auto-updated: submodules] --- modules/Common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Common b/modules/Common index 7ffe223264..b7305c2801 160000 --- a/modules/Common +++ b/modules/Common @@ -1 +1 @@ -Subproject commit 7ffe22326472bf9f59a68324c36faf52a8d2d6c2 +Subproject commit b7305c2801855a471db09da408b9c30b998038d5 From 90ed3bde5e73610f400472ea1638344a0865459e Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 26 Sep 2018 09:42:18 -0700 Subject: [PATCH 10/14] Add more logging for E2E tests Trying to diagnose why ProdCon fails to download metadata --- .azure/pipelines/e2e-tests.yml | 5 +---- test/Cli.FunctionalTests/run-tests.ps1 | 9 ++++++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.azure/pipelines/e2e-tests.yml b/.azure/pipelines/e2e-tests.yml index 3db5a15233..18398083cf 100644 --- a/.azure/pipelines/e2e-tests.yml +++ b/.azure/pipelines/e2e-tests.yml @@ -19,10 +19,7 @@ phases: inputs: versionSpec: 10.x - powershell: | - test/Cli.FunctionalTests/run-tests.ps1 ` - -ci ` - -ProdConManifestUrl $env:PRODCONMANIFESTURL ` - -TestRuntimeIdentifier $(Test.RuntimeIdentifier) + test/Cli.FunctionalTests/run-tests.ps1 -ci -ProdConManifestUrl $env:PRODCONMANIFESTURL -TestRuntimeIdentifier $(Test.RuntimeIdentifier) condition: ne(variables['PB_SkipTests'], 'true') displayName: Run E2E tests - task: PublishTestResults@2 diff --git a/test/Cli.FunctionalTests/run-tests.ps1 b/test/Cli.FunctionalTests/run-tests.ps1 index 5c04f369f9..2c0f77cff8 100644 --- a/test/Cli.FunctionalTests/run-tests.ps1 +++ b/test/Cli.FunctionalTests/run-tests.ps1 @@ -49,6 +49,9 @@ Set-StrictMode -Version 1 $repoRoot = Resolve-Path "$PSScriptRoot/../../" Import-Module "$repoRoot/scripts/common.psm1" -Scope Local -Force +# This ID corresponds to the ProdCon build number +Write-Host "ProductBuildId: $env:PRODUCTBUILDID" + if (-not $HostRid) { if (Test-Path Variable:/IsCoreCLR) { $HostRid = if ($IsWindows) { 'win-x64' } ` @@ -89,6 +92,8 @@ try { $ProdConManifestUrl = "https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/product/cli/$ProcConChannel/build.xml" } + Write-Host "ProdConManifestUrl: $ProdConManifestUrl" + [xml] $prodConManifest = Invoke-RestMethod $ProdConManifestUrl $RestoreSources = $prodConManifest.OrchestratedBuild.Endpoint ` @@ -106,7 +111,9 @@ try { Write-Error "Missing required parameter: AssetRootUrl" } $AssetRootUrl = $AssetRootUrl.TrimEnd('/') - [xml] $cli = Invoke-RestMethod "$AssetRootUrl/orchestration-metadata/manifests/cli.xml${AccessTokenSuffix}" + $cliMetadataUrl = "$AssetRootUrl/orchestration-metadata/manifests/cli.xml${AccessTokenSuffix}" + Write-Host "CliMetadataUrl: $cliMetadataUrl" + [xml] $cli = Invoke-RestMethod $cliMetadataUrl $sdkVersion = $cli.Build.ProductVersion } From a6847de87da2a1c1387f6e77667a0021d6e770e4 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Wed, 26 Sep 2018 09:53:31 -0700 Subject: [PATCH 11/14] Fix PipeBuild parameter: PB_RESTORESOURCES => PB_RESTORESOURCE --- test/Cli.FunctionalTests/run-tests.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Cli.FunctionalTests/run-tests.ps1 b/test/Cli.FunctionalTests/run-tests.ps1 index 2c0f77cff8..d3414317d5 100644 --- a/test/Cli.FunctionalTests/run-tests.ps1 +++ b/test/Cli.FunctionalTests/run-tests.ps1 @@ -35,7 +35,7 @@ param( [switch]$ci, $AssetRootUrl = $env:PB_ASSETROOTURL, $AccessTokenSuffix = $env:PB_ACCESSTOKENSUFFIX, - $RestoreSources = $env:PB_RESTORESOURCES, + $RestoreSources = $env:PB_RESTORESOURCE, [ValidateSet('none', 'osx-x64', 'linux-x64', 'win-x64')] $TestRuntimeIdentifier, $HostRid, @@ -112,7 +112,7 @@ try { } $AssetRootUrl = $AssetRootUrl.TrimEnd('/') $cliMetadataUrl = "$AssetRootUrl/orchestration-metadata/manifests/cli.xml${AccessTokenSuffix}" - Write-Host "CliMetadataUrl: $cliMetadataUrl" + Write-Host "CliMetadataUrl: $cliMetadataUrl" [xml] $cli = Invoke-RestMethod $cliMetadataUrl $sdkVersion = $cli.Build.ProductVersion } From aa72dc6682dcece67e55c7cf3bbb6fad96309b72 Mon Sep 17 00:00:00 2001 From: "ASP.NET CI" Date: Wed, 26 Sep 2018 10:19:50 -0700 Subject: [PATCH 12/14] Updating submodule(s) Mvc => 831937c86c897da146edfee8ba7f7790aa5cb991 Scaffolding => de6434aa771605d944428ab59766fd9f8c999e58 [auto-updated: submodules] --- modules/Mvc | 2 +- modules/Scaffolding | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/Mvc b/modules/Mvc index 50cef4822a..831937c86c 160000 --- a/modules/Mvc +++ b/modules/Mvc @@ -1 +1 @@ -Subproject commit 50cef4822a5fda5490896818377a15611246f703 +Subproject commit 831937c86c897da146edfee8ba7f7790aa5cb991 diff --git a/modules/Scaffolding b/modules/Scaffolding index ea215bfc1d..de6434aa77 160000 --- a/modules/Scaffolding +++ b/modules/Scaffolding @@ -1 +1 @@ -Subproject commit ea215bfc1d35bda5e2b52cb566ff05ad3965b01c +Subproject commit de6434aa771605d944428ab59766fd9f8c999e58 From a624afdf8e6019dd4c23ce84f58147714b2bd652 Mon Sep 17 00:00:00 2001 From: Mike Harder Date: Wed, 26 Sep 2018 10:51:03 -0700 Subject: [PATCH 13/14] Functional tests for .NET Core CLI 2.1.X (#1415) --- .vsts/builds/e2e-tests.yml | 58 +++ test/Cli.FunctionalTests/AssemblyInfo.cs | 26 ++ .../Cli.FunctionalTests.csproj | 21 + .../Cli.FunctionalTests.sln | 30 ++ .../Cli.FunctionalTests/Directory.Build.props | 2 + test/Cli.FunctionalTests/Directory.Build.rsp | 0 .../Directory.Build.targets | 2 + test/Cli.FunctionalTests/NuGet.config | 6 + .../Cli.FunctionalTests/NuGetPackageSource.cs | 57 +++ test/Cli.FunctionalTests/README.md | 5 + test/Cli.FunctionalTests/RuntimeIdentifier.cs | 55 +++ test/Cli.FunctionalTests/TemplateTests.cs | 220 ++++++++++ .../Templates/AngularTemplate.cs | 46 +++ .../Templates/ClassLibraryTemplate.cs | 48 +++ .../Templates/ConsoleApplicationTemplate.cs | 375 ++++++++++++++++++ .../Templates/MvcTemplate.cs | 35 ++ .../Templates/RazorApplicationBaseTemplate.cs | 61 +++ .../Templates/RazorBootstrapJQueryTemplate.cs | 60 +++ .../Templates/RazorClassLibraryTemplate.cs | 359 +++++++++++++++++ .../Templates/RazorTemplate.cs | 35 ++ .../Templates/RazorUtil.cs | 39 ++ .../Templates/ReactReduxTemplate.cs | 12 + .../Templates/ReactTemplate.cs | 45 +++ .../Templates/SpaBaseTemplate.cs | 21 + .../Cli.FunctionalTests/Templates/Template.cs | 248 ++++++++++++ .../Templates/TemplateType.cs | 12 + .../Templates/WebApiTemplate.cs | 25 ++ .../Templates/WebTemplate.cs | 227 +++++++++++ .../Util/ConcurrentStringBuilder.cs | 37 ++ test/Cli.FunctionalTests/Util/DotNetUtil.cs | 243 ++++++++++++ test/Cli.FunctionalTests/Util/IOUtil.cs | 85 ++++ .../Cli.FunctionalTests/Util/ProcessHelper.cs | 113 ++++++ test/Cli.FunctionalTests/run-tests.ps1 | 169 ++++++++ test/Cli.FunctionalTests/test.sh | 3 + 34 files changed, 2780 insertions(+) create mode 100644 .vsts/builds/e2e-tests.yml create mode 100644 test/Cli.FunctionalTests/AssemblyInfo.cs create mode 100644 test/Cli.FunctionalTests/Cli.FunctionalTests.csproj create mode 100644 test/Cli.FunctionalTests/Cli.FunctionalTests.sln create mode 100644 test/Cli.FunctionalTests/Directory.Build.props create mode 100644 test/Cli.FunctionalTests/Directory.Build.rsp create mode 100644 test/Cli.FunctionalTests/Directory.Build.targets create mode 100644 test/Cli.FunctionalTests/NuGet.config create mode 100644 test/Cli.FunctionalTests/NuGetPackageSource.cs create mode 100644 test/Cli.FunctionalTests/README.md create mode 100644 test/Cli.FunctionalTests/RuntimeIdentifier.cs create mode 100644 test/Cli.FunctionalTests/TemplateTests.cs create mode 100644 test/Cli.FunctionalTests/Templates/AngularTemplate.cs create mode 100644 test/Cli.FunctionalTests/Templates/ClassLibraryTemplate.cs create mode 100644 test/Cli.FunctionalTests/Templates/ConsoleApplicationTemplate.cs create mode 100644 test/Cli.FunctionalTests/Templates/MvcTemplate.cs create mode 100644 test/Cli.FunctionalTests/Templates/RazorApplicationBaseTemplate.cs create mode 100644 test/Cli.FunctionalTests/Templates/RazorBootstrapJQueryTemplate.cs create mode 100644 test/Cli.FunctionalTests/Templates/RazorClassLibraryTemplate.cs create mode 100644 test/Cli.FunctionalTests/Templates/RazorTemplate.cs create mode 100644 test/Cli.FunctionalTests/Templates/RazorUtil.cs create mode 100644 test/Cli.FunctionalTests/Templates/ReactReduxTemplate.cs create mode 100644 test/Cli.FunctionalTests/Templates/ReactTemplate.cs create mode 100644 test/Cli.FunctionalTests/Templates/SpaBaseTemplate.cs create mode 100644 test/Cli.FunctionalTests/Templates/Template.cs create mode 100644 test/Cli.FunctionalTests/Templates/TemplateType.cs create mode 100644 test/Cli.FunctionalTests/Templates/WebApiTemplate.cs create mode 100644 test/Cli.FunctionalTests/Templates/WebTemplate.cs create mode 100644 test/Cli.FunctionalTests/Util/ConcurrentStringBuilder.cs create mode 100644 test/Cli.FunctionalTests/Util/DotNetUtil.cs create mode 100644 test/Cli.FunctionalTests/Util/IOUtil.cs create mode 100644 test/Cli.FunctionalTests/Util/ProcessHelper.cs create mode 100644 test/Cli.FunctionalTests/run-tests.ps1 create mode 100644 test/Cli.FunctionalTests/test.sh diff --git a/.vsts/builds/e2e-tests.yml b/.vsts/builds/e2e-tests.yml new file mode 100644 index 0000000000..6019a47184 --- /dev/null +++ b/.vsts/builds/e2e-tests.yml @@ -0,0 +1,58 @@ +trigger: none +phases: +- phase: Host_Windows + queue: + name: DotNetCore-Windows + parallel: 4 + matrix: + Portable: + Test.RuntimeIdentifier: none + SelfContainedWindows: + Test.RuntimeIdentifier: win-x64 + SelfContainedLinux: + Test.RuntimeIdentifier: linux-x64 + SelfContainedMacOs: + Test.RuntimeIdentifier: osx-x64 + steps: + - task: NodeTool@0 + displayName: Install Node 10.x + inputs: + versionSpec: 10.x + - powershell: | + test/Cli.FunctionalTests/run-tests.ps1 -ci -ProdConManifestUrl $env:PRODCONMANIFESTURL -TestRuntimeIdentifier $(Test.RuntimeIdentifier) + 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' +- phase: Host_macOS + queue: + name: Hosted macOS Preview + parallel: 4 + matrix: + Portable: + Test.RuntimeIdentifier: none + SelfContainedWindows: + Test.RuntimeIdentifier: win-x64 + SelfContainedLinux: + Test.RuntimeIdentifier: linux-x64 + SelfContainedMacOs: + Test.RuntimeIdentifier: osx-x64 + steps: + - task: NodeTool@0 + displayName: Install Node 8.x + inputs: + versionSpec: 8.x + - powershell: | + test/Cli.FunctionalTests/run-tests.ps1 -ci -ProdConManifestUrl $env:PRODCONMANIFESTURL -TestRuntimeIdentifier $(Test.RuntimeIdentifier) + 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' diff --git a/test/Cli.FunctionalTests/AssemblyInfo.cs b/test/Cli.FunctionalTests/AssemblyInfo.cs new file mode 100644 index 0000000000..cbe539e977 --- /dev/null +++ b/test/Cli.FunctionalTests/AssemblyInfo.cs @@ -0,0 +1,26 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using Cli.FunctionalTests.Util; +using NUnit.Framework; + +// Run all test cases in parallel +[assembly: Parallelizable(ParallelScope.Children)] + +[SetUpFixture] +public class AssemblySetUp +{ + public static string TempDir { get; private set; } + + [OneTimeSetUp] + public void SetUp() + { + TempDir = IOUtil.GetTempDir(); + } + + [OneTimeTearDown] + public void TearDown() + { + IOUtil.DeleteDir(TempDir); + } +} diff --git a/test/Cli.FunctionalTests/Cli.FunctionalTests.csproj b/test/Cli.FunctionalTests/Cli.FunctionalTests.csproj new file mode 100644 index 0000000000..385a9dde2a --- /dev/null +++ b/test/Cli.FunctionalTests/Cli.FunctionalTests.csproj @@ -0,0 +1,21 @@ + + + + netcoreapp2.1 + false + latest + + https://api.nuget.org/v3/index.json; + $(DotNetRestoreSources) + + + + + + + + + + + + diff --git a/test/Cli.FunctionalTests/Cli.FunctionalTests.sln b/test/Cli.FunctionalTests/Cli.FunctionalTests.sln new file mode 100644 index 0000000000..42f7f90f69 --- /dev/null +++ b/test/Cli.FunctionalTests/Cli.FunctionalTests.sln @@ -0,0 +1,30 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28016.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cli.FunctionalTests", "Cli.FunctionalTests.csproj", "{D44EA496-EF83-4D47-8C45-4DAF5A1B0070}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0EC88B4E-B1F2-4183-9EBF-BF66C45D19D7}" + ProjectSection(SolutionItems) = preProject + ..\..\.vsts\builds\e2e-tests.yml = ..\..\.vsts\builds\e2e-tests.yml + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D44EA496-EF83-4D47-8C45-4DAF5A1B0070}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D44EA496-EF83-4D47-8C45-4DAF5A1B0070}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D44EA496-EF83-4D47-8C45-4DAF5A1B0070}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D44EA496-EF83-4D47-8C45-4DAF5A1B0070}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {70432DA7-DCE4-4F73-A00C-E1AB180DDD6A} + EndGlobalSection +EndGlobal diff --git a/test/Cli.FunctionalTests/Directory.Build.props b/test/Cli.FunctionalTests/Directory.Build.props new file mode 100644 index 0000000000..6d087b3032 --- /dev/null +++ b/test/Cli.FunctionalTests/Directory.Build.props @@ -0,0 +1,2 @@ + + diff --git a/test/Cli.FunctionalTests/Directory.Build.rsp b/test/Cli.FunctionalTests/Directory.Build.rsp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/Cli.FunctionalTests/Directory.Build.targets b/test/Cli.FunctionalTests/Directory.Build.targets new file mode 100644 index 0000000000..6d087b3032 --- /dev/null +++ b/test/Cli.FunctionalTests/Directory.Build.targets @@ -0,0 +1,2 @@ + + diff --git a/test/Cli.FunctionalTests/NuGet.config b/test/Cli.FunctionalTests/NuGet.config new file mode 100644 index 0000000000..4bb3170917 --- /dev/null +++ b/test/Cli.FunctionalTests/NuGet.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/test/Cli.FunctionalTests/NuGetPackageSource.cs b/test/Cli.FunctionalTests/NuGetPackageSource.cs new file mode 100644 index 0000000000..30545f8ca5 --- /dev/null +++ b/test/Cli.FunctionalTests/NuGetPackageSource.cs @@ -0,0 +1,57 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Linq; + +namespace Cli.FunctionalTests +{ + public class NuGetPackageSource + { + public static NuGetPackageSource None { get; } = new NuGetPackageSource + { + Name = nameof(None), + SourceArgumentLazy = new Lazy(string.Empty), + }; + + public static NuGetPackageSource NuGetOrg { get; } = new NuGetPackageSource + { + Name = nameof(NuGetOrg), + SourceArgumentLazy = new Lazy("--source https://api.nuget.org/v3/index.json"), + }; + + public static NuGetPackageSource DotNetCore { get; } = new NuGetPackageSource + { + Name = nameof(DotNetCore), + SourceArgumentLazy = new Lazy("--source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json"), + }; + + public static NuGetPackageSource EnvironmentVariable { get; } = new NuGetPackageSource + { + Name = nameof(EnvironmentVariable), + SourceArgumentLazy = new Lazy(() => GetSourceArgumentFromEnvironment()), + }; + + public static NuGetPackageSource EnvironmentVariableAndNuGetOrg { get; } = new NuGetPackageSource + { + Name = nameof(EnvironmentVariableAndNuGetOrg), + SourceArgumentLazy = new Lazy(() => string.Join(" ", EnvironmentVariable.SourceArgument, NuGetOrg.SourceArgument)), + }; + + private NuGetPackageSource() { } + + public string Name { get; private set; } + public string SourceArgument => SourceArgumentLazy.Value; + private Lazy SourceArgumentLazy { get; set; } + + public override string ToString() => Name; + + private static string GetSourceArgumentFromEnvironment() + { + var sourceString = Environment.GetEnvironmentVariable("NUGET_PACKAGE_SOURCE") ?? + throw new InvalidOperationException("Environment variable NUGET_PACKAGE_SOURCE is required but not set"); + + return string.Join(" ", sourceString.Split(',').Select(s => $"--source {s}")); + } + } +} diff --git a/test/Cli.FunctionalTests/README.md b/test/Cli.FunctionalTests/README.md new file mode 100644 index 0000000000..4587c251c1 --- /dev/null +++ b/test/Cli.FunctionalTests/README.md @@ -0,0 +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. diff --git a/test/Cli.FunctionalTests/RuntimeIdentifier.cs b/test/Cli.FunctionalTests/RuntimeIdentifier.cs new file mode 100644 index 0000000000..7e638a6935 --- /dev/null +++ b/test/Cli.FunctionalTests/RuntimeIdentifier.cs @@ -0,0 +1,55 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace Cli.FunctionalTests +{ + // https://docs.microsoft.com/en-us/dotnet/core/rid-catalog + public class RuntimeIdentifier + { + public static RuntimeIdentifier None = new RuntimeIdentifier() { + Name = "none", + OSPlatforms = new[] { OSPlatform.Linux, OSPlatform.OSX, OSPlatform.Windows, }, + }; + + public static RuntimeIdentifier Linux_x64 = new RuntimeIdentifier() { + Name = "linux-x64", + OSPlatforms = new[] { OSPlatform.Linux, }, + ExecutableFileExtension = string.Empty, + }; + + public static RuntimeIdentifier OSX_x64 = new RuntimeIdentifier() + { + Name = "osx-x64", + OSPlatforms = new[] { OSPlatform.OSX, }, + ExecutableFileExtension = string.Empty, + }; + + public static RuntimeIdentifier Win_x64 = new RuntimeIdentifier() + { + Name = "win-x64", + OSPlatforms = new[] { OSPlatform.Windows, }, + ExecutableFileExtension = ".exe", + }; + + public static IEnumerable All = new[] + { + RuntimeIdentifier.None, + RuntimeIdentifier.Linux_x64, + RuntimeIdentifier.OSX_x64, + RuntimeIdentifier.Win_x64, + }; + + private RuntimeIdentifier() { } + + public string Name { get; private set; } + public string RuntimeArgument => (this == None) ? string.Empty : $"--runtime {Name}"; + public string Path => (this == None) ? string.Empty : Name; + public IEnumerable OSPlatforms { get; private set; } + public string ExecutableFileExtension { get; private set; } + + public override string ToString() => Name; + } +} diff --git a/test/Cli.FunctionalTests/TemplateTests.cs b/test/Cli.FunctionalTests/TemplateTests.cs new file mode 100644 index 0000000000..7e8143114f --- /dev/null +++ b/test/Cli.FunctionalTests/TemplateTests.cs @@ -0,0 +1,220 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Runtime.InteropServices; +using Cli.FunctionalTests.Templates; +using Cli.FunctionalTests.Util; +using NuGet.Versioning; +using NUnit.Framework; + +namespace Cli.FunctionalTests +{ + [TestFixture] + public class TemplateTests + { + [Test] + [TestCaseSource(nameof(RestoreData))] + public void _1_Restore(Template template) + { + var expected = template.ExpectedObjFilesAfterRestore; + var actual = template.ObjFilesAfterRestore; + CollectionAssert.AreEquivalent(expected, actual); + } + + [Test] + [TestCaseSource(nameof(RestoreData))] + public void _2_RestoreIncremental(Template template) + { + var expected = template.ExpectedObjFilesAfterRestore; + var actual = template.ObjFilesAfterRestoreIncremental; + CollectionAssert.AreEquivalent(expected, actual); + } + + [Test] + [TestCaseSource(nameof(BuildData))] + public void _3_Build(Template template) + { + var expectedObj = template.ExpectedObjFilesAfterBuild; + var actualObj = template.ObjFilesAfterBuild; + CollectionAssert.AreEquivalent(expectedObj, actualObj); + + var expectedBin = template.ExpectedBinFilesAfterBuild; + var actualBin = template.BinFilesAfterBuild; + CollectionAssert.AreEquivalent(expectedBin, actualBin); + } + + [Test] + [TestCaseSource(nameof(BuildData))] + public void _4_BuildIncremental(Template template) + { + var expectedObj = template.ExpectedObjFilesAfterBuild; + var actualObj = template.ObjFilesAfterBuildIncremental; + CollectionAssert.AreEquivalent(expectedObj, actualObj); + + var expectedBin = template.ExpectedBinFilesAfterBuild; + var actualBin = template.BinFilesAfterBuildIncremental; + CollectionAssert.AreEquivalent(expectedBin, actualBin); + } + + [Test] + [TestCaseSource(nameof(RunData))] + public void _5_Run(Template template) + { + var statusCode = template.HttpResponseAfterRun.StatusCode; + Assert.AreEqual(HttpStatusCode.OK, statusCode, + GetMessage(statusCode, template.ServerOutputAfterRun, template.ServerErrorAfterRun)); + + statusCode = template.HttpsResponseAfterRun.StatusCode; + Assert.AreEqual(HttpStatusCode.OK, statusCode, + GetMessage(statusCode, template.ServerOutputAfterRun, template.ServerErrorAfterRun)); + } + + [NonParallelizable] + [Test] + [TestCaseSource(nameof(RunNonParallelizableData))] + public void _5_RunNonParallelizable(Template template) + { + _5_Run(template); + } + + [Test] + [TestCaseSource(nameof(PublishData))] + public void _6_Publish(Template template) + { + var expected = template.ExpectedFilesAfterPublish; + var actual = template.FilesAfterPublish; + CollectionAssert.AreEquivalent(expected, actual); + } + + [Test] + [TestCaseSource(nameof(PublishData))] + public void _7_PublishIncremental(Template template) + { + var expected = template.ExpectedFilesAfterPublish; + var actual = template.FilesAfterPublishIncremental; + CollectionAssert.AreEquivalent(expected, actual); + } + + [Test] + [TestCaseSource(nameof(ExecData))] + public void _8_Exec(Template template) + { + var statusCode = template.HttpResponseAfterExec.StatusCode; + Assert.AreEqual(HttpStatusCode.OK, statusCode, + GetMessage(statusCode, template.ServerOutputAfterExec, template.ServerErrorAfterExec)); + + statusCode = template.HttpsResponseAfterExec.StatusCode; + Assert.AreEqual(HttpStatusCode.OK, statusCode, + GetMessage(statusCode, template.ServerOutputAfterExec, template.ServerErrorAfterExec)); + } + + private static string GetMessage(HttpStatusCode statusCode, string serverOutput, string serverError) + { + return String.Join(Environment.NewLine, + $"StatusCode: {statusCode}", + string.Empty, + "ServerOutput", + "------------", + serverOutput, + string.Empty, + "ServerError", + "------------", + serverError); + } + + private static IEnumerable