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: allow use of interceptable mknod in ProviderService #607

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mattculler
Copy link
Contributor

@mattculler mattculler commented Jan 15, 2025

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run tox?

Make use of craft_providers's new intercept_mknod argument to LXDProvider.

canonical/craft-providers#717

@mattculler mattculler marked this pull request as ready for review January 16, 2025 15:45
@mattculler mattculler self-assigned this Jan 16, 2025
@upils upils requested review from upils and mr-cal January 16, 2025 16:10
@mattculler
Copy link
Contributor Author

Failing integration tests will be fixed by #587

Comment on lines +12 to +13
"craft-providers @ git+https://github.com/canonical/craft-providers.git@work/CRAFT-2568-settable-mknod-intercept",
#"craft-providers>=2.1.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reminder to future self: update this once I release a new craft-providers.

Copy link
Contributor

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

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

I'd like to see unit tests for the logic, otherwise looks good. Thanks for filling out the docstrings.

@@ -237,7 +237,7 @@ def test_get_lxd_provider(monkeypatch, provider_service, lxd_remote, check):
check.equal(actual, mock_provider.return_value)
with check:
mock_provider.assert_called_once_with(
lxd_project="testcraft", lxd_remote=lxd_remote
lxd_project="testcraft", lxd_remote=lxd_remote, intercept_mknod=True
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you exercise the default value and setting ProviderService(intercept_mknod)?

A quick way to do this would be to instantiate a ProviderService like some of the other tests and add something along the lines of @pytest.param("intercept_mknod", [None, True, False])

@@ -68,13 +73,16 @@ def __init__(
build_plan: list[models.BuildInfo],
provider_name: str | None = None,
install_snap: bool = True,
intercept_mknod: bool = True,
Copy link

Choose a reason for hiding this comment

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

Here and in craft-providers this is set to True by default. But according to the discussion in canonical/craft-providers#191 I understand the proposition was to set it to False by default. Is that a mistake or did we change our mind?

return LXDProvider(
lxd_project=self._app.name,
lxd_remote=lxd_remote,
intercept_mknod=self._intercept_mknod,
Copy link

Choose a reason for hiding this comment

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

nitpick?: I feel like this is an implementation detail, or at least something living at a deeper abstraction level than the other arguments given to the LXDProvider class.

I do not have a good solution and I do not really know if we will ever need to gather other configuration values of this kind at some point in the future but maybe this should be in a "lxd_tuning" object?

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