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

feat: fastapi schema-registry module with DI and E2E tests #995

Open
wants to merge 30 commits into
base: jjaakola-aiven-fastapi
Choose a base branch
from

Conversation

nosahama
Copy link
Contributor

@nosahama nosahama commented Nov 27, 2024

About this change - What it does

Some changes based off the work from the jjaakola-aiven-fastapi branch, majorly:

  • integrations tests which are failing need to be checked and resolved
    • some of the tests can be moved to the e2e folder
    • it'd be nice to stop spinning up all these kafka processes
    • it'd be nice to move this into the docker tests environment
    • i am not making any changes to the integration tests setup, so it's clear that we aren't changing logic that should verify the operability of our services
    • the integration tests fail now with issues spinning up kafka, so we can check that now or after we merge this work
  • unit tests now run within a docker compose environment
  • e2e tests were introduced, which also run within a docker compose environment
    • the plan is to extract some test out of the integration tests folder slowly into the e2e tests folder
    • e2e tests run against the karapace docker compose services: i.e. schema-registry/rest rather than local processes
  • karapace schema registry is now it's own module which houses all the FastAPI related things
  • karapace rest proxy still runs on rapu
  • we add dependency injection to the project
    • wiring the dependencies for both sr and rest
    • config is loaded on app startup
    • dependencies are injected into route handlers and other modules
    • modules with dependencies are wired on app startup
  • config is now based on pydantic-settings
    • settings are loaded via an .env file
    • base config is added as a yaml and packaged with the built python library
    • base config loads the reference to the .env file needed to populate the rest of the config
  • commits show progress
  • initial draft PR schema_registry: standalone module for SR with basic dependency injection #994 was rushed and contained more changes, this is a split out of that PR which will be closed at some point
  • we would need to check the coverage mechanism now with the new module and split

jjaakola-aiven and others added 28 commits November 13, 2024 13:09
- we create a standalone module for SR related components

- we use DI to wire together the SR dependencies

- we move the routers to own folder

- we move the config initialization to DI and app startup
- we add a docker compose service which would act like a CLI

- we add a dev Dockerfile

- we drop python3.9 from the tests matrix as pydantic-settings has issues with python3.9

- we add .env files for both registry and rest
- we replace use the karapace container to load the default config
@nosahama nosahama requested review from a team as code owners November 27, 2024 10:59
@nosahama nosahama marked this pull request as draft November 27, 2024 12:18
@nosahama nosahama marked this pull request as ready for review November 27, 2024 12:19
@nosahama nosahama force-pushed the nosahama/fastapi-sr-module-with-DI-e2e-tests branch 5 times, most recently from 74c54af to d336032 Compare November 27, 2024 12:39
@@ -6,6 +6,7 @@ for ((i = 0; i <= retries; i++)); do
response=$(
curl --silent --verbose --fail --request POST \
--header 'Content-Type: application/vnd.schemaregistry.v1+json' \
--header 'Authorization: Basic Og==' \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This are empty credentials, i.e. username="" | password="", this is needed as now on FastAPI we require the credentials to be at least present, even if it's empty, we can revise this later as it'd be now a breaking change, but shouldn't hurt too much.

@@ -0,0 +1,62 @@
# Current versions of avro and zstandard don't yet have wheels for 3.11.
FROM python:3.10.11-bullseye AS builder
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to Dockerfile, we install dev dependencies and take out the healthcheck.

- we split out e2e tests into own folder

- e2e tests will run against the service in docker compose

- we start by splitting out the prometheus and kafka e2e tests which do not need local running services
@nosahama nosahama force-pushed the nosahama/fastapi-sr-module-with-DI-e2e-tests branch from d336032 to f52fe6c Compare November 27, 2024 12:52
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.

2 participants