-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report results after charm func tests
Report contains info about whether tests are voting or not and also the commit id the tests were run against.
- Loading branch information
Showing
5 changed files
with
73 additions
and
4 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
Empty file.
File renamed without changes.
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,34 @@ | ||
""" | ||
Takes a func test target name as input and exits 0 if the test is voting and | ||
1 if not. | ||
""" | ||
import os | ||
import sys | ||
|
||
import yaml | ||
|
||
if __name__ == "__main__": | ||
target_name = sys.argv[1] | ||
if not os.path.exists('osci.yaml'): | ||
sys.stderr.write(f"ERROR: osci.yaml not found - assuming " | ||
f"{target_name} is voting.\n") | ||
sys.exit(0) | ||
|
||
with open('osci.yaml', encoding='utf-8') as fd: | ||
osci_config = yaml.safe_load(fd) | ||
|
||
try: | ||
jobs = osci_config[0]['project']['check']['jobs'] | ||
if target_name in jobs: | ||
# default is voting=True | ||
sys.exit(0) | ||
|
||
for check in jobs: | ||
if isinstance(check, dict) and target_name in check: | ||
if not check[target_name]['voting']: | ||
sys.exit(1) | ||
except KeyError as exc: | ||
sys.stderr.write(f"ERROR: failed to process osci.yaml - assuming " | ||
f"{target_name} is voting (key {exc} not found).\n") | ||
|
||
sys.exit(0) |
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