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

CB-401, CB-408: Return 404 for entities that don't exist in the MB database #398

Merged
merged 6 commits into from
Mar 1, 2022

Conversation

alastair
Copy link
Collaborator

This is a prerequisite to upgrading to BU 2.0 - we removed the concept of "unknown entities", and so had to make a decision about how to present these in CB.

Based on discussion in CB-401 and CB-408, we decided to explicitly return 404 on all entity pages that don't exist, and also on review pages for entities that don't exist.

In a future PR, we'll add an admin interface to see these items, and add the ability to change the entity id that the review is targeting, or delete the review.

In 754f5a7 I reverted a change that removed the test config file, because I realised that the test db name is different in tests and development.
Because create_app actually connects to the database in the config file, it's not possible to create the app and then change the config value and then connect to the database. Easier to revert the change.

I switched from using the metabrainz/musicbrainz-test-database:beta postgres image to metabrainz/brainzutils-mb-sample-database:schema-25-2021-04-04.0. This is much faster to start up (I was waiting ~10-15 seconds for the initial setup and schema creation every time I ran tests, now it's basically instant), and now the database has real musicbrainz data in it. This means that we were able to get rid of a bunch of mocks, which have always been a bit flaky for us. This involved changing a few entity mbids in tests to ones which were in the database.

Also fixed a bug in get_revision_number that showed up during testing, and pinned some dependency versions.

Needed to prevent incompatibility with newer versions and our current
version of flask
Removed in 13fc976 because we thought that the configuration was the
same in both development and test due to the docker isolation, however
the name of the musicbrainz database in test is different.
We could have manually modified the config in each test base class, but
it seems easier to just revert the test-specific config file.
CB-401
We originally had the ability to show a page about an "Unknown entity"
if an MBID didn't exist in the database. This was useful when CB
connected to an MB replica that may have been out of date by up to an
hour. This would also allow us to show a review if an entity had since
been deleted.
Now CB connects directly to the main MB site, so this isn't an issue.
For entities that have been deleted we decided to handle these on a
case-by-case basis: CB-408

This commit also introduces the use of the brainzutils-mb-sample-database
docker image for the musicbrainz data source. This is a real database
with real data which allows us to test real/missing MBIDs without
needing to mock methods or insert test data at the beginning of each
test. It also makes test starup a bit faster.
This would fail if you requested a revision number greater than the
number of revisions that a review had
This affects review pages, the browse review page, and the list of
reviews by a user
@alastair alastair requested a review from amCap1712 February 28, 2022 16:28
@github-actions

This comment has been minimized.

Copy link
Member

@amCap1712 amCap1712 left a comment

Choose a reason for hiding this comment

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

LGTM

@alastair alastair merged commit c7ad0e1 into master Mar 1, 2022
@alastair alastair deleted the CB-401-nosuchentity branch March 1, 2022 09:53
@github-actions
Copy link

github-actions bot commented Mar 1, 2022

Unit Test Results

    1 files  ±0      1 suites  ±0   1m 16s ⏱️ ±0s
152 tests ±0  150 ✔️ ±0  0 💤 ±0  2 ❌ ±0 

For more details on these failures, see this check.

Results for commit c7ad0e1. ± Comparison against base commit c7ad0e1.

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