Skip to content

Commit 4907bdf

Browse files
committed
Fix CLI and PR scored
1 parent c11883b commit 4907bdf

6 files changed

Lines changed: 23 additions & 23 deletions

File tree

.github/workflows/probe.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,9 +234,9 @@ jobs:
234234
235235
import re
236236
def short(tid):
237-
return re.sub(r'^(RFC\d+-[\d.]+-|COMP-|SMUG-|MAL-)', '', tid)
237+
return re.sub(r'^(RFC\d+-[\d.]+-|COMP-|SMUG-|MAL-|NORM-)', '', tid)
238238
239-
for cat_name, title in [('Compliance', 'Compliance'), ('Smuggling', 'Smuggling'), ('MalformedInput', 'Malformed Input')]:
239+
for cat_name, title in [('Compliance', 'Compliance'), ('Smuggling', 'Smuggling'), ('MalformedInput', 'Malformed Input'), ('Normalization', 'Header Normalization')]:
240240
cat_tests = [tid for tid in test_ids if lookup[names[0]][tid]['category'] == cat_name]
241241
if not cat_tests:
242242
continue

docs/content/servers/sisk.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,16 @@ using var app = HttpServer.CreateBuilder()
3434
.UseListeningPort($"http://+:{port}/")
3535
.Build();
3636

37-
app.Router.SetRoute(RouteMethod.Any, "/echo", request =>
38-
{
39-
var sb = new System.Text.StringBuilder();
40-
foreach (var h in request.Headers)
41-
sb.AppendLine($"{h.Key}: {h.Value}");
42-
return new HttpResponse(200).WithContent(sb.ToString());
43-
});
44-
4537
app.Router.SetRoute(RouteMethod.Any, Route.AnyPath, request =>
4638
{
39+
if (request.Path == "/echo")
40+
{
41+
var sb = new System.Text.StringBuilder();
42+
foreach (var h in request.Headers)
43+
foreach (var val in h.Value)
44+
sb.AppendLine($"{h.Key}: {val}");
45+
return new HttpResponse(200).WithContent(sb.ToString());
46+
}
4747
if (request.Method == HttpMethod.Post && request.Body is not null)
4848
{
4949
var body = request.Body;

src/Http11Probe.Cli/Reporting/ConsoleReporter.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,10 @@ public static void PrintSummary(TestRunReport report)
6767
Console.WriteLine(" " + new string('─', 80));
6868
Console.WriteLine();
6969

70-
var scoredCount = report.PassCount + report.FailCount;
7170
var prev = Console.ForegroundColor;
7271
Console.Write(" Score: ");
73-
Console.ForegroundColor = report.FailCount == 0 ? ConsoleColor.Green : ConsoleColor.Red;
74-
Console.Write($"{report.PassCount}/{scoredCount}");
72+
Console.ForegroundColor = report.FailCount == 0 && report.WarnCount == 0 ? ConsoleColor.Green : ConsoleColor.Red;
73+
Console.Write($"{report.PassCount}/{report.ScoredCount}");
7574
Console.ForegroundColor = prev;
7675

7776
if (report.FailCount > 0)

src/Http11Probe.Cli/Reporting/JsonReporter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static string Generate(TestRunReport report)
2121
summary = new
2222
{
2323
total = report.Results.Count,
24-
scored = report.PassCount + report.FailCount,
24+
scored = report.ScoredCount,
2525
passed = report.PassCount,
2626
failed = report.FailCount,
2727
warnings = report.WarnCount,

src/Http11Probe/Runner/TestRunReport.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ public sealed class TestRunReport
99

1010
public int PassCount => Results.Count(r => r.TestCase.Scored && r.Verdict == TestVerdict.Pass);
1111
public int FailCount => Results.Count(r => r.TestCase.Scored && r.Verdict == TestVerdict.Fail);
12-
public int WarnCount => Results.Count(r => r.Verdict == TestVerdict.Warn);
12+
public int WarnCount => Results.Count(r => r.TestCase.Scored && r.Verdict == TestVerdict.Warn);
13+
public int ScoredCount => PassCount + FailCount + WarnCount;
1314
public int SkipCount => Results.Count(r => r.Verdict == TestVerdict.Skip);
1415
public int ErrorCount => Results.Count(r => r.Verdict == TestVerdict.Error);
1516
public int UnscoredCount => Results.Count(r => !r.TestCase.Scored && r.Verdict != TestVerdict.Skip);

src/Servers/SiskServer/Program.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77
.UseListeningPort($"http://+:{port}/")
88
.Build();
99

10-
app.Router.SetRoute(RouteMethod.Any, "/echo", request =>
11-
{
12-
var sb = new System.Text.StringBuilder();
13-
foreach (var h in request.Headers)
14-
sb.AppendLine($"{h.Key}: {h.Value}");
15-
return new HttpResponse(200).WithContent(sb.ToString());
16-
});
17-
1810
app.Router.SetRoute(RouteMethod.Any, Route.AnyPath, request =>
1911
{
12+
if (request.Path == "/echo")
13+
{
14+
var sb = new System.Text.StringBuilder();
15+
foreach (var h in request.Headers)
16+
foreach (var val in h.Value)
17+
sb.AppendLine($"{h.Key}: {val}");
18+
return new HttpResponse(200).WithContent(sb.ToString());
19+
}
2020
if (request.Method == HttpMethod.Post && request.Body is not null)
2121
{
2222
var body = request.Body;

0 commit comments

Comments
 (0)