From 743bddcb238fa59ce17cd6c833cb02897307b404 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Sat, 10 Jan 2026 09:22:46 -0500 Subject: [PATCH] add valkey to pytest ci --- .github/workflows/pytest.yml | 8 ++++++++ backend/tasks/tasks.py | 5 ++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 266c878a1..8fd8d301f 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -29,6 +29,12 @@ jobs: MYSQL_DATABASE: romm_test MYSQL_ROOT_PASSWORD: passwd options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3 + valkey: + image: valkey/valkey:7.2 + ports: + - 6379 + options: >- + --health-cmd="redis-cli ping" --health-interval=5s --health-timeout=2s --health-retries=3 steps: - name: Checkout repository uses: actions/checkout@v4.3.0 @@ -57,6 +63,8 @@ jobs: env: DB_HOST: 127.0.0.1 DB_PORT: ${{ job.services.mariadb.ports['3306'] }} + REDIS_HOST: 127.0.0.1 + REDIS_PORT: ${{ job.services.valkey.ports['6379'] }} run: | cd backend uv run pytest -vv --maxfail=10 --junitxml=pytest-report.xml --cov --cov-report xml:coverage.xml --cov-config=.coveragerc . diff --git a/backend/tasks/tasks.py b/backend/tasks/tasks.py index 9367c5cd4..076de6726 100644 --- a/backend/tasks/tasks.py +++ b/backend/tasks/tasks.py @@ -1,5 +1,6 @@ from abc import ABC, abstractmethod from enum import Enum +from itertools import chain from typing import Any import httpx @@ -77,9 +78,7 @@ class PeriodicTask(Task, ABC): self.func = func def _get_existing_job(self) -> Job | None: - existing_jobs = list(tasks_scheduler.get_jobs()) + list( - low_prio_queue.get_jobs() - ) + existing_jobs = chain(tasks_scheduler.get_jobs(), low_prio_queue.get_jobs()) for job in existing_jobs: if isinstance(job, Job) and get_job_func_name(job) == self.func: return job