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