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

Add a fuller integration test, and multiple minor changes to support it #56

Merged
merged 5 commits into from
Apr 17, 2023

Conversation

tigarmo
Copy link
Collaborator

@tigarmo tigarmo commented Apr 13, 2023

This PR's main purpose is to add an integration test that exercises repo.install() covering the repository types that we currently support. In order to do this, I had to make multiple minor changes. The updates are applied over a handful of self-confined commits, which I hope will make the review easier. At merge time we can keep them as-is or squash 'em all, I don't have a strong preference either way.

CRAFT-1649
CRAFT-1682

tigarmo added 3 commits April 13, 2023 09:38
The main motivation is to facilitate mocking the default paths in
tests, but this follows our standard of using Optionals for parameters
that are, well, optional.
AptKeyManager.is_key_installed() was a classmethod and had a parameter
with the path to search. However, the function is only ever called with
an instance of the class, and then the parameter is misleading because
the instance already has its own keyring path. Now AptKeyManager
instances will look for keys inside their own _keyrings_path.
@tigarmo tigarmo force-pushed the CRAFT-1649-integration-test branch from 2899b0c to ab86690 Compare April 13, 2023 18:09
@codecov
Copy link

codecov bot commented Apr 13, 2023

Codecov Report

Merging #56 (1a7d636) into main (bc08456) will increase coverage by 0.06%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #56      +/-   ##
==========================================
+ Coverage   83.96%   84.03%   +0.06%     
==========================================
  Files          13       13              
  Lines         786      789       +3     
  Branches      182      181       -1     
==========================================
+ Hits          660      663       +3     
  Misses         89       89              
  Partials       37       37              
Impacted Files Coverage Δ
craft_archives/repo/apt_key_manager.py 98.19% <100.00%> (+0.05%) ⬆️
craft_archives/repo/apt_preferences_manager.py 87.20% <100.00%> (ø)
craft_archives/repo/apt_sources_manager.py 93.75% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@tigarmo tigarmo force-pushed the CRAFT-1649-integration-test branch from ab86690 to 40e24ed Compare April 13, 2023 18:18
tigarmo added 2 commits April 13, 2023 15:26
The test calls repo.install() to verify the integrated behavior of
AptKeyManager, AptSourceManager and AptPreferencesManager. It does some
mocking of default paths because repo.install() doesn't take a "base"
directory, and the intention of this commit is to check the code
without changing its behavior.
This is a leftover from the code move; the rest of the code is already
using "craft-" as a prefix. As this is an internal change, no clients
are expected to break.
@tigarmo tigarmo force-pushed the CRAFT-1649-integration-test branch from 40e24ed to 1a7d636 Compare April 13, 2023 18:26
@tigarmo tigarmo marked this pull request as ready for review April 13, 2023 18:29
@tigarmo tigarmo requested a review from lengau April 13, 2023 18:29
@sergiusens sergiusens requested a review from mr-cal April 14, 2023 13:57
Copy link
Collaborator

@lengau lengau left a comment

Choose a reason for hiding this comment

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

This looks great, thank you!

@sergiusens sergiusens merged commit ff7474b into canonical:main Apr 17, 2023
@tigarmo tigarmo deleted the CRAFT-1649-integration-test branch April 17, 2023 12:41
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