From 5f7997e3c60c38f11ca8667432bc3826734a9b97 Mon Sep 17 00:00:00 2001 From: Gabo Date: Thu, 19 Sep 2024 18:34:17 +0200 Subject: [PATCH] Avoid start service on end to end tests --- .github/workflows/push-docker-image.yml | 5 ----- .github/workflows/python-app.yml | 12 ++++++++++++ src/QueueProcessor.py | 5 ----- src/test_end_to_end.py | 7 ------- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/.github/workflows/push-docker-image.yml b/.github/workflows/push-docker-image.yml index 5568bf5..25ae019 100644 --- a/.github/workflows/push-docker-image.yml +++ b/.github/workflows/push-docker-image.yml @@ -2,13 +2,8 @@ name: Create and publish Docker image on: push: - branches: - - 'main' tags: - 'v*' - pull_request: - branches: - - 'main' env: REGISTRY: ghcr.io diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 9c16a0d..11aa6af 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -27,5 +27,17 @@ jobs: - name: Lint with flake8 run: ./run check_format + - name: Start service + run: ./run start:testing -d + + - name: Check API ready + uses: emilioschepis/wait-for-endpoint@v1.0.3 + with: + url: http://localhost:5050/info + method: GET + expected-status: 200 + timeout: 60000 + interval: 500 + - name: Test with unittest run: ./run test diff --git a/src/QueueProcessor.py b/src/QueueProcessor.py index ac894b9..3f2c7cf 100644 --- a/src/QueueProcessor.py +++ b/src/QueueProcessor.py @@ -1,11 +1,6 @@ import os -from time import sleep - -import redis from pydantic import ValidationError from queue_processor.QueueProcessor import QueueProcessor -from rsmq.consumer import RedisSMQConsumer -from rsmq import RedisSMQ from sentry_sdk.integrations.redis import RedisIntegration import sentry_sdk diff --git a/src/test_end_to_end.py b/src/test_end_to_end.py index 5a669db..15b5f52 100644 --- a/src/test_end_to_end.py +++ b/src/test_end_to_end.py @@ -23,13 +23,6 @@ def setUp(self): shutil.rmtree(config.paths["processed_pdfs"], ignore_errors=True) shutil.rmtree(config.paths["failed_pdfs"], ignore_errors=True) - def setUpClass(): - subprocess.run("./run start:testing -d", shell=True) - time.sleep(1) - - def tearDownClass(): - subprocess.run("./run stop", shell=True) - def test_sync_ocr(self): ocr_text = self.sync_ocr("sample-english.pdf") self.assertEqual("Test text OCR", ocr_text)