Skip to main content

A plugin to provide different types and configs of Kubernetes clusters that can be used for testing.

Project description

pytest-helm-charts

build codecov Documentation Status PyPI Version Python Versions Apache License

A plugin to test helm charts on Kubernetes clusters.

Full documentation (including API) available on https://pytest-helm-charts.readthedocs.io/.


Features

This plugin provides a set of pytest fixtures that allow you to easily write tests for Helm charts and run them on Kubernetes clusters.

It can be also used to test Helm charts deployed using the Open Source Giant Swarm App Platform.

Most important features:

Requirements

Please check [tool.poetry.dependencies] list in the pyproject.toml file.

Installation

You can install "pytest-helm-charts" via pip from PyPI:

pip install pytest-helm-charts

Usage

Running your tests

When you want to run your tests, you invoke pytest as usual, just configuring cluster and chart information using environment variables or command line options. The following options are available as environment variables (start pytest with -h to check corresponding command line options):

  • "KUBECONFIG" - (mandatory) a path to kube config file used to connect to a k8s cluster
  • "ATS_CHART_PATH" - path to a chart being tested (if a chart is tested)
  • "ATS_CHART_VERSION" - version of the chart being tested (if a chart is tested)
  • "ATS_CLUSTER_TYPE" - type of the cluster used for testing
  • "ATS_CLUSTER_VERSION" - k8s version of the cluster used for testing
  • "ATS_APP_CONFIG_FILE_PATH" - optional path to a values.yaml file used to configure a chart under test (if a chart is tested)
  • "ATS_EXTRA_*" - any such arbitrary variable value will be extracted and included in the test_extra_info fixture

Currently, the only supported cluster type is external, which means the cluster is not managed by the test suite. You just point the test suite to a kube.config file, which can be used to connect to the Kubernetes API with KUBECONFIG env variable option. For creating development time clusters, we recommend using KinD.

If you use this project to test Helm charts against Giant Swarm App Platform, the existing cluster must already have the platform components installed. Please refer to and use the app-test-suite tool to easily create KinD based clusters with all the components already installed.

Writing tests

The easiest way to get started is by checking our examples.

The list of available fixtures can be found by running pytest --fixtures, but you can also just check the most important fixtures.

Full API docs are also available.

Contributing

Contributions are very welcome.

  • Project is managed with poetry, to start developing run poetry install
  • Tests for all supported python versions can be run with tox: poetry run tox -- --log-cli-level info tests/
  • Please ensure the coverage at least stays the same before you submit a pull request.

Creating a new release

  • merge your changes to master branch
  • edit pyproject.toml and update the project version; edit CHANGELOG.md; commit
  • create a new tag with the same version in git, i.e. git tag v1.1.1
  • push your changes to GitHub to trigger a release git push; git push origin v1.1.1

License

See LICENSE.

Changelog

See CHANGELOG.md.

Issues

If you encounter any problems, please file an issue along with a detailed description.

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

pytest_helm_charts-1.3.2.tar.gz (32.6 kB view details)

Uploaded Source

Built Distribution

pytest_helm_charts-1.3.2-py3-none-any.whl (46.6 kB view details)

Uploaded Python 3

File details

Details for the file pytest_helm_charts-1.3.2.tar.gz.

File metadata

  • Download URL: pytest_helm_charts-1.3.2.tar.gz
  • Upload date:
  • Size: 32.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for pytest_helm_charts-1.3.2.tar.gz
Algorithm Hash digest
SHA256 8bfc6e4f00a275abf67f7e602c8b6b551bad4a5c7d76bacb390512f9f0fa6e1a
MD5 fbe6c52602a03f78f03651d8b6befba2
BLAKE2b-256 b722c6695015540762b94f454e0fe4b135e68b15898662b61c3b215eadbe5406

See more details on using hashes here.

File details

Details for the file pytest_helm_charts-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: pytest_helm_charts-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 46.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for pytest_helm_charts-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f860b1ffdad3faafc8e14b44cb256bddbac11f0badc93bdb129fe66494e89bf3
MD5 9d6c4cfc588172be9156b7f56837b2de
BLAKE2b-256 21c546e8686e1ccec110baf468653aa799c59830f4bfc3db4ad679d7d3c7c587

See more details on using hashes here.

Supported by

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