Fixing IIS variations
This commit is contained in:
parent
76d0d56b5d
commit
64977e14a9
|
|
@ -4,14 +4,13 @@ using Microsoft.AspNet.Testing.xunit;
|
|||
namespace DeploymentHelpers
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
|
||||
public class SkipIfNativeModuleNotInstalledAttribute : Attribute, ITestCondition
|
||||
public class SkipIfIISNativeVariationsNotEnabledAttribute : Attribute, ITestCondition
|
||||
{
|
||||
public bool IsMet
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO: Need a better way to detect native module on the machine.
|
||||
return Environment.GetEnvironmentVariable("IIS_NATIVE_MODULE_SETUP") == "true";
|
||||
return Environment.GetEnvironmentVariable("IIS_NATIVE_VARIATIONS_ENABLED") == "true";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -19,8 +18,8 @@ namespace DeploymentHelpers
|
|||
{
|
||||
get
|
||||
{
|
||||
return "Skipping Native module test since native module is not installed on IIS. " +
|
||||
"To run the test, setup the native module and set the environment variable IIS_NATIVE_MODULE_SETUP=true.";
|
||||
return "Skipping Native module test since native module variations are not enabled. " +
|
||||
"To run the test, setup the native module and set the environment variable IIS_NATIVE_VARIATIONS_ENABLED=true.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using Microsoft.AspNet.Testing.xunit;
|
||||
|
||||
namespace DeploymentHelpers
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
|
||||
public class SkipIfIISVariationsNotEnabledAttribute : Attribute, ITestCondition
|
||||
{
|
||||
public bool IsMet
|
||||
{
|
||||
get
|
||||
{
|
||||
return Environment.GetEnvironmentVariable("IIS_VARIATIONS_ENABLED") == "true";
|
||||
}
|
||||
}
|
||||
|
||||
public string SkipReason
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Skipping IIS variation of tests. " +
|
||||
"To run the IIS variations, setup IIS and set the environment variable IIS_VARIATIONS_ENABLED=true.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using DeploymentHelpers;
|
||||
using Microsoft.Framework.Logging;
|
||||
|
||||
|
|
@ -22,14 +20,18 @@ namespace E2ETests
|
|||
return Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "src", "MusicStore"));
|
||||
}
|
||||
|
||||
public static void SetInMemoryStoreForIIS(DeploymentParameters startParameters, ILogger logger)
|
||||
public static void SetInMemoryStoreForIIS(DeploymentParameters deploymentParameters, ILogger logger)
|
||||
{
|
||||
if (startParameters.ServerType == ServerType.IIS
|
||||
|| startParameters.ServerType == ServerType.IISNativeModule)
|
||||
if (deploymentParameters.ServerType == ServerType.IIS
|
||||
|| deploymentParameters.ServerType == ServerType.IISNativeModule)
|
||||
{
|
||||
// Can't use localdb with IIS. Setting an override to use InMemoryStore.
|
||||
logger.LogInformation("Creating configoverride.json file to override default config.");
|
||||
var overrideConfig = Path.Combine(startParameters.ApplicationPath, "..", "approot", "src", "MusicStore", "configoverride.json");
|
||||
|
||||
var overrideConfig = deploymentParameters.PublishWithNoSource ?
|
||||
Path.Combine(deploymentParameters.ApplicationPath, "..", "approot", "packages", "MusicStore", "1.0.0", "root", "configoverride.json") :
|
||||
Path.Combine(deploymentParameters.ApplicationPath, "..", "approot", "src", "MusicStore", "configoverride.json");
|
||||
|
||||
overrideConfig = Path.GetFullPath(overrideConfig);
|
||||
File.WriteAllText(overrideConfig, "{\"UseInMemoryStore\": \"true\"}");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,10 +65,10 @@ namespace E2ETests
|
|||
}
|
||||
}
|
||||
|
||||
public class SmokeTests_OnIIS
|
||||
public class SmokeTests_OnIIS_NativeModule
|
||||
{
|
||||
[ConditionalTheory(Skip = "IIS based tests not enabled"), Trait("E2Etests", "E2Etests")]
|
||||
[SkipIfNativeModuleNotInstalled]
|
||||
[ConditionalTheory, Trait("E2Etests", "E2Etests")]
|
||||
[SkipIfIISNativeVariationsNotEnabled]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.Mono)]
|
||||
[OSSkipCondition(OperatingSystems.Win7And2008R2 | OperatingSystems.MacOSX | OperatingSystems.Unix)]
|
||||
[SkipIfCurrentRuntimeIsCoreClr]
|
||||
|
|
@ -79,8 +79,8 @@ namespace E2ETests
|
|||
smokeTestRunner.SmokeTestSuite(serverType, runtimeFlavor, architecture, applicationBaseUrl);
|
||||
}
|
||||
|
||||
[ConditionalTheory(Skip = "IIS based tests not enabled"), Trait("E2Etests", "E2Etests")]
|
||||
[SkipIfNativeModuleNotInstalled]
|
||||
[ConditionalTheory, Trait("E2Etests", "E2Etests")]
|
||||
[SkipIfIISNativeVariationsNotEnabled]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.Mono)]
|
||||
[OSSkipCondition(OperatingSystems.Win7And2008R2 | OperatingSystems.MacOSX | OperatingSystems.Unix)]
|
||||
[SkipOn32BitOS]
|
||||
|
|
@ -91,22 +91,32 @@ namespace E2ETests
|
|||
var smokeTestRunner = new SmokeTests();
|
||||
smokeTestRunner.SmokeTestSuite(serverType, runtimeFlavor, architecture, applicationBaseUrl);
|
||||
}
|
||||
}
|
||||
|
||||
[ConditionalTheory(Skip = "IIS based tests not enabled"), Trait("E2Etests", "E2Etests")]
|
||||
public class SmokeTests_OnIIS
|
||||
{
|
||||
[ConditionalTheory, Trait("E2Etests", "E2Etests")]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.Mono)]
|
||||
[OSSkipCondition(OperatingSystems.MacOSX | OperatingSystems.Unix)]
|
||||
[SkipIfCurrentRuntimeIsCoreClr]
|
||||
[InlineData(ServerType.IIS, RuntimeFlavor.coreclr, RuntimeArchitecture.x86, "http://localhost:5013/")]
|
||||
[SkipIfIISVariationsNotEnabled]
|
||||
[InlineData(ServerType.IIS, RuntimeFlavor.clr, RuntimeArchitecture.x86, "http://localhost:5013/")]
|
||||
[InlineData(ServerType.IIS, RuntimeFlavor.coreclr, RuntimeArchitecture.x64, "http://localhost:5013/")]
|
||||
public void SmokeTestSuite_On_IIS_X86(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
|
||||
{
|
||||
var smokeTestRunner = new SmokeTests();
|
||||
smokeTestRunner.SmokeTestSuite(serverType, runtimeFlavor, architecture, applicationBaseUrl);
|
||||
smokeTestRunner.SmokeTestSuite(serverType, runtimeFlavor, architecture, applicationBaseUrl, noSource: true);
|
||||
}
|
||||
}
|
||||
|
||||
public class SmokeTests
|
||||
{
|
||||
public void SmokeTestSuite(ServerType serverType, RuntimeFlavor donetFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
|
||||
public void SmokeTestSuite(
|
||||
ServerType serverType,
|
||||
RuntimeFlavor donetFlavor,
|
||||
RuntimeArchitecture architecture,
|
||||
string applicationBaseUrl,
|
||||
bool noSource = false)
|
||||
{
|
||||
var logger = new LoggerFactory()
|
||||
.AddConsole()
|
||||
|
|
@ -127,9 +137,12 @@ namespace E2ETests
|
|||
{
|
||||
ApplicationBaseUriHint = applicationBaseUrl,
|
||||
EnvironmentName = "SocialTesting",
|
||||
PublishWithNoSource = noSource,
|
||||
UserAdditionalCleanup = parameters =>
|
||||
{
|
||||
if (!Helpers.RunningOnMono)
|
||||
if (!Helpers.RunningOnMono
|
||||
&& parameters.ServerType != ServerType.IIS
|
||||
&& parameters.ServerType != ServerType.IISNativeModule)
|
||||
{
|
||||
// Mono uses InMemoryStore
|
||||
DbUtils.DropDatabase(musicStoreDbName, logger);
|
||||
|
|
|
|||
Loading…
Reference in New Issue