Skip to content
This repository has been archived by the owner on Feb 23, 2021. It is now read-only.

Commit

Permalink
Add Nginx to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BrennanConroy committed Jun 15, 2016
1 parent 6aa585f commit c8384c9
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 33 deletions.
12 changes: 3 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ os:
- linux
- osx
osx_image: xcode7.1
before_install:
- if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install nginx; brew install openssl; brew link --force openssl; else ./install-nginx.sh; fi
install:
- curl -sSL https://github.com/libuv/libuv/archive/v1.4.2.tar.gz | tar zxfv - -C /tmp && cd /tmp/libuv-1.4.2/
- sh autogen.sh
- ./configure --prefix=$HOME/libuvinstall
- make
- make install
- export LD_LIBRARY_PATH="$HOME/libuvinstall/lib"
- cd $OLDPWD
- export PATH="$PATH:$HOME/nginxinstall/sbin/"
before_script:
- npm install -g bower
- npm install -g gulp
Expand All @@ -33,8 +29,6 @@ branches:
- release
- dev
- /^(.*\/)?ci-.*$/
before_install:
- if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; brew link --force openssl; fi
script:
- ./build.sh --quiet verify
notifications:
Expand Down
6 changes: 6 additions & 0 deletions install-nginx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

curl -sSL http://nginx.org/download/nginx-1.8.0.tar.gz | tar zxfv - -C /tmp && cd /tmp/nginx-1.8.0/
./configure --prefix=$HOME/nginxinstall --with-http_ssl_module
make
make install
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public async Task RunSite_WindowsOnly(ServerType server, RuntimeFlavor runtimeFl
[OSSkipCondition(OperatingSystems.Windows)]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5509")] // Disabled due to https://github.com/dotnet/corefx/issues/9012
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5510")]
[InlineData(ServerType.Nginx, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5511")]
public async Task RunSite_NonWindowsOnly(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await RunSite(server, runtimeFlavor, architecture, applicationBaseUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public async Task RunSite_WindowsOnly(ServerType server, RuntimeFlavor runtimeFl
[OSSkipCondition(OperatingSystems.Windows)]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5609")] // Disabled due to https://github.com/dotnet/corefx/issues/9012
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5610")]
[InlineData(ServerType.Nginx, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5611")]
public async Task RunSite_NonWindowsOnly(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await RunSite(server, runtimeFlavor, architecture, applicationBaseUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public async Task RunSite_WindowsOnly(ServerType server, RuntimeFlavor runtimeFl
[OSSkipCondition(OperatingSystems.Windows)]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5709")] // Disabled due to https://github.com/dotnet/corefx/issues/9012
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5710")]
[InlineData(ServerType.Nginx, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5711")]
public async Task RunSite_NonWindowsOnly(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await RunSite(server, runtimeFlavor, architecture, applicationBaseUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public async Task RunSite_WindowsOnly(ServerType server, RuntimeFlavor runtimeFl
[OSSkipCondition(OperatingSystems.Windows)]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5809")] // Disabled due to https://github.com/dotnet/corefx/issues/9012
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5810")]
[InlineData(ServerType.Nginx, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5811")]
public async Task RunSite_NonWindowsOnly(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await RunSite(server, runtimeFlavor, architecture, applicationBaseUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public async Task RunSite_WindowsOnly(ServerType server, RuntimeFlavor runtimeFl
[OSSkipCondition(OperatingSystems.Windows)]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5909")] // Disabled due to https://github.com/dotnet/corefx/issues/9012
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5910")]
[InlineData(ServerType.Nginx, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5911")]
public async Task RunSite_NonWindowsOnly(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await RunSite(server, runtimeFlavor, architecture, applicationBaseUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public async Task RunSite_WindowsOnly(ServerType server, RuntimeFlavor runtimeFl
[OSSkipCondition(OperatingSystems.Windows)]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6009")] // Disabled due to https://github.com/dotnet/corefx/issues/9012
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6010")]
[InlineData(ServerType.Nginx, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6011")]
public async Task RunSite_NonWindowsOnly(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await RunSite(server, runtimeFlavor, architecture, applicationBaseUrl);
Expand Down
45 changes: 23 additions & 22 deletions test/FunctionalTests/Diagnostics/DiagnosticsStatusCodesMvcTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public async Task ExistingPage_WindowsOnly(ServerType server, RuntimeFlavor runt
[OSSkipCondition(OperatingSystems.Windows)]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6109")] // Disabled due to https://github.com/dotnet/corefx/issues/9012
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6110")]
[InlineData(ServerType.Nginx, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6111")]
public async Task ExistingPage_NonWindowsOnly(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await ExistingPage(server, runtimeFlavor, architecture, applicationBaseUrl);
Expand Down Expand Up @@ -71,7 +72,7 @@ await TestServices.RunSiteTest(
}

[Theory]
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6110")]
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6112")]
public async Task NonExistingPage_AllPlatforms(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await NonExistingPage(server, runtimeFlavor, architecture, applicationBaseUrl);
Expand All @@ -80,24 +81,24 @@ public async Task NonExistingPage_AllPlatforms(ServerType server, RuntimeFlavor
[ConditionalTheory]
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
//[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:6111")]
[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6112")]
//[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:6113")]
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6114")]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:6115")]
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6116")]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:6117")]
//[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:6113")]
[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6114")]
//[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:6115")]
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6116")]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:6117")]
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6118")]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:6119")]
// Already covered by all platforms:
//[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:6118")]
//[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:6120")]
public async Task NonExistingPage_WindowsOnly(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await NonExistingPage(server, runtimeFlavor, architecture, applicationBaseUrl);
}

[ConditionalTheory]
[OSSkipCondition(OperatingSystems.Windows)]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6119")] // Disabled due to https://github.com/dotnet/corefx/issues/9012
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6120")]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6121")] // Disabled due to https://github.com/dotnet/corefx/issues/9012
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6122")]
public async Task NonExistingPage_NonWindowsOnly(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await NonExistingPage(server, runtimeFlavor, architecture, applicationBaseUrl);
Expand Down Expand Up @@ -128,7 +129,7 @@ await TestServices.RunSiteTest(
}

[Theory]
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6120")]
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6123")]
public async Task CustomErrorCode_AllPlatforms(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await CustomErrorCode(server, runtimeFlavor, architecture, applicationBaseUrl);
Expand All @@ -137,24 +138,24 @@ public async Task CustomErrorCode_AllPlatforms(ServerType server, RuntimeFlavor
[ConditionalTheory]
[OSSkipCondition(OperatingSystems.Linux)]
[OSSkipCondition(OperatingSystems.MacOSX)]
//[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:6121")]
[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6122")]
//[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:6123")]
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6124")]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:6125")]
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6126")]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:6127")]
//[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:6124")]
[InlineData(ServerType.WebListener, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6125")]
//[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:6126")]
[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6127")]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:6128")]
[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6129")]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:6130")]
// Already covered by all platforms:
//[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:6128")]
//[InlineData(ServerType.WebListener, RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:6131")]
public async Task CustomErrorCode_WindowsOnly(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await CustomErrorCode(server, runtimeFlavor, architecture, applicationBaseUrl);
}

[ConditionalTheory]
[OSSkipCondition(OperatingSystems.Windows)]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6129")] // Disabled due to https://github.com/dotnet/corefx/issues/9012
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6130")]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6132")] // Disabled due to https://github.com/dotnet/corefx/issues/9012
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6133")]
public async Task CustomErrorCode_NonWindowsOnly(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await CustomErrorCode(server, runtimeFlavor, architecture, applicationBaseUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public async Task RunSite_WindowsOnly(ServerType server, RuntimeFlavor runtimeFl
[OSSkipCondition(OperatingSystems.Windows)]
//[InlineData(ServerType.Kestrel, RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:6204")] // Disabled due to https://github.com/dotnet/corefx/issues/9012
[InlineData(ServerType.Kestrel, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6205")]
[InlineData(ServerType.Nginx, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:6206")]
public async Task RunSite_NonWindowsOnly(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await RunSite(server, runtimeFlavor, architecture, applicationBaseUrl);
Expand Down
6 changes: 5 additions & 1 deletion test/FunctionalTests/TestServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public static async Task RunSiteTest(string siteName, ServerType serverType, Run
{
ApplicationBaseUriHint = applicationBaseUrl,
SiteName = "HttpTestSite",
ServerConfigTemplateContent = serverType == ServerType.Nginx ? File.ReadAllText("nginx.conf") : string.Empty,
PublishApplicationBeforeDeployment = true,
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net451" : "netcoreapp1.0",
ApplicationType = runtimeFlavor == RuntimeFlavor.Clr ? ApplicationType.Standalone : ApplicationType.Portable
Expand All @@ -60,7 +61,10 @@ public static async Task RunSiteTest(string siteName, ServerType serverType, Run
Timeout = TimeSpan.FromSeconds(10)
};

await validator(httpClient, logger, deploymentResult.HostShutdownToken);
using (httpClient)
{
await validator(httpClient, logger, deploymentResult.HostShutdownToken);
}
}
}
}
Expand Down
37 changes: 37 additions & 0 deletions test/FunctionalTests/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
error_log [errorlog];
user [user];
worker_processes 4;
pid [pidFile];

events {
worker_connections 768;
}

http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 10;
types_hash_max_size 2048;

default_type application/octet-stream;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;

access_log [accesslog];

gzip on;
gzip_disable "msie6";

server {
listen [listenPort];
location / {
proxy_pass [redirectUri];
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}
5 changes: 4 additions & 1 deletion test/FunctionalTests/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,8 @@
},
"net451": {}
},
"content": [
"nginx.conf"
],
"testRunner": "xunit"
}
}

0 comments on commit c8384c9

Please sign in to comment.