add typesense for testing

This commit is contained in:
Your Name 2024-12-30 02:06:11 -05:00 committed by Henri Dickson
parent 6d5c0a43d4
commit 60040fa956
2 changed files with 18 additions and 10 deletions

View file

@ -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

View file

@ -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):