mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 18:32:51 +08:00
use random port generator on tests from master
This commit is contained in:
parent
c75227d5b8
commit
36064b13d0
@ -25,7 +25,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void should_return_response_200_when_using_http_one()
|
public void should_return_response_200_when_using_http_one()
|
||||||
{
|
{
|
||||||
const int port = 53219;
|
var port = RandomPortFinder.GetRandomPort();
|
||||||
|
|
||||||
var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void should_return_response_200_when_using_http_one_point_one()
|
public void should_return_response_200_when_using_http_one_point_one()
|
||||||
{
|
{
|
||||||
const int port = 53279;
|
var port = RandomPortFinder.GetRandomPort();
|
||||||
|
|
||||||
var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
{
|
{
|
||||||
@ -101,7 +101,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void should_return_response_200_when_using_http_two_point_zero()
|
public void should_return_response_200_when_using_http_two_point_zero()
|
||||||
{
|
{
|
||||||
const int port = 53675;
|
var port = RandomPortFinder.GetRandomPort();
|
||||||
|
|
||||||
var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
{
|
{
|
||||||
@ -143,7 +143,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void should_return_response_500_when_using_http_one_to_talk_to_server_running_http_two()
|
public void should_return_response_500_when_using_http_one_to_talk_to_server_running_http_two()
|
||||||
{
|
{
|
||||||
const int port = 53677;
|
var port = RandomPortFinder.GetRandomPort();
|
||||||
|
|
||||||
var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
{
|
{
|
||||||
@ -184,7 +184,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void should_return_response_200_when_using_http_two_to_talk_to_server_running_http_one_point_one()
|
public void should_return_response_200_when_using_http_two_to_talk_to_server_running_http_one_point_one()
|
||||||
{
|
{
|
||||||
const int port = 53679;
|
var port = RandomPortFinder.GetRandomPort();
|
||||||
|
|
||||||
var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,8 @@ namespace Ocelot.AcceptanceTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void should_return_response_200_when_get_converted_to_post()
|
public void should_return_response_200_when_get_converted_to_post()
|
||||||
{
|
{
|
||||||
|
var port = RandomPortFinder.GetRandomPort();
|
||||||
|
|
||||||
var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
{
|
{
|
||||||
ReRoutes = new List<FileReRoute>
|
ReRoutes = new List<FileReRoute>
|
||||||
@ -39,7 +41,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
new FileHostAndPort
|
new FileHostAndPort
|
||||||
{
|
{
|
||||||
Host = "localhost",
|
Host = "localhost",
|
||||||
Port = 53171,
|
Port = port,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
DownstreamHttpMethod = "POST",
|
DownstreamHttpMethod = "POST",
|
||||||
@ -47,7 +49,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:53171/", "/", "POST"))
|
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}/", "/", "POST"))
|
||||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
.And(x => _steps.GivenOcelotIsRunning())
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||||
@ -58,6 +60,8 @@ namespace Ocelot.AcceptanceTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void should_return_response_200_when_get_converted_to_post_with_content()
|
public void should_return_response_200_when_get_converted_to_post_with_content()
|
||||||
{
|
{
|
||||||
|
var port = RandomPortFinder.GetRandomPort();
|
||||||
|
|
||||||
var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
{
|
{
|
||||||
ReRoutes = new List<FileReRoute>
|
ReRoutes = new List<FileReRoute>
|
||||||
@ -73,7 +77,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
new FileHostAndPort
|
new FileHostAndPort
|
||||||
{
|
{
|
||||||
Host = "localhost",
|
Host = "localhost",
|
||||||
Port = 53271,
|
Port = port,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
DownstreamHttpMethod = "POST",
|
DownstreamHttpMethod = "POST",
|
||||||
@ -84,7 +88,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
const string expected = "here is some content";
|
const string expected = "here is some content";
|
||||||
var httpContent = new StringContent(expected);
|
var httpContent = new StringContent(expected);
|
||||||
|
|
||||||
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:53271/", "/", "POST"))
|
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}/", "/", "POST"))
|
||||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
.And(x => _steps.GivenOcelotIsRunning())
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/", httpContent))
|
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/", httpContent))
|
||||||
@ -96,6 +100,8 @@ namespace Ocelot.AcceptanceTests
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void should_return_response_200_when_get_converted_to_get_with_content()
|
public void should_return_response_200_when_get_converted_to_get_with_content()
|
||||||
{
|
{
|
||||||
|
var port = RandomPortFinder.GetRandomPort();
|
||||||
|
|
||||||
var configuration = new FileConfiguration
|
var configuration = new FileConfiguration
|
||||||
{
|
{
|
||||||
ReRoutes = new List<FileReRoute>
|
ReRoutes = new List<FileReRoute>
|
||||||
@ -111,7 +117,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
new FileHostAndPort
|
new FileHostAndPort
|
||||||
{
|
{
|
||||||
Host = "localhost",
|
Host = "localhost",
|
||||||
Port = 53272,
|
Port = port,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
DownstreamHttpMethod = "GET",
|
DownstreamHttpMethod = "GET",
|
||||||
@ -122,7 +128,7 @@ namespace Ocelot.AcceptanceTests
|
|||||||
const string expected = "here is some content";
|
const string expected = "here is some content";
|
||||||
var httpContent = new StringContent(expected);
|
var httpContent = new StringContent(expected);
|
||||||
|
|
||||||
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:53272/", "/", "GET"))
|
this.Given(x => x.GivenThereIsAServiceRunningOn($"http://localhost:{port}/", "/", "GET"))
|
||||||
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
.And(x => _steps.GivenOcelotIsRunning())
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/", httpContent))
|
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/", httpContent))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user