ci: clear stale qBittorrent container in e2e #277

Merged
naps62-yolo merged 2 commits from ci/e2e-stale-container into main 2026-11-11 00:02:06 +00:00
2 changed files with 48 additions and 3 deletions
+23 -3
View File
@@ -18,6 +18,12 @@ on:
- 'crates/arr-daemon/**'
- '.gitea/workflows/e2e.yml'
# The qBittorrent container below has a fixed name and binds the runner host's
# port 8080, so two runs at once would trip over each other.
concurrency:
group: arr-e2e
cancel-in-progress: false
env:
CARGO_TERM_COLOR: always
CARGO_PROFILE_DEV_DEBUG: "0"
@@ -77,7 +83,13 @@ jobs:
# variable for the WebUI password and prints a random one per boot,
# so the only scriptable login is a config seeded before first start,
# which a service container cannot be given.
#
# `docker` here talks to the runner host's daemon, so a bind mount
# would name a host path this job never wrote. The config is copied
# in instead. A container left by a run that died before teardown is
# removed first; the name is fixed, so it would block every run after.
run: |
docker rm -f arr-e2e-qbittorrent >/dev/null 2>&1 || true
mkdir -p /tmp/qbt/config/qBittorrent
cat > /tmp/qbt/config/qBittorrent/qBittorrent.conf <<'CONF'
[Preferences]
@@ -88,14 +100,18 @@ jobs:
WebUI\HostHeaderValidation=false
Downloads\SavePath=/downloads
CONF
docker run -d --name arr-e2e-qbittorrent --network host \
docker create --name arr-e2e-qbittorrent --network host \
-e PUID=1000 -e PGID=1000 -e WEBUI_PORT=8080 \
-v /tmp/qbt/config:/config \
linuxserver/qbittorrent:latest
docker cp /tmp/qbt/config/. arr-e2e-qbittorrent:/config/
docker start arr-e2e-qbittorrent
for _ in $(seq 1 60); do
curl -sf http://127.0.0.1:8080/api/v2/app/version && break
curl -sf http://127.0.0.1:8080/api/v2/app/version && exit 0
sleep 2
done
echo "qBittorrent never answered" >&2
docker logs arr-e2e-qbittorrent >&2 || true
exit 1
- name: build daemon
# The harness spawns this binary; building it here keeps the compile
@@ -107,3 +123,7 @@ jobs:
env:
QBITTORRENT_URL: http://127.0.0.1:8080
run: cargo nextest run -p arr-e2e
- name: stop qBittorrent
if: always()
run: docker rm -f arr-e2e-qbittorrent >/dev/null 2>&1 || true
+25
View File
@@ -30,6 +30,31 @@ async fn daemon_runs_against_fakes_and_a_real_qbittorrent() {
let daemon = Daemon::spawn(&prowlarr.url(), &tmdb.url(), &qbittorrent_url()).await;
let base = daemon.base_url();
// The seed enables OpenSubtitles, and this daemon has no credentials for
// it, which the health report rightly calls degraded. Nothing here is
// about subtitles, so turn the providers off.
let client = reqwest::Client::new();
let mut settings: serde_json::Value = client
.get(format!("{base}/api/settings/subtitles"))
.send()
.await
.expect("read subtitle settings")
.json()
.await
.expect("subtitle settings json");
settings["providers_enabled"] = serde_json::json!([]);
let saved = client
.put(format!("{base}/api/settings/subtitles"))
.json(&settings)
.send()
.await
.expect("save subtitle settings");
assert!(
saved.status().is_success(),
"{}",
saved.text().await.unwrap_or_default()
);
let health = daemon.health().await;
assert_eq!(health["status"], "ok", "health report: {health}");
assert_eq!(health["prowlarr"]["status"], "ok");