diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 91343946..7d5db5e2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -29,6 +29,15 @@ jobs: POSTGRES_DB: test_neodb_takahe ports: - 15432:5432 + typesense: + image: typesense/typesense:27.1 + env: + TYPESENSE_API_KEY: testpass + TYPESENSE_DATA_DIR: /data + ports: + - 8108:8108 + volumes: + - ts_data:/data strategy: max-parallel: 4 matrix: @@ -49,6 +58,7 @@ jobs: NEODB_DB_URL: postgres://testuser:testpass@127.0.0.1/test_neodb TAKAHE_DB_URL: postgres://testuser:testpass@127.0.0.1/test_neodb_takahe NEODB_REDIS_URL: redis://127.0.0.1:6379/0 + NEODB_SEARCH_URL: typesense://testuser:testpass@127.0.0.1:8108/catalog NEODB_SITE_NAME: test NEODB_SITE_DOMAIN: test.domain NEODB_SECRET_KEY: test diff --git a/common/setup.py b/common/setup.py index 2ee72983..68559f6f 100644 --- a/common/setup.py +++ b/common/setup.py @@ -109,27 +109,22 @@ class Setup: ) def run(self): - if settings.TESTING: - # Only do necessary initialization when testing - logger.info("Running minimal post-migration setup for testing...") - self.sync_site_config() - Indexer.init() - return - logger.info("Running post-migration setup...") # Update site name if changed self.sync_site_config() - # Subscribe to default relay if enabled - self.sync_relay() - # Create basic emoji if not exists # Create search index if not exists Indexer.init() JournalIndex.instance().initialize_collection() + if settings.TESTING: + # Only do necessary initialization when testing + logger.info("Finished post-migration setup, skipped some for testing.") + return + # Register cron jobs if not yet if settings.DISABLE_CRON_JOBS and "*" in settings.DISABLE_CRON_JOBS: logger.info("Cron jobs are disabled.") @@ -137,6 +132,9 @@ class Setup: else: JobManager.reschedule_all() + # Subscribe to default relay if enabled + self.sync_relay() + logger.info("Finished post-migration setup.") def check(self):