Remove using environment variables for specifying tests. (#1410)
This commit is contained in:
parent
d463b5e613
commit
14aebebbaa
|
|
@ -1,7 +1,6 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
|
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
|
||||||
|
|
@ -41,19 +40,19 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionalTheory]
|
[ConditionalTheory]
|
||||||
[InlineData("ConsoleErrorWrite")]
|
[InlineData("ConsoleErrorWriteStartServer")]
|
||||||
[InlineData("ConsoleWrite")]
|
[InlineData("ConsoleWriteStartServer")]
|
||||||
public async Task CheckStdoutLoggingToPipeWithFirstWrite(string path)
|
public async Task CheckStdoutLoggingToPipeWithFirstWrite(string path)
|
||||||
{
|
{
|
||||||
var deploymentParameters = _fixture.GetBaseDeploymentParameters(publish: true);
|
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);
|
var deploymentResult = await DeployAsync(deploymentParameters);
|
||||||
|
|
||||||
await Helpers.AssertStarts(deploymentResult, path);
|
await Helpers.AssertStarts(deploymentResult);
|
||||||
|
|
||||||
StopServer();
|
StopServer();
|
||||||
|
|
||||||
|
|
@ -61,7 +60,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
||||||
{
|
{
|
||||||
// We can't read stdout logs from IIS as they aren't redirected.
|
// 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(firstWriteString));
|
||||||
Assert.Contains(TestSink.Writes, context => context.Message.Contains("TEST MESSAGE"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
|
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities;
|
||||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||||
|
|
|
||||||
|
|
@ -79,31 +79,33 @@ namespace TestSite
|
||||||
host.Run();
|
host.Run();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "ConsoleErrorWriteStartServer":
|
||||||
|
Console.Error.WriteLine("TEST MESSAGE");
|
||||||
|
return StartServer();
|
||||||
|
case "ConsoleWriteStartServer":
|
||||||
|
Console.WriteLine("TEST MESSAGE");
|
||||||
|
return StartServer();
|
||||||
default:
|
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;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue