From fad190fcae129e8db1a9611a81c21d2e9094b426 Mon Sep 17 00:00:00 2001 From: Tom Pallister Date: Tue, 24 Apr 2018 08:30:45 +0100 Subject: [PATCH] Feature/extra request id test (#329) * messing around with benchmark.net.seems Ocelot adds about 2ms to a request..lets make this less? :) * #326 store json indented so it looks nice :P * #327 show another test how request id works --- test/Ocelot.AcceptanceTests/RequestIdTests.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/test/Ocelot.AcceptanceTests/RequestIdTests.cs b/test/Ocelot.AcceptanceTests/RequestIdTests.cs index 6ac271c99..7989dc905 100644 --- a/test/Ocelot.AcceptanceTests/RequestIdTests.cs +++ b/test/Ocelot.AcceptanceTests/RequestIdTests.cs @@ -132,6 +132,43 @@ public void should_use_global_request_id_and_forward() .BDDfy(); } + [Fact] + public void should_use_global_request_id_create_and_forward() + { + var configuration = new FileConfiguration + { + ReRoutes = new List + { + new FileReRoute + { + DownstreamPathTemplate = "/", + DownstreamHostAndPorts = new List + { + new FileHostAndPort + { + Host = "localhost", + Port = 51873, + } + }, + DownstreamScheme = "http", + UpstreamPathTemplate = "/", + UpstreamHttpMethod = new List { "Get" }, + } + }, + GlobalConfiguration = new FileGlobalConfiguration + { + RequestIdKey = _steps.RequestIdKey + } + }; + + this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51873")) + .And(x => _steps.GivenThereIsAConfiguration(configuration)) + .And(x => _steps.GivenOcelotIsRunning()) + .When(x => _steps.WhenIGetUrlOnTheApiGateway("/")) + .Then(x => _steps.ThenTheRequestIdIsReturned()) + .BDDfy(); + } + private void GivenThereIsAServiceRunningOn(string url) { _builder = new WebHostBuilder()