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

Fix KeyError in promote endpoint #35

Merged
merged 15 commits into from
Aug 11, 2023
Merged

Fix KeyError in promote endpoint #35

merged 15 commits into from
Aug 11, 2023

Conversation

nadzyah
Copy link
Collaborator

@nadzyah nadzyah commented Aug 7, 2023

This PR closes RTW-132

Here we use "ubuntu" as default snap store unless otherwise specified in artefact source. Also, I've added the test to make sure it works

Also, I've added the following migrations for the Artefact model:

  • to make sure that existing snap artefacts have "store" key in the source field. If not, we set it to be "ubuntu"
  • to require the "store" key in source field for snap artefacts when they are created or updated. If the field is not specified, PostgreSQL raises an exception

Also, I've modified the tests and seed_data script to specify the "store" key in sample data.

@nadzyah
Copy link
Collaborator Author

nadzyah commented Aug 8, 2023

While working on this fix and creating an empty migration, I noticed that there are other changes that didn't have any migration. So, one migration was created automatically by alembic

@nadzyah nadzyah marked this pull request as ready for review August 8, 2023 12:06
@nadzyah nadzyah requested review from omar-selo and jocave and removed request for omar-selo and jocave August 8, 2023 12:06
Copy link
Collaborator

@omar-selo omar-selo left a comment

Choose a reason for hiding this comment

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

Looks good. Mainly an issue that I caused before with unique index

Copy link
Collaborator

@jocave jocave left a comment

Choose a reason for hiding this comment

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

Don't feel I can sign-off the implementation, but the description of the changes sounds fine.

My only question is whether we should validate the value provided for store?

@nadzyah
Copy link
Collaborator Author

nadzyah commented Aug 10, 2023

Don't feel I can sign-off the implementation, but the description of the changes sounds fine.

My only question is whether we should validate the value provided for store?

I’ve added the value validation locally. I’ll push them after fixing all the tests (or finally finding the reason why they fail)

Copy link
Collaborator

@omar-selo omar-selo left a comment

Choose a reason for hiding this comment

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

Good job. Overall I think this approach of validation is better than the one baked in the DB. Just a few small comments, nothing major

@nadzyah nadzyah requested a review from omar-selo August 11, 2023 11:53
Copy link
Collaborator

@omar-selo omar-selo left a comment

Choose a reason for hiding this comment

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

LGTM!

@nadzyah nadzyah merged commit 801fd42 into main Aug 11, 2023
5 checks passed
@nadzyah nadzyah deleted the fix-promote branch August 11, 2023 12:00
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.

3 participants