mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-08-04 17:52:27 +08:00
use random port generator on tests from master
This commit is contained in:
@ -24,6 +24,8 @@ namespace Ocelot.AcceptanceTests
|
||||
[Fact]
|
||||
public void should_return_response_200_when_get_converted_to_post()
|
||||
{
|
||||
var port = RandomPortFinder.GetRandomPort();
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
@ -39,7 +41,7 @@ namespace Ocelot.AcceptanceTests
|
||||
new FileHostAndPort
|
||||
{
|
||||
Host = "localhost",
|
||||
Port = 53171,
|
||||
Port = port,
|
||||
},
|
||||
},
|
||||
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.GivenOcelotIsRunning())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||
@ -58,6 +60,8 @@ namespace Ocelot.AcceptanceTests
|
||||
[Fact]
|
||||
public void should_return_response_200_when_get_converted_to_post_with_content()
|
||||
{
|
||||
var port = RandomPortFinder.GetRandomPort();
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
@ -73,7 +77,7 @@ namespace Ocelot.AcceptanceTests
|
||||
new FileHostAndPort
|
||||
{
|
||||
Host = "localhost",
|
||||
Port = 53271,
|
||||
Port = port,
|
||||
},
|
||||
},
|
||||
DownstreamHttpMethod = "POST",
|
||||
@ -84,7 +88,7 @@ namespace Ocelot.AcceptanceTests
|
||||
const string expected = "here is some content";
|
||||
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.GivenOcelotIsRunning())
|
||||
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/", httpContent))
|
||||
@ -96,6 +100,8 @@ namespace Ocelot.AcceptanceTests
|
||||
[Fact]
|
||||
public void should_return_response_200_when_get_converted_to_get_with_content()
|
||||
{
|
||||
var port = RandomPortFinder.GetRandomPort();
|
||||
|
||||
var configuration = new FileConfiguration
|
||||
{
|
||||
ReRoutes = new List<FileReRoute>
|
||||
@ -111,7 +117,7 @@ namespace Ocelot.AcceptanceTests
|
||||
new FileHostAndPort
|
||||
{
|
||||
Host = "localhost",
|
||||
Port = 53272,
|
||||
Port = port,
|
||||
},
|
||||
},
|
||||
DownstreamHttpMethod = "GET",
|
||||
@ -122,7 +128,7 @@ namespace Ocelot.AcceptanceTests
|
||||
const string expected = "here is some content";
|
||||
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.GivenOcelotIsRunning())
|
||||
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/", httpContent))
|
||||
|
Reference in New Issue
Block a user