Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-42384: Verify the database schema on startup #964

Merged
merged 1 commit into from
Feb 14, 2024
Merged

Conversation

rra
Copy link
Member

@rra rra commented Feb 14, 2024

Unless it is explicitly disabled (such as by the test suite), check the schema with Alembic during startup to see if it's current and refuse to start if it isn't. Test this by keeping schema validation enabled during Selenium testing, which runs via uvicorn and thus simulates how Gafaelfawr is run in production.

This required changing the Selenium fixtures to not be async, since Alembic doesn't like async for some things. They turned out to have no reason to be async, so this was painless.

At present, this only handles web application startup, not the Kubernetes operator or the audit or maintenance cron jobs.

Unless it is explicitly disabled (such as by the test suite), check
the schema with Alembic during startup to see if it's current and
refuse to start if it isn't. Test this by keeping schema validation
enabled during Selenium testing, which runs via uvicorn and thus
simulates how Gafaelfawr is run in production.

This required changing the Selenium fixtures to not be async, since
Alembic doesn't like async for some things. They turned out to have
no reason to be async, so this was painless.

At present, this only handles web application startup, not the
Kubernetes operator or the audit or maintenance cron jobs.
@rra rra merged commit 871a7d4 into main Feb 14, 2024
5 checks passed
@rra rra deleted the tickets/DM-42384 branch February 14, 2024 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant