# pytest-helm-charts
[![build](https://github.com/giantswarm/pytest-helm-charts/actions/workflows/main.yml/badge.svg)](https://github.com/giantswarm/pytest-helm-charts/actions/workflows/main.yml/badge.svg)
[![codecov](https://codecov.io/gh/giantswarm/pytest-helm-charts/branch/master/graph/badge.svg)](https://codecov.io/gh/giantswarm/pytest-helm-charts)
[![Documentation Status](https://readthedocs.org/projects/pytest-helm-charts/badge/?version=latest)](https://pytest-helm-charts.readthedocs.io/en/latest/?badge=latest)
[![PyPI Version](https://img.shields.io/pypi/v/pytest-helm-charts.svg)](https://pypi.org/project/pytest-helm-charts/)
[![Python Versions](https://img.shields.io/pypi/pyversions/pytest-helm-charts.svg)](https://pypi.org/project/pytest-helm-charts/)
[![Apache License](https://img.shields.io/badge/license-apache-blue.svg)](https://pypi.org/project/pytest-helm-charts/)
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](https://docs.pytest.org/) 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](https://docs.giantswarm.io/basics/app-platform/).
Most important features:
- provides [pykube-ng](http://pykube.readthedocs.io/) interface to access Kubernetes clusters
- provides [environment variables based options](#usage) to configure the target cluster to run on
- provides fixtures to work with some standard Kubernetes resources as well as some custom ones:
- [Kubernetes objects](pytest_helm_charts.k8s)
- [Giant Swarm App Platform objects](pytest_helm_charts.giantswarm_app_platform)
- [Flux CD objects](pytest_helm_charts.flux)
- provides set of fixtures to easily work with Helm charts
## Requirements
Please check `[tool.poetry.dependencies]` list in the [`pyproject.toml`](pyproject.toml) file.
## Installation
You can install "pytest-helm-charts" via `pip` from `PyPI`:
```bash
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](https://kind.sigs.k8s.io/).
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`](https://github.com/giantswarm/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](https://pytest-helm-charts.readthedocs.io/en/latest/examples/basic).
The list of available fixtures can be found by running `pytest --fixtures`, but
you can also just check [the most important fixtures](docs/fixtures.md).
Full [API docs](https://pytest-helm-charts.readthedocs.io/en/latest/api/pytest_helm_charts/)
are also available.
## Contributing
Contributions are very welcome.
- Project is managed with [`poetry`](https://python-poetry.org/),
to start developing run `poetry install`
- Tests for all supported python versions can be run with [`tox`](https://tox.readthedocs.io/):
`poetry run tox -- --log-cli-level info tests/`
- Please ensure
[the coverage](https://codecov.io/gh/giantswarm/pytest-helm-charts/)
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](LICENSE).
## Changelog
See [CHANGELOG.md](./CHANGELOG.md).
## Issues
If you encounter any problems, please [file an issue](https://github.com/giantswarm/pytest-helm-charts/issues)
along with a detailed description.
Raw data
{
"_id": null,
"home_page": "https://github.com/giantswarm/pytest-helm-charts",
"name": "pytest-helm-charts",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "kubernetes, helm, chart",
"author": "\u0141ukasz Pi\u0105tkowski",
"author_email": "lukasz@giantswarm.io",
"download_url": "https://files.pythonhosted.org/packages/b7/22/c6695015540762b94f454e0fe4b135e68b15898662b61c3b215eadbe5406/pytest_helm_charts-1.3.2.tar.gz",
"platform": null,
"description": "# pytest-helm-charts\n\n[![build](https://github.com/giantswarm/pytest-helm-charts/actions/workflows/main.yml/badge.svg)](https://github.com/giantswarm/pytest-helm-charts/actions/workflows/main.yml/badge.svg)\n[![codecov](https://codecov.io/gh/giantswarm/pytest-helm-charts/branch/master/graph/badge.svg)](https://codecov.io/gh/giantswarm/pytest-helm-charts)\n[![Documentation Status](https://readthedocs.org/projects/pytest-helm-charts/badge/?version=latest)](https://pytest-helm-charts.readthedocs.io/en/latest/?badge=latest)\n[![PyPI Version](https://img.shields.io/pypi/v/pytest-helm-charts.svg)](https://pypi.org/project/pytest-helm-charts/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/pytest-helm-charts.svg)](https://pypi.org/project/pytest-helm-charts/)\n[![Apache License](https://img.shields.io/badge/license-apache-blue.svg)](https://pypi.org/project/pytest-helm-charts/)\n\nA plugin to test helm charts on Kubernetes clusters.\n\nFull documentation (including API) available on <https://pytest-helm-charts.readthedocs.io/>.\n\n---\n\n## Features\n\nThis plugin provides a set of [pytest](https://docs.pytest.org/) fixtures that allow you to easily\nwrite tests for Helm charts and run them on Kubernetes clusters.\n\nIt can be also used to test Helm charts deployed using the Open Source\n[Giant Swarm App Platform](https://docs.giantswarm.io/basics/app-platform/).\n\nMost important features:\n\n- provides [pykube-ng](http://pykube.readthedocs.io/) interface to access Kubernetes clusters\n- provides [environment variables based options](#usage) to configure the target cluster to run on\n- provides fixtures to work with some standard Kubernetes resources as well as some custom ones:\n - [Kubernetes objects](pytest_helm_charts.k8s)\n - [Giant Swarm App Platform objects](pytest_helm_charts.giantswarm_app_platform)\n - [Flux CD objects](pytest_helm_charts.flux)\n- provides set of fixtures to easily work with Helm charts\n\n## Requirements\n\nPlease check `[tool.poetry.dependencies]` list in the [`pyproject.toml`](pyproject.toml) file.\n\n## Installation\n\nYou can install \"pytest-helm-charts\" via `pip` from `PyPI`:\n\n```bash\npip install pytest-helm-charts\n```\n\n## Usage\n\n### Running your tests\n\nWhen you want to run your tests, you invoke `pytest` as usual, just configuring\ncluster and chart information using environment variables or command line options.\nThe following options are available as environment variables (start `pytest` with `-h`\nto check corresponding command line options):\n\n- \"KUBECONFIG\" - (mandatory) a path to kube config file used to connect to a k8s cluster\n- \"ATS_CHART_PATH\" - path to a chart being tested (if a chart is tested)\n- \"ATS_CHART_VERSION\" - version of the chart being tested (if a chart is tested)\n- \"ATS_CLUSTER_TYPE\" - type of the cluster used for testing\n- \"ATS_CLUSTER_VERSION\" - k8s version of the cluster used for testing\n- \"ATS_APP_CONFIG_FILE_PATH\" - optional path to a `values.yaml` file used to configure a chart under test\n(if a chart is tested)\n- \"ATS_EXTRA_*\" - any such arbitrary variable value will be extracted and included in the `test_extra_info` fixture\n\nCurrently, the only supported cluster type is `external`, which means the cluster is not\nmanaged by the test suite. You just point the test suite to a `kube.config` file,\nwhich can be used to connect to the Kubernetes API with `KUBECONFIG` env variable\noption. For creating development time clusters, we recommend using\n[KinD](https://kind.sigs.k8s.io/).\n\nIf you use this project to test Helm charts against Giant Swarm App Platform, the `existing`\ncluster must already have the platform components installed. Please refer to and use\nthe [`app-test-suite`](https://github.com/giantswarm/app-test-suite) tool to easily\ncreate `KinD` based clusters with all the components already installed.\n\n### Writing tests\n\nThe easiest way to get started is by checking our\n[examples](https://pytest-helm-charts.readthedocs.io/en/latest/examples/basic).\n\nThe list of available fixtures can be found by running `pytest --fixtures`, but\nyou can also just check [the most important fixtures](docs/fixtures.md).\n\nFull [API docs](https://pytest-helm-charts.readthedocs.io/en/latest/api/pytest_helm_charts/)\nare also available.\n\n## Contributing\n\nContributions are very welcome.\n\n- Project is managed with [`poetry`](https://python-poetry.org/),\n to start developing run `poetry install`\n- Tests for all supported python versions can be run with [`tox`](https://tox.readthedocs.io/):\n `poetry run tox -- --log-cli-level info tests/`\n- Please ensure\n [the coverage](https://codecov.io/gh/giantswarm/pytest-helm-charts/)\n at least stays the same before you submit a pull request.\n\n### Creating a new release\n\n- merge your changes to `master` branch\n- edit `pyproject.toml` and update the project version; edit `CHANGELOG.md`; commit\n- create a new tag with the same version in git, i.e. `git tag v1.1.1`\n- push your changes to GitHub to trigger a release `git push; git push origin v1.1.1`\n\n## License\n\nSee [LICENSE](LICENSE).\n\n## Changelog\n\nSee [CHANGELOG.md](./CHANGELOG.md).\n\n## Issues\n\nIf you encounter any problems, please [file an issue](https://github.com/giantswarm/pytest-helm-charts/issues)\nalong with a detailed description.\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "A plugin to provide different types and configs of Kubernetes clusters that can be used for testing.",
"version": "1.3.2",
"project_urls": {
"Homepage": "https://github.com/giantswarm/pytest-helm-charts",
"Repository": "https://github.com/giantswarm/pytest-helm-charts"
},
"split_keywords": [
"kubernetes",
" helm",
" chart"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "21c546e8686e1ccec110baf468653aa799c59830f4bfc3db4ad679d7d3c7c587",
"md5": "9d6c4cfc588172be9156b7f56837b2de",
"sha256": "f860b1ffdad3faafc8e14b44cb256bddbac11f0badc93bdb129fe66494e89bf3"
},
"downloads": -1,
"filename": "pytest_helm_charts-1.3.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9d6c4cfc588172be9156b7f56837b2de",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 46561,
"upload_time": "2024-10-31T07:41:12",
"upload_time_iso_8601": "2024-10-31T07:41:12.930564Z",
"url": "https://files.pythonhosted.org/packages/21/c5/46e8686e1ccec110baf468653aa799c59830f4bfc3db4ad679d7d3c7c587/pytest_helm_charts-1.3.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b722c6695015540762b94f454e0fe4b135e68b15898662b61c3b215eadbe5406",
"md5": "fbe6c52602a03f78f03651d8b6befba2",
"sha256": "8bfc6e4f00a275abf67f7e602c8b6b551bad4a5c7d76bacb390512f9f0fa6e1a"
},
"downloads": -1,
"filename": "pytest_helm_charts-1.3.2.tar.gz",
"has_sig": false,
"md5_digest": "fbe6c52602a03f78f03651d8b6befba2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 32591,
"upload_time": "2024-10-31T07:41:14",
"upload_time_iso_8601": "2024-10-31T07:41:14.610828Z",
"url": "https://files.pythonhosted.org/packages/b7/22/c6695015540762b94f454e0fe4b135e68b15898662b61c3b215eadbe5406/pytest_helm_charts-1.3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-31 07:41:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "giantswarm",
"github_project": "pytest-helm-charts",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "pytest-helm-charts"
}