diff --git a/src/SeqCli/Cli/Commands/Node/HealthCommand.cs b/src/SeqCli/Cli/Commands/Node/HealthCommand.cs index 24dad8f1..0bf497f0 100644 --- a/src/SeqCli/Cli/Commands/Node/HealthCommand.cs +++ b/src/SeqCli/Cli/Commands/Node/HealthCommand.cs @@ -54,13 +54,16 @@ protected override async Task Run() try { var response = await connection.Client.HttpClient.GetAsync("health"); - Console.WriteLine($"HTTP {response.Version} {((int)response.StatusCode).ToString(CultureInfo.InvariantCulture)} {response.ReasonPhrase}"); + Log.Information("HTTP {HttpVersion} {StatusCode} {ReasonPhrase}", response.Version, (int)response.StatusCode, response.ReasonPhrase); + foreach (var (key, values) in response.Headers.Concat(response.Content.Headers)) foreach (var value in values) { - Console.WriteLine($"{key}: {value}"); + Log.Information("{HeaderName}: {HeaderValue}", key, value); } + Console.WriteLine(await response.Content.ReadAsStringAsync()); + return response.IsSuccessStatusCode ? 0 : 1; } catch (Exception ex) diff --git a/test/SeqCli.EndToEnd/Node/NodeDemoteTestCase.cs b/test/SeqCli.EndToEnd/Node/NodeDemoteTestCase.cs index 1cc7efce..bd460648 100644 --- a/test/SeqCli.EndToEnd/Node/NodeDemoteTestCase.cs +++ b/test/SeqCli.EndToEnd/Node/NodeDemoteTestCase.cs @@ -6,7 +6,7 @@ namespace SeqCli.EndToEnd.Node; -[CliTestCase(MinimumApiVersion = "2021.3.6410")] +[CliTestCase] public class NodeDemoteTestCase: ICliTestCase { public Task ExecuteAsync(SeqConnection connection, ILogger logger, CliCommandRunner runner) diff --git a/test/SeqCli.EndToEnd/Node/NodeHealthTestCase.cs b/test/SeqCli.EndToEnd/Node/NodeHealthTestCase.cs index d13e07cd..5cd54934 100644 --- a/test/SeqCli.EndToEnd/Node/NodeHealthTestCase.cs +++ b/test/SeqCli.EndToEnd/Node/NodeHealthTestCase.cs @@ -6,14 +6,14 @@ namespace SeqCli.EndToEnd.Node; -[CliTestCase(MinimumApiVersion = "2021.3.6410")] +[CliTestCase] public class NodeHealthTestCase: ICliTestCase { public Task ExecuteAsync(SeqConnection connection, ILogger logger, CliCommandRunner runner) { var exit = runner.Exec("node health"); Assert.Equal(0, exit); - Assert.StartsWith("HTTP 1.1 200 OK", runner.LastRunProcess!.Output); + Assert.StartsWith("{\"status\":", runner.LastRunProcess!.Output); return Task.CompletedTask; } } \ No newline at end of file diff --git a/test/SeqCli.EndToEnd/Node/NodeListTestCase.cs b/test/SeqCli.EndToEnd/Node/NodeListTestCase.cs index 46b734df..7c8dfec8 100644 --- a/test/SeqCli.EndToEnd/Node/NodeListTestCase.cs +++ b/test/SeqCli.EndToEnd/Node/NodeListTestCase.cs @@ -6,7 +6,7 @@ namespace SeqCli.EndToEnd.Node; -[CliTestCase(MinimumApiVersion = "2021.3.6410")] +[CliTestCase] public class NodeListTestCase: ICliTestCase { public Task ExecuteAsync(SeqConnection connection, ILogger logger, CliCommandRunner runner)