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

Initial structure and unit tests for PMR #7

Open
kimwnasptd opened this issue Nov 26, 2024 · 4 comments · May be fixed by #12
Open

Initial structure and unit tests for PMR #7

kimwnasptd opened this issue Nov 26, 2024 · 4 comments · May be fixed by #12
Labels
enhancement New feature or request

Comments

@kimwnasptd
Copy link

kimwnasptd commented Nov 26, 2024

Context

This is the first step for implementing the common module that handles a PMR #8

We discussed for the first iteration to include the code from the common module as part of the GitHub Automator charm and later on move it to be its own repo and PyPi module. So the first step is to submit the code alongside the charm code, and in an easy way to later on decouple from the charm.

What needs to get done

  1. Initialise with charmcraft init the code of the charm
  2. Have the code for the module to live inside the src dir, next to the charm.py
  3. Implement the class that creates a PMR
  4. Have some simple unit tests
  5. Add poetry
  6. Ensure the basic tox environments (lint, format, unit, integration) are working

Then Plan A is to have dedicated tox and poetry environments for unit-library and integration-library that will encapsulate the testing of the common module.

Then the unit and integration tests for the whole charm will also include the tests for the common module

Definition of Done

  1. The repo has an OK README
  2. The existing CI is passing
  3. The common modules are tested alongside the simple charm
@kimwnasptd kimwnasptd added the enhancement New feature or request label Nov 26, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/KF-6592.

This message was autogenerated

@kimwnasptd
Copy link
Author

While working on this issue, I used poetry for handling the dependencies, and tox for running the different environments.

As a north start I used the kafka-k8s-operator repo. Some critical points to expose:

  1. No depends was used from tox
  2. All environments and dependencies were defined as groups in poetry
  3. The tox environments always install the corresponding poetry group's dependencies

@kimwnasptd
Copy link
Author

By using charmcraft init the code initialised the repo and in the pyproject.toml file it explicitly defined line-length: 99 in ruff, that is used for linting.

To align with this, I updated the line-length in black to also be 99

@kimwnasptd
Copy link
Author

kimwnasptd commented Nov 27, 2024

While working on this the CI failed on the Publish action, since

  1. the get-charms-path.sh file was not detecting charm dir if it contained a charmcraft.yaml and not a metadata.yaml file
  2. The newer charmcraft init initialised only the charmcraft.yaml file and not a metadata.yaml one

https://juju.is/docs/sdk/metadata-yaml

This should be resolved in canonical/kubeflow-ci#148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant