Skip to content

Add support mocking file metadata for tests #2708

Description

@hk21702

It would be quite useful for tests if _TestingPebbleClient's mocked file operations also saved a map of the intended metadata and returned the intended metadata for operations that request it.

In particular, it would be helpful for testing cases where metadata such as file ownership or permissions matter and are being checked, as we otherwise need to mock it ourselves.

To give a more concrete example, if we have behavior dependent on the return from charmlibs.pathops's ensure_contents, and we want to ensure a file with a particular user/group/set of permissions, in unit test scenarios, it will never match because we are otherwise checking against the metadata from the host file system.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    27.04An item we hope to do in the 27.04 cycleroadmapAn official roadmap item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions