hacking around

This commit is contained in:
Tom Gardham-Pallister 2018-05-08 22:57:59 +01:00
parent 66bc6203ad
commit 22fc8668af
2 changed files with 6 additions and 2 deletions

View File

@ -88,6 +88,7 @@ namespace Ocelot.Raft
public Response<T> Request<T>(T command) public Response<T> Request<T>(T command)
where T : ICommand where T : ICommand
{ {
Console.WriteLine("SENDING REQUEST....");
if(_token == null) if(_token == null)
{ {
SetToken(); SetToken();
@ -99,11 +100,13 @@ namespace Ocelot.Raft
var response = _httpClient.PostAsync($"{_hostAndPort}/administration/raft/command", content).GetAwaiter().GetResult(); var response = _httpClient.PostAsync($"{_hostAndPort}/administration/raft/command", content).GetAwaiter().GetResult();
if(response.IsSuccessStatusCode) if(response.IsSuccessStatusCode)
{ {
Console.WriteLine("REQUEST OK....");
var okResponse = JsonConvert.DeserializeObject<OkResponse<ICommand>>(response.Content.ReadAsStringAsync().GetAwaiter().GetResult(), _jsonSerializerSettings); var okResponse = JsonConvert.DeserializeObject<OkResponse<ICommand>>(response.Content.ReadAsStringAsync().GetAwaiter().GetResult(), _jsonSerializerSettings);
return new OkResponse<T>((T)okResponse.Command); return new OkResponse<T>((T)okResponse.Command);
} }
else else
{ {
Console.WriteLine("REQUEST NOT OK....");
return new ErrorResponse<T>(response.Content.ReadAsStringAsync().GetAwaiter().GetResult(), command); return new ErrorResponse<T>(response.Content.ReadAsStringAsync().GetAwaiter().GetResult(), command);
} }
} }

View File

@ -105,6 +105,7 @@ namespace Ocelot.IntegrationTests
GivenFiveServersAreRunning(); GivenFiveServersAreRunning();
GivenIHaveAnOcelotToken("/administration"); GivenIHaveAnOcelotToken("/administration");
WhenISendACommandIntoTheCluster(command); WhenISendACommandIntoTheCluster(command);
Thread.Sleep(5000);
ThenTheCommandIsReplicatedToAllStateMachines(command); ThenTheCommandIsReplicatedToAllStateMachines(command);
} }
@ -261,8 +262,8 @@ namespace Ocelot.IntegrationTests
} }
catch(Exception e) catch(Exception e)
{ {
_output.WriteLine($"{e.Message}, {e.StackTrace}"); //_output.WriteLine($"{e.Message}, {e.StackTrace}");
Console.WriteLine(e); //Console.WriteLine(e);
return false; return false;
} }
} }