mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 14:02:49 +08:00
hacking around
This commit is contained in:
parent
66bc6203ad
commit
22fc8668af
@ -88,6 +88,7 @@ namespace Ocelot.Raft
|
||||
public Response<T> Request<T>(T command)
|
||||
where T : ICommand
|
||||
{
|
||||
Console.WriteLine("SENDING REQUEST....");
|
||||
if(_token == null)
|
||||
{
|
||||
SetToken();
|
||||
@ -99,11 +100,13 @@ namespace Ocelot.Raft
|
||||
var response = _httpClient.PostAsync($"{_hostAndPort}/administration/raft/command", content).GetAwaiter().GetResult();
|
||||
if(response.IsSuccessStatusCode)
|
||||
{
|
||||
Console.WriteLine("REQUEST OK....");
|
||||
var okResponse = JsonConvert.DeserializeObject<OkResponse<ICommand>>(response.Content.ReadAsStringAsync().GetAwaiter().GetResult(), _jsonSerializerSettings);
|
||||
return new OkResponse<T>((T)okResponse.Command);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("REQUEST NOT OK....");
|
||||
return new ErrorResponse<T>(response.Content.ReadAsStringAsync().GetAwaiter().GetResult(), command);
|
||||
}
|
||||
}
|
||||
|
@ -105,6 +105,7 @@ namespace Ocelot.IntegrationTests
|
||||
GivenFiveServersAreRunning();
|
||||
GivenIHaveAnOcelotToken("/administration");
|
||||
WhenISendACommandIntoTheCluster(command);
|
||||
Thread.Sleep(5000);
|
||||
ThenTheCommandIsReplicatedToAllStateMachines(command);
|
||||
}
|
||||
|
||||
@ -261,8 +262,8 @@ namespace Ocelot.IntegrationTests
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
_output.WriteLine($"{e.Message}, {e.StackTrace}");
|
||||
Console.WriteLine(e);
|
||||
//_output.WriteLine($"{e.Message}, {e.StackTrace}");
|
||||
//Console.WriteLine(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user