Skip to content

feat: add TLS Certificates testing library (demo, do not merge)#331

Draft
james-garner-canonical wants to merge 31 commits intocanonical:mainfrom
james-garner-canonical:26-02+feat+tls-certficates-testing
Draft

feat: add TLS Certificates testing library (demo, do not merge)#331
james-garner-canonical wants to merge 31 commits intocanonical:mainfrom
james-garner-canonical:26-02+feat+tls-certficates-testing

Conversation

@james-garner-canonical
Copy link
Collaborator

No description provided.

Squashed commit of the following:

commit ef90d9f
Author: James Garner <[email protected]>
Date:   Tue Feb 3 14:25:25 2026 +1300

    fix: correct type checking issues in tls-certificates lib
Squashed commit of the following:

commit 1e85f9f95d17d84343389bc9eb19dac6117b193a
Author: James Garner <[email protected]>
Date:   Thu Feb 5 21:54:54 2026 +1300

    ci: install uv to run new script

commit 7464d544aaa49b1d5115e97761c2d20d03c3337e
Author: James Garner <[email protected]>
Date:   Thu Feb 5 21:50:52 2026 +1300

    ci: add CI job and script to check testing versions match

commit 44a42f0b7f4fa611513c233dc8ef7072cd4027a1
Author: James Garner <[email protected]>
Date:   Thu Feb 5 21:49:23 2026 +1300

    ci: change approach to adding testing packages to ls.py output

commit a2eb5ce9bc5473000735e34161855571c3b0a0e5
Author: James Garner <[email protected]>
Date:   Tue Feb 3 18:49:12 2026 +1300

    ci: support testing packages in ls.py
@james-garner-canonical james-garner-canonical force-pushed the 26-02+feat+tls-certficates-testing branch from d68722e to 60c51f1 Compare February 5, 2026 08:56
@james-garner-canonical james-garner-canonical changed the title feat: add TLS Certficates testing library (demo, do not merge) feat: add TLS Certificates testing library (demo, do not merge) Feb 16, 2026
echo '${{ toJSON(needs) }}' | jq # logging
exit 1

testing-versions-match:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this change be hoisted into own PR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This PR includes both an example of a library testing package, and the CI changes needed to support testing and releasing it (also proposed in the spec). They can be separated when either is ready to merge, but for now I think they should stay in one PR -- primarily so the tests for the testing package actually run, but also to show the CI changes required by the spec.

Comment on lines +157 to +158
if category == 'packages':
dirs.extend([t for p in dirs if _is_package(t := p / 'testing')])
Copy link
Contributor

Choose a reason for hiding this comment

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

this change, if needed, should be in a separate PR

@@ -0,0 +1,61 @@
#!/usr/bin/env -S uv run --script --no-project
Copy link
Contributor

Choose a reason for hiding this comment

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

move out of the example PR used in the spec

remote_units_data: dict[int, dict[str, str]]


def for_local_requirer(
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the naming out of date wrt. spec, where names like relation_for_requirer are used?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

github says that there are "white-space only changes" and doesn't show them.
Consider adding a sentence or two.
After all, this will be visible on PYPI.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this is just an empty file to satisfy hatch at build time. We'd provide a real readme if we published this package.

Comment on lines +34 to +36
ctx = ops.testing.Context(provider_charm.ProviderCharm, meta=provider_charm.META)
relation = ops.testing.Relation("certificates", interface="tls-certificates")
state = ops.testing.State(relations=[relation])
Copy link
Contributor

Choose a reason for hiding this comment

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

we seem to prefer this idiom in Ops docs:

import ops
from ops import testing

ctx = testing.Context(...)
relation = testing.Relation(...)
state testing.State(...)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well spotted, I used that approach in test_testing.py but not in test_*_charm.py for some reason.

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.

2 participants