Skip to main content

Testing utilities for Charmarr charms

Project description

Charmarr Lib

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

Project details


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.3.0.tar.gz (6.6 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.3.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: charmarr_lib_testing-0.3.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for charmarr_lib_testing-0.3.0.tar.gz
Algorithm Hash digest
SHA256 a5d1549dc20c71e44c4be3ee2a1fdc33da7379f22fd3a68f5fec391de1a1419c
MD5 a4f52544846abb6e17a5ace0a48d88fd
BLAKE2b-256 fa48048e4d398b019450c8ee1da851b4ce339b9429e1878cc56730954629173b

See more details on using hashes here.

Provenance

The following attestation bundles were made for charmarr_lib_testing-0.3.0.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.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for charmarr_lib_testing-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 394b5a26d008f55965491c6faaa8d9f43c79dc332ac7b7fd45d98e9a9bcb4014
MD5 a84be9aa76b38fa728c0cf2139812b68
BLAKE2b-256 86f6486f554c510eac3084a98dddfc7355aebb31bb2de120ec30577ac8599889

See more details on using hashes here.

Provenance

The following attestation bundles were made for charmarr_lib_testing-0.3.0-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.

Supported by

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