Skip to main content

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:

  1. Waits for all units to be active (with 3 consecutive successes)
  2. Checks for any errors
  3. Waits for all agents to be idle

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

charmarr_lib_testing-0.8.1.tar.gz (15.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

charmarr_lib_testing-0.8.1-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file charmarr_lib_testing-0.8.1.tar.gz.

File metadata

  • Download URL: charmarr_lib_testing-0.8.1.tar.gz
  • Upload date:
  • Size: 15.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for charmarr_lib_testing-0.8.1.tar.gz
Algorithm Hash digest
SHA256 e8019780498e3d555d2b6665a04ccd834244bc517ee83197997598f7141326de
MD5 5c5b2ec2b9a8e970314f1fbc23aafae3
BLAKE2b-256 7acb2a3849981524ca79b6b2d90b1fc2fb9cf6e3d9bf8c85873b210d709be252

See more details on using hashes here.

Provenance

The following attestation bundles were made for charmarr_lib_testing-0.8.1.tar.gz:

Publisher: release.yml on charmarr/charmarr-lib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file charmarr_lib_testing-0.8.1-py3-none-any.whl.

File metadata

File hashes

Hashes for charmarr_lib_testing-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cfc53bb80ae78ac7b710a41aad5673dd75755ea6a9059ee4126f1d585e396865
MD5 a84884f71b4b271c9643d9873ef971a1
BLAKE2b-256 cccdcc838d5e2a448be4eef36869f2cbedc5dbf401976f621c767b2bddcdca52

See more details on using hashes here.

Provenance

The following attestation bundles were made for charmarr_lib_testing-0.8.1-py3-none-any.whl:

Publisher: release.yml on charmarr/charmarr-lib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.8.1 This release

2 files

0.8.0

2 files

0.7.5

2 files

0.7.4

2 files

0.7.3

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page