cleanup category handling

This commit is contained in:
2026-03-27 22:46:45 -07:00
parent 7f395bd9b3
commit 35c6d1b821
2 changed files with 77 additions and 24 deletions

View File

@@ -182,16 +182,7 @@ pkgs.testers.runNixOSTest {
prowlarrUrl = "http://localhost:9696";
baseUrl = "http://localhost:8989";
apiKeyFrom = "/var/lib/sonarr/.config/NzbDrone/config.xml";
syncCategories = [
5000
5010
5020
5030
5040
5045
5050
5090
];
# syncCategories omitted — auto-detected from Prowlarr API
serviceName = "sonarr";
}
{
@@ -201,18 +192,7 @@ pkgs.testers.runNixOSTest {
prowlarrUrl = "http://localhost:9696";
baseUrl = "http://localhost:7878";
apiKeyFrom = "/var/lib/radarr/.config/Radarr/config.xml";
syncCategories = [
2000
2010
2020
2030
2040
2045
2050
2060
2070
2080
];
# syncCategories omitted — auto-detected from Prowlarr API
serviceName = "radarr";
}
];
@@ -325,6 +305,34 @@ pkgs.testers.runNixOSTest {
"jq -e '.[] | select(.name == \"Radarr\")'"
)
# Verify auto-detected syncCategories are non-empty for Sonarr (TV: 5xxx)
machine.succeed(
"API_KEY=$(grep -oP '(?<=<ApiKey>)[^<]+' /var/lib/prowlarr/config.xml) && "
"curl -sf http://localhost:9696/api/v1/applications -H \"X-Api-Key: $API_KEY\" | "
"jq -e '.[] | select(.name == \"Sonarr\") | .fields[] | select(.name == \"syncCategories\") | .value | length > 0'"
)
# Verify auto-detected syncCategories contain parent TV category (5000)
machine.succeed(
"API_KEY=$(grep -oP '(?<=<ApiKey>)[^<]+' /var/lib/prowlarr/config.xml) && "
"curl -sf http://localhost:9696/api/v1/applications -H \"X-Api-Key: $API_KEY\" | "
"jq -e '.[] | select(.name == \"Sonarr\") | .fields[] | select(.name == \"syncCategories\") | .value | map(select(. == 5000)) | length > 0'"
)
# Verify auto-detected syncCategories are non-empty for Radarr (Movies: 2xxx)
machine.succeed(
"API_KEY=$(grep -oP '(?<=<ApiKey>)[^<]+' /var/lib/prowlarr/config.xml) && "
"curl -sf http://localhost:9696/api/v1/applications -H \"X-Api-Key: $API_KEY\" | "
"jq -e '.[] | select(.name == \"Radarr\") | .fields[] | select(.name == \"syncCategories\") | .value | length > 0'"
)
# Verify auto-detected syncCategories contain parent Movies category (2000)
machine.succeed(
"API_KEY=$(grep -oP '(?<=<ApiKey>)[^<]+' /var/lib/prowlarr/config.xml) && "
"curl -sf http://localhost:9696/api/v1/applications -H \"X-Api-Key: $API_KEY\" | "
"jq -e '.[] | select(.name == \"Radarr\") | .fields[] | select(.name == \"syncCategories\") | .value | map(select(. == 2000)) | length > 0'"
)
# Idempotency test: restart init services and verify no duplicate entries
machine.succeed("systemctl restart sonarr-init.service")
machine.succeed("systemctl restart radarr-init.service")