CI: Add more tests

This commit is contained in:
Luis Garcia
2024-05-06 22:30:44 -06:00
parent 1f7da2f609
commit 632dfbcadb
8 changed files with 438 additions and 32 deletions

View File

@@ -4,15 +4,12 @@ import os, argparse
def parse_args():
parser = argparse.ArgumentParser(
description="Check the mark.log file that is generated by the CI to make sure it contains the expected values"
)
parser.add_argument(
"--dry", action="store_true", help="Check the mark.log file for dry-run"
)
parser.add_argument(
"--write", action="store_true", help="Check the mark.log file for write-run"
)
parser = argparse.ArgumentParser(description="Check the mark.log file that is generated by the CI to make sure it contains the expected values")
parser.add_argument("--dry", action="store_true", help="Check the mark.log file for dry-run")
parser.add_argument("--write", action="store_true", help="Check the mark.log file for write-run")
parser.add_argument("--plex", action="store_true", help="Check the mark.log file for Plex")
parser.add_argument("--jellyfin", action="store_true", help="Check the mark.log file for Jellyfin")
parser.add_argument("--emby", action="store_true", help="Check the mark.log file for Emby")
return parser.parse_args()
@@ -43,7 +40,8 @@ def check_marklog(lines, expected_values):
+ str(len(found_values))
+ " values, expected "
+ str(len(expected_values))
+ " values"
+ " values\n"
+ "\n".join(found_values)
)
# Check that the two lists contain the same values
@@ -63,12 +61,8 @@ def check_marklog(lines, expected_values):
def main():
args = parse_args()
# Expected values for the mark.log file, dry-run is slightly different than write-run
# due to some of the items being copied over from one server to another and now being there
# for the next server run.
if args.dry:
expected_values = [
expected = {
"dry": [
# Jellyfin -> Plex
"jellyplex_watched/Movies/Five Nights at Freddy's",
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/301215",
@@ -91,11 +85,9 @@ def main():
"JellyUser/Movies/Tears of Steel",
# Jellyfin -> Emby
"jellyplex_watched/Movies/The Family Plan",
"jellyplex_watched/Movies/Five Nights at Freddy's",
]
elif args.write:
expected_values = [
"jellyplex_watched/Movies/Five Nights at Freddy's"
],
"write": [
"jellyplex_watched/Movies/Five Nights at Freddy's",
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/301215",
"jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
@@ -113,8 +105,49 @@ def main():
"jellyplex_watched/Movies/Five Nights at Freddy's",
"JellyUser/Movies/Tears of Steel",
"jellyplex_watched/TV shows/Doctor Who (2005)/World War Three (2)",
"jellyplex_watched/TV shows/Monarch: Legacy of Monsters/Parallels and Interiors/240429"
],
"plex": [
"JellyUser/Movies/Big Buck Bunny",
"JellyUser/Shows/Doctor Who/The Unquiet Dead",
"JellyUser/Shows/Monarch: Legacy of Monsters/Secrets and Lies",
"jellyplex_watched/Movies/Big Buck Bunny",
"jellyplex_watched/Movies/The Family Plan",
],
"jellyfin": [
"jellyplex_watched/Movies/Five Nights at Freddy's",
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/301215",
"jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
"jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/300670",
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/300741",
"jellyplex_watched/Movies/The Family Plan",
"jellyplex_watched/Movies/Five Nights at Freddy's"
],
"emby": [
"jellyplex_watched/Movies/Tears of Steel",
"jellyplex_watched/TV shows/Doctor Who (2005)/World War Three (2)",
"jellyplex_watched/TV shows/Monarch: Legacy of Monsters/Parallels and Interiors/240429",
"JellyUser/Movies/Tears of Steel"
]
}
# Expected values for the mark.log file, dry-run is slightly different than write-run
# due to some of the items being copied over from one server to another and now being there
# for the next server run.
if args.dry:
expected_values = expected["dry"]
elif args.write:
expected_values = expected["write"]
elif args.plex:
expected_values = expected["plex"]
elif args.jellyfin:
expected_values = expected["jellyfin"]
elif args.emby:
expected_values = expected["emby"]
else:
print("No server specified")
exit(1)
lines = read_marklog()
if not check_marklog(lines, expected_values):