Install site extension on top of existing dotnet (#97)
This commit is contained in:
parent
9e72cb0783
commit
b53a6f9a25
|
|
@ -10,12 +10,17 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<DotNetCoreSdk Include="coherent" Channel="master" InstallDir="$(SiteExtensionWorkingDirectory)" Arch="x86" Condition="'$(AntaresSiteExtension)' != ''"/>
|
||||
<DotNetCoreSdk Include="coherent" Channel="master" InstallDir="$(TestDotNetPath)latest\" Condition="'$(AntaresTests)' != ''"/>
|
||||
<DotNetCoreSdk Include="2.0.0" InstallDir="$(TestDotNetPath)2.0\" Condition="'$(AntaresTests)' != ''"/>
|
||||
<DotNetCoreSdk Include="coherent" Channel="master" InstallDir="$(TestDotNetPath)latest\" Condition="'$(AntaresTests)' != ''"/>
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="BuildSiteExtension" DependsOnTargets="InstallDotNet">
|
||||
<Target Name="_AddSiteExtensionRuntimes">
|
||||
<ItemGroup>
|
||||
<DotNetCoreSdk Include="coherent" Channel="master" InstallDir="$(SiteExtensionWorkingDirectory)" Arch="x86" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="BuildSiteExtension" DependsOnTargets="_AddSiteExtensionRuntimes;InstallDotNet">
|
||||
|
||||
<PropertyGroup>
|
||||
<CliVersionRelativePath>build\dotnet.version</CliVersionRelativePath>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
<ItemGroup>
|
||||
<Content Include="applicationHost.xdt" />
|
||||
<Content Include="install.cmd" />
|
||||
<Content Include="$(OutputPath)\Microsoft.Web.Xdt.Extensions.dll" PackagePath="content" />
|
||||
<Content Include="$(DotnetHomeDirectory)**\*.*" Exclude="$(DotnetHomeDirectory)**\nuGetPackagesArchive.lzma" Condition="$(DotnetHomeDirectory) != ''" PackagePath="content\%(RecursiveDir)%(FileName)%(Extension)" />
|
||||
</ItemGroup>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
SET DOTNET=D:\Program Files (x86)\dotnet
|
||||
SET RUNTIMES=%DOTNET%\shared\Microsoft.NETCore.App
|
||||
robocopy "%DOTNET%" "." /E /XC /XN /XO /NFL /NDL ^
|
||||
/XD "%DOTNET%\sdk" ^
|
||||
/XD "%RUNTIMES%\1.0.3" ^
|
||||
/XD "%RUNTIMES%\1.0.4" ^
|
||||
/XD "%RUNTIMES%\1.1.0" ^
|
||||
/XD "%RUNTIMES%\1.1.0-preview1-001100-00" ^
|
||||
/XD "%RUNTIMES%\1.1.1" ^
|
||||
/XD "%RUNTIMES%\2.0.0-preview1-002111-00" ^
|
||||
/XD "%RUNTIMES%\2.0.0-preview2-25407-01"
|
||||
|
||||
if %errorlevel% geq 8 exit /b 1
|
||||
exit /b 0
|
||||
|
|
@ -18,6 +18,7 @@ using Microsoft.Extensions.Logging;
|
|||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Microsoft.Rest;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OperatingSystem = Microsoft.Azure.Management.AppService.Fluent.OperatingSystem;
|
||||
|
||||
namespace Microsoft.AspNetCore.AzureAppServices.FunctionalTests
|
||||
{
|
||||
|
|
@ -64,7 +65,8 @@ namespace Microsoft.AspNetCore.AzureAppServices.FunctionalTests
|
|||
Plan = Azure.AppServices.AppServicePlans.Define(servicePlanName)
|
||||
.WithRegion(Region.USWest2)
|
||||
.WithExistingResourceGroup(ResourceGroup)
|
||||
.WithFreePricingTier()
|
||||
.WithPricingTier(PricingTier.BasicB1)
|
||||
.WithOperatingSystem(OperatingSystem.Windows)
|
||||
.Create();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
<Project>
|
||||
</Project>
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
<None Include="Templates\*.*" CopyToOutputDirectory="PreserveNewest" />
|
||||
<ContentWithTargetPath Include="NuGet.config.template" CopyToOutputDirectory="PreserveNewest" TargetPath="NuGet.config" />
|
||||
<ContentWithTargetPath Include="global.json.template" CopyToOutputDirectory="PreserveNewest" TargetPath="global.json" />
|
||||
<ContentWithTargetPath Include="Directory.Build.props.template" CopyToOutputDirectory="PreserveNewest" TargetPath="Directory.Build.props" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
Running functional tests locally:
|
||||
|
||||
1. Set following environment variables:
|
||||
-. `SiteExtensionFeed` - feed where site extension is published
|
||||
-. `APIKEY` - Nuget API key for extension publish feed
|
||||
-. `AZURE_AUTH_CLIENT_ID` - Azure service principal client id
|
||||
-. `AZURE_AUTH_CLIENT_SECRET` - Azure service principal client secret
|
||||
-. `AZURE_AUTH_TENANT` - Azure service principal tenant
|
||||
-. See https://github.com/Azure/azure-sdk-for-net/blob/Fluent/AUTH.md on how to create service principal
|
||||
|
||||
2. Run `.\build /t:BuildSiteExtension /t:PushSiteExtension` to build and push site extension
|
||||
2. Run `.\build /t:Test /p:AntaresTests=true` to run tests using the site extension
|
||||
|
|
@ -34,49 +34,15 @@ namespace Microsoft.AspNetCore.AzureAppServices.FunctionalTests
|
|||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("web", "Hello World!")]
|
||||
[InlineData("razor", "Learn how to build ASP.NET apps that can run anywhere.")]
|
||||
[InlineData("mvc", "Learn how to build ASP.NET apps that can run anywhere.")]
|
||||
public async Task DotnetNewWebRunsInWebApp(string template, string expected)
|
||||
[InlineData("2.0", "web", "Hello World!")]
|
||||
[InlineData("2.0", "razor", "Learn how to build ASP.NET apps that can run anywhere.")]
|
||||
[InlineData("2.0", "mvc", "Learn how to build ASP.NET apps that can run anywhere.")]
|
||||
[InlineData("latest", "web", "Hello World!")]
|
||||
[InlineData("latest", "razor", "Learn how to build ASP.NET apps that can run anywhere.")]
|
||||
[InlineData("latest", "mvc", "Learn how to build ASP.NET apps that can run anywhere.")]
|
||||
public async Task DotnetNewWebRunsWebAppOnLatestRuntime(string dotnetVersion, string template, string expected)
|
||||
{
|
||||
var testId = nameof(DotnetNewWebRunsInWebApp) + template;
|
||||
|
||||
using (var logger = GetLogger(testId))
|
||||
{
|
||||
var site = await _fixture.Deploy("Templates\\BasicAppServices.json", baseName: testId);
|
||||
var testDirectory = GetTestDirectory(testId);
|
||||
var dotnet = DotNet(logger, testDirectory, "2.0");
|
||||
|
||||
await dotnet.ExecuteAndAssertAsync("new " + template);
|
||||
|
||||
InjectMiddlware(testDirectory, RuntimeInformationMiddlewareType, RuntimeInformationMiddlewareFile);
|
||||
|
||||
await site.BuildPublishProfileAsync(testDirectory.FullName);
|
||||
|
||||
await dotnet.ExecuteAndAssertAsync("publish /p:PublishProfile=Profile");
|
||||
|
||||
using (var httpClient = site.CreateClient())
|
||||
{
|
||||
var getResult = await httpClient.GetAsync("/");
|
||||
getResult.EnsureSuccessStatusCode();
|
||||
Assert.Contains(expected, await getResult.Content.ReadAsStringAsync());
|
||||
|
||||
getResult = await httpClient.GetAsync("/runtimeInfo");
|
||||
getResult.EnsureSuccessStatusCode();
|
||||
|
||||
var runtimeInfo = JsonConvert.DeserializeObject<RuntimeInfo>(await getResult.Content.ReadAsStringAsync());
|
||||
ValidateRuntimeInfo(runtimeInfo, dotnet.Command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("web", "Hello World!")]
|
||||
[InlineData("razor", "Learn how to build ASP.NET apps that can run anywhere.")]
|
||||
[InlineData("mvc", "Learn how to build ASP.NET apps that can run anywhere.")]
|
||||
public async Task DotnetNewWebRunsWebAppOnLatestRuntime(string template, string expected)
|
||||
{
|
||||
var testId = nameof(DotnetNewWebRunsWebAppOnLatestRuntime) + template;
|
||||
var testId = nameof(DotnetNewWebRunsWebAppOnLatestRuntime) + template + dotnetVersion.Replace('.', '_');
|
||||
|
||||
using (var logger = GetLogger(testId))
|
||||
{
|
||||
|
|
@ -90,7 +56,7 @@ namespace Microsoft.AspNetCore.AzureAppServices.FunctionalTests
|
|||
});
|
||||
|
||||
var testDirectory = GetTestDirectory(testId);
|
||||
var dotnet = DotNet(logger, testDirectory, "latest");
|
||||
var dotnet = DotNet(logger, testDirectory, dotnetVersion);
|
||||
|
||||
await dotnet.ExecuteAndAssertAsync("new " + template);
|
||||
|
||||
|
|
@ -98,8 +64,6 @@ namespace Microsoft.AspNetCore.AzureAppServices.FunctionalTests
|
|||
|
||||
FixAspNetCoreVersion(testDirectory, dotnet.Command);
|
||||
|
||||
await dotnet.ExecuteAndAssertAsync("restore");
|
||||
|
||||
await site.BuildPublishProfileAsync(testDirectory.FullName);
|
||||
|
||||
await dotnet.ExecuteAndAssertAsync("publish /p:PublishProfile=Profile");
|
||||
|
|
@ -198,21 +162,21 @@ namespace Microsoft.AspNetCore.AzureAppServices.FunctionalTests
|
|||
return new TestLogger(factory, factory.CreateLogger(callerName));
|
||||
}
|
||||
|
||||
private TestCommand DotNet(TestLogger logger, DirectoryInfo workingDirectory, string sufix)
|
||||
private TestCommand DotNet(TestLogger logger, DirectoryInfo workingDirectory, string suffix)
|
||||
{
|
||||
return new TestCommand(GetDotNetPath(sufix))
|
||||
return new TestCommand(GetDotNetPath(suffix))
|
||||
{
|
||||
Logger = logger,
|
||||
WorkingDirectory = workingDirectory.FullName
|
||||
};
|
||||
}
|
||||
|
||||
private static string GetDotNetPath(string sufix)
|
||||
private static string GetDotNetPath(string suffix)
|
||||
{
|
||||
var current = new DirectoryInfo(Directory.GetCurrentDirectory());
|
||||
while (current != null)
|
||||
{
|
||||
var dotnetSubdir = new DirectoryInfo(Path.Combine(current.FullName, ".test-dotnet", sufix));
|
||||
var dotnetSubdir = new DirectoryInfo(Path.Combine(current.FullName, ".test-dotnet", suffix));
|
||||
if (dotnetSubdir.Exists)
|
||||
{
|
||||
var dotnetName = Path.Combine(dotnetSubdir.FullName, "dotnet.exe");
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"siteName": {
|
||||
"type": "string"
|
||||
},
|
||||
"hostingPlanName": {
|
||||
"type": "string"
|
||||
},
|
||||
"resourceGroupName": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "2015-08-01",
|
||||
"name": "[parameters('siteName')]",
|
||||
"type": "Microsoft.Web/sites",
|
||||
"location": "West US 2",
|
||||
"properties": {
|
||||
"serverFarmId": "[resourceId(parameters('resourceGroupName'), 'Microsoft.Web/serverFarms', parameters('hostingPlanName'))]"
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"siteId": {
|
||||
"type": "string",
|
||||
"value": "[resourceId(parameters('resourceGroupName'), 'Microsoft.Web/sites', parameters('siteName'))]"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue