Remove using environment variables for specifying tests. (#1410)

This commit is contained in:
Justin Kotalik 2018-09-21 08:26:20 -07:00 committed by GitHub
parent d463b5e613
commit 14aebebbaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 29 deletions

View File

@ -1,7 +1,6 @@
// 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.IO;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
@ -41,19 +40,19 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
}
[ConditionalTheory]
[InlineData("ConsoleErrorWrite")]
[InlineData("ConsoleWrite")]
[InlineData("ConsoleErrorWriteStartServer")]
[InlineData("ConsoleWriteStartServer")]
public async Task CheckStdoutLoggingToPipeWithFirstWrite(string path)
{
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
var firstWriteString = path + path;
var firstWriteString = "TEST MESSAGE";
deploymentParameters.WebConfigBasedEnvironmentVariables["ASPNETCORE_INPROCESS_INITIAL_WRITE"] = firstWriteString;
deploymentParameters.TransformArguments((a, _) => $"{a} {path}");
var deploymentResult = await DeployAsync(deploymentParameters);
await Helpers.AssertStarts(deploymentResult, path);
await Helpers.AssertStarts(deploymentResult);
StopServer();
@ -61,7 +60,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
{
// We can't read stdout logs from IIS as they aren't redirected.
Assert.Contains(TestSink.Writes, context => context.Message.Contains(firstWriteString));
Assert.Contains(TestSink.Writes, context => context.Message.Contains("TEST MESSAGE"));
}
}

View File

@ -3,7 +3,6 @@
using System;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
using Microsoft.AspNetCore.Server.IntegrationTesting;

View File

@ -79,31 +79,33 @@ namespace TestSite
host.Run();
}
break;
case "ConsoleErrorWriteStartServer":
Console.Error.WriteLine("TEST MESSAGE");
return StartServer();
case "ConsoleWriteStartServer":
Console.WriteLine("TEST MESSAGE");
return StartServer();
default:
{
return StartServer();
var envVariable = Environment.GetEnvironmentVariable("ASPNETCORE_INPROCESS_INITIAL_WRITE");
if (!string.IsNullOrEmpty(envVariable))
{
Console.WriteLine(envVariable);
Console.Error.WriteLine(envVariable);
}
var host = new WebHostBuilder()
.ConfigureLogging((_, factory) =>
{
factory.AddConsole();
factory.AddFilter("Console", level => level >= LogLevel.Information);
})
.UseIIS()
.UseStartup<Startup>()
.Build();
host.Run();
return 0;
}
}
return 12;
}
private static int StartServer()
{
var host = new WebHostBuilder()
.ConfigureLogging((_, factory) =>
{
factory.AddConsole();
factory.AddFilter("Console", level => level >= LogLevel.Information);
})
.UseIIS()
.UseStartup<Startup>()
.Build();
host.Run();
return 0;
}
}
}