-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate that autobahn results are okay
Signed-off-by: Jens Reidel <adrian@travitia.xyz>
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import json | ||
import os | ||
|
||
AUTOBAHN_DIR = os.path.dirname(__file__) | ||
CLIENTS = os.sep.join([AUTOBAHN_DIR, "reports", "clients", "index.json"]) | ||
SERVERS = os.sep.join([AUTOBAHN_DIR, "reports", "servers", "index.json"]) | ||
|
||
def validate_report_json(json): | ||
for (client, cases) in json.items(): | ||
if "tokio-websockets" not in client: | ||
continue # We do not care about other libraries' results | ||
non_strict_allowed = "skip-fail-fast" in client | ||
|
||
if non_strict_allowed: | ||
allowed_behavior = ("OK", "INFORMATIONAL", "NON-STRICT", "UNIMPLEMENTED") | ||
else: | ||
allowed_behavior = ("OK", "INFORMATIONAL", "UNIMPLEMENTED") | ||
|
||
for (report, result) in cases.items(): | ||
behavior = result["behavior"] | ||
behavior_close = result["behaviorClose"] | ||
|
||
if behavior not in allowed_behavior or behavior_close not in allowed_behavior: | ||
raise Exception(f"Case {report} failed: {result}") | ||
|
||
def load_reports(path): | ||
with open(path, "r") as f: | ||
return json.load(f) | ||
|
||
validate_report_json(load_reports(CLIENTS)) | ||
validate_report_json(load_reports(SERVERS)) |