diff --git a/test/ServerComparison.FunctionalTests/HelloWorldTest.cs b/test/ServerComparison.FunctionalTests/HelloWorldTest.cs
index 55cbe2a006..4575a7f370 100644
--- a/test/ServerComparison.FunctionalTests/HelloWorldTest.cs
+++ b/test/ServerComparison.FunctionalTests/HelloWorldTest.cs
@@ -38,10 +38,14 @@ namespace ServerComparison.FunctionalTests
var deploymentParameters = new DeploymentParameters(variant)
{
- ApplicationPath = Helpers.GetApplicationPath(),
- ServerConfigTemplateContent = Helpers.GetNginxConfigContent(variant.Server, "nginx.conf"),
+ ApplicationPath = Helpers.GetApplicationPath()
};
+ if (variant.Server == ServerType.Nginx)
+ {
+ deploymentParameters.ServerConfigTemplateContent = Helpers.GetNginxConfigContent("nginx.conf");
+ }
+
using (var deployer = IISApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
{
var deploymentResult = await deployer.DeployAsync();
diff --git a/test/ServerComparison.FunctionalTests/Helpers.cs b/test/ServerComparison.FunctionalTests/Helpers.cs
index 3e1ef3979d..5054bd157b 100644
--- a/test/ServerComparison.FunctionalTests/Helpers.cs
+++ b/test/ServerComparison.FunctionalTests/Helpers.cs
@@ -29,33 +29,10 @@ namespace ServerComparison.FunctionalTests
throw new Exception($"Solution root could not be found using {applicationBasePath}");
}
- public static string GetConfigContent(ServerType serverType, string iisConfig, string nginxConfig)
+ public static string GetNginxConfigContent(string nginxConfig)
{
var applicationBasePath = AppContext.BaseDirectory;
-
- string content = null;
- if (serverType == ServerType.IISExpress)
- {
- content = File.ReadAllText(Path.Combine(applicationBasePath, iisConfig));
- }
- else if (serverType == ServerType.Nginx)
- {
- content = File.ReadAllText(Path.Combine(applicationBasePath, nginxConfig));
- }
-
- return content;
- }
-
- public static string GetNginxConfigContent(ServerType serverType, string nginxConfig)
- {
- var applicationBasePath = AppContext.BaseDirectory;
-
- string content = null;
- if (serverType == ServerType.Nginx)
- {
- content = File.ReadAllText(Path.Combine(applicationBasePath, nginxConfig));
- }
-
+ var content = File.ReadAllText(Path.Combine(applicationBasePath, nginxConfig));
return content;
}
}
diff --git a/test/ServerComparison.FunctionalTests/NoCompression.config b/test/ServerComparison.FunctionalTests/NoCompression.config
deleted file mode 100644
index 9d9e0e6b42..0000000000
--- a/test/ServerComparison.FunctionalTests/NoCompression.config
+++ /dev/null
@@ -1,1026 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/test/ServerComparison.FunctionalTests/ResponseCompressionTests.cs b/test/ServerComparison.FunctionalTests/ResponseCompressionTests.cs
index 19e5fe9842..283f8286b2 100644
--- a/test/ServerComparison.FunctionalTests/ResponseCompressionTests.cs
+++ b/test/ServerComparison.FunctionalTests/ResponseCompressionTests.cs
@@ -9,7 +9,9 @@ using System.Net;
using System.Net.Http;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
+using System.Xml.Linq;
using Microsoft.AspNetCore.Server.IntegrationTesting;
+using Microsoft.AspNetCore.Server.IntegrationTesting.IIS;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
@@ -81,9 +83,9 @@ namespace ServerComparison.FunctionalTests
return ResponseCompression(variant, CheckAppCompressionAsync, hostCompression: true);
}
- private async Task ResponseCompression(TestVariant variant,
- Func scenario,
- bool hostCompression,
+ private async Task ResponseCompression(TestVariant variant,
+ Func scenario,
+ bool hostCompression,
[CallerMemberName] string testName = null)
{
testName = $"{testName}_{variant.Server}_{variant.Tfm}_{variant.Architecture}_{variant.ApplicationType}";
@@ -96,13 +98,37 @@ namespace ServerComparison.FunctionalTests
ApplicationPath = Helpers.GetApplicationPath(),
EnvironmentName = "ResponseCompression",
};
- if (hostCompression)
+
+ if (variant.Server == ServerType.Nginx)
{
- deploymentParameters.ServerConfigTemplateContent = Helpers.GetNginxConfigContent(variant.Server, "nginx.conf");
+ deploymentParameters.ServerConfigTemplateContent = hostCompression
+ ? Helpers.GetNginxConfigContent("nginx.conf")
+ : Helpers.GetNginxConfigContent("NoCompression.conf");
}
- else
+ else if (variant.Server == ServerType.IISExpress && !hostCompression)
{
- deploymentParameters.ServerConfigTemplateContent = Helpers.GetConfigContent(variant.Server, "NoCompression.config", "NoCompression.conf");
+ var iisDeploymentParameters = new IISDeploymentParameters(deploymentParameters);
+ iisDeploymentParameters.ServerConfigActionList.Add(
+ (element, _) => {
+ var compressionElement = element
+ .RequiredElement("system.webServer")
+ .RequiredElement("httpCompression");
+
+ compressionElement
+ .RequiredElement("dynamicTypes")
+ .Elements()
+ .SkipLast(1)
+ .Remove();
+
+ compressionElement
+ .RequiredElement("staticTypes")
+ .Elements()
+ .SkipLast(1)
+ .Remove();
+ // last element in both dynamicTypes and staticTypes disables compression
+ //
+ });
+ deploymentParameters = iisDeploymentParameters;
}
using (var deployer = IISApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
diff --git a/test/ServerComparison.FunctionalTests/ResponseTests.cs b/test/ServerComparison.FunctionalTests/ResponseTests.cs
index cd646bc3b9..72ef1f6d48 100644
--- a/test/ServerComparison.FunctionalTests/ResponseTests.cs
+++ b/test/ServerComparison.FunctionalTests/ResponseTests.cs
@@ -87,10 +87,14 @@ namespace ServerComparison.FunctionalTests
var deploymentParameters = new DeploymentParameters(variant)
{
ApplicationPath = Helpers.GetApplicationPath(),
- EnvironmentName = "Responses",
- ServerConfigTemplateContent = Helpers.GetNginxConfigContent(variant.Server, "nginx.conf"),
+ EnvironmentName = "Responses"
};
+ if (variant.Server == ServerType.Nginx)
+ {
+ deploymentParameters.ServerConfigTemplateContent = Helpers.GetNginxConfigContent("nginx.conf");
+ }
+
using (var deployer = IISApplicationDeployerFactory.Create(deploymentParameters, loggerFactory))
{
var deploymentResult = await deployer.DeployAsync();