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

Replace Talkback proxy with real API server #776

Open
dhruvkb opened this issue Feb 26, 2023 · 3 comments
Open

Replace Talkback proxy with real API server #776

dhruvkb opened this issue Feb 26, 2023 · 3 comments
Labels
💻 aspect: code Concerns the software code in the repository ✨ goal: improvement Improvement to an existing user-facing feature 🟩 priority: low Low priority and doesn't need to be rushed 🧱 stack: api Related to the Django API 🧱 stack: frontend Related to the Nuxt frontend

Comments

@dhruvkb
Copy link
Member

dhruvkb commented Feb 26, 2023

Problem

The Playwright tests currently use a Talkback proxy to simulate API calls. This is suboptimal and adds a lot of overhead for us to manage the tapes (which are essentially copies of the response the API can very well provide).

Description

Since we have images for the API being compiled inside the CI + CD workflow, we can replace the use of Talkback with the live API server. This will provide the following benefits:

  • developing API and frontend features in tandem, without needing to deploy the API, update the tapes and then build the frontend
  • making the repository smaller by getting rid of the tapes and the Talkback package
  • removing the workflow overhead of running a proxy and updating the tapes
@dhruvkb dhruvkb added 🟩 priority: low Low priority and doesn't need to be rushed ✨ goal: improvement Improvement to an existing user-facing feature 💻 aspect: code Concerns the software code in the repository 🧱 stack: api Related to the Django API 🧱 stack: frontend Related to the Nuxt frontend labels Feb 26, 2023
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Openverse Backlog Feb 26, 2023
@sarayourfriend
Copy link
Collaborator

sarayourfriend commented May 23, 2024

Just wanted to pop a note in here that this change would make the API and frontend a requirement for each other when developing changes for either. That's fine by me (I don't think segmenting our stack so finely is a long-term benefit, and #4343 will make it less of an issue for contributors), but it's worth noting as a change from the current approach which relies on the live API.

This could also make it harder to realise issues with expected changes in the API to the frontend. The API and frontend do not deploy in tandem, which means either can be ahead/behind what the other's test suite expects, if they are bound together at test-time to always use the latest code. We'd need to be very careful that our configurations match production expectations for the frontend.

@dhruvkb
Copy link
Member Author

dhruvkb commented May 27, 2024

We could, in theory, use the latest openverse-api image from GHCR to run as the server for the frontend tests, that would be alike to what responses the frontend would receive if merged and deployed to staging. But then we not be able to work on a cross-stack feature for the API and frontend in parallel because the frontend will always be using a minus-one version of the API in the tests.

@sarayourfriend
Copy link
Collaborator

sarayourfriend commented May 27, 2024

The response data would still need to be populated, and that image wired up to database, es, etc. It can be done in Docker compose, but then I wonder what specifically we're trying to get from testing the API in this way.

If the talkback tapes are tedious to have in the repository, we could keep them in a separate repository that gets cloned when the tests are run, or in a separate squashed branch like we do for GitHub pages.

It does all work with talkback though, so I wonder what the real benefit we're looking for from this would be and if there is a different way to achieve it than overhauling how requests are handled in Playwright context.

If we want to get rid of Talkback, I think Playwright's request interception could do the trick too, but we'd still have to write the responses to disk to cache them and write our own version of tape updating logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository ✨ goal: improvement Improvement to an existing user-facing feature 🟩 priority: low Low priority and doesn't need to be rushed 🧱 stack: api Related to the Django API 🧱 stack: frontend Related to the Nuxt frontend
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants