Testing utilities for Charmarr charms
Project description
charmarr-lib-testing
Testing utilities for Charmarr charms.
Features
- TFManager for Terraform/OpenTofu-based integration testing
- Jubilant integration for Juju model stabilization
- Minimal, focused utilities (step definitions added as patterns emerge)
Installation
pip install charmarr-lib-testing
Usage
TFManager
Wrapper around Terraform/OpenTofu for integration tests. Prefers OpenTofu if available.
from pathlib import Path
from charmarr_lib.testing import TFManager
# Initialize with terraform directory
tf = TFManager(Path("./terraform"))
tf.init()
# Apply with environment variables (e.g., for Juju credentials)
tf.apply(env={"TF_VAR_model_name": "my-model"})
# Get outputs
model_name = tf.output("model_name")
# Cleanup
tf.destroy(env={"TF_VAR_model_name": "my-model"})
wait_for_active_idle
Wait for Juju models to stabilize after deployment.
from charmarr_lib.testing import wait_for_active_idle
import jubilant
# Single model
juju = jubilant.Juju()
wait_for_active_idle(juju, timeout=60 * 20) # 20 minutes
# Multiple models (e.g., cross-model relations)
jujus = [jubilant.Juju(model="model-a"), jubilant.Juju(model="model-b")]
wait_for_active_idle(jujus)
The function:
- Waits for all units to be active (with 3 consecutive successes)
- Checks for any errors
- Waits for all agents to be idle
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file charmarr_lib_testing-0.6.0.tar.gz.
File metadata
- Download URL: charmarr_lib_testing-0.6.0.tar.gz
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc95c15fbaa565d75359c0840e44eb3a4749cc29ee3de74427f723dce1d3f4f8
|
|
| MD5 |
a64c83773131d80d2088d0abda32002e
|
|
| BLAKE2b-256 |
e7020e68b228c0e305cb1aafd60e4259dc5a1d4fcf70f3f42fc65b2f250579fc
|
Provenance
The following attestation bundles were made for charmarr_lib_testing-0.6.0.tar.gz:
Publisher:
release.yml on charmarr/charmarr-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
charmarr_lib_testing-0.6.0.tar.gz -
Subject digest:
fc95c15fbaa565d75359c0840e44eb3a4749cc29ee3de74427f723dce1d3f4f8 - Sigstore transparency entry: 782033364
- Sigstore integration time:
-
Permalink:
charmarr/charmarr-lib@e71f47160d07f8a63111dbf813894620c344dcd0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/charmarr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e71f47160d07f8a63111dbf813894620c344dcd0 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file charmarr_lib_testing-0.6.0-py3-none-any.whl.
File metadata
- Download URL: charmarr_lib_testing-0.6.0-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5d5cca955aebc197b65c7d9e166bc15c5b99e0228dcef1574e7f97b0a64455b
|
|
| MD5 |
57e75fac5aea40a111fc2d7a34bb4449
|
|
| BLAKE2b-256 |
3ab3e2e23bd9f2c4aa1053350240121d535b467f83b3a0d935b626c90472d05a
|
Provenance
The following attestation bundles were made for charmarr_lib_testing-0.6.0-py3-none-any.whl:
Publisher:
release.yml on charmarr/charmarr-lib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
charmarr_lib_testing-0.6.0-py3-none-any.whl -
Subject digest:
a5d5cca955aebc197b65c7d9e166bc15c5b99e0228dcef1574e7f97b0a64455b - Sigstore transparency entry: 782033366
- Sigstore integration time:
-
Permalink:
charmarr/charmarr-lib@e71f47160d07f8a63111dbf813894620c344dcd0 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/charmarr
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@e71f47160d07f8a63111dbf813894620c344dcd0 -
Trigger Event:
workflow_run
-
Statement type: