Package: pytest-helm-charts
pytest-helm-chartsA plugin to test helm charts on Kubernetes clusters.Full documentation (including API) available onhttps://pytest-helm-charts.readthedocs.io/.FeaturesThis plugin provides a set ofpytestfixtures 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 SourceGiant Swarm App Platform.Most important features:providespykube-nginterface to access Kubernetes clustersprovidesenvironment variables based optionsto configure the target cluster to run onprovides fixtures to work with some standard Kubernetes resources as well as some custom ones:Kubernetes objectsGiant Swarm App Platform objectsFlux CD objectsprovides set of fixtures to easily work with Helm chartsRequirementsPlease check[tool.poetry.dependencies]list in thepyproject.tomlfile.InstallationYou can install "pytest-helm-charts" viapipfromPyPI:pipinstallpytest-helm-chartsUsageRunning your testsWhen you want to run your tests, you invokepytestas usual, just configuring
cluster and chart information using environment variables or command line options.
The following options are available as environment variables (startpytestwith-hto 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 avalues.yamlfile 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 thetest_extra_infofixtureCurrently, the only supported cluster type isexternal, which means the cluster is not
managed by the test suite. You just point the test suite to akube.configfile,
which can be used to connect to the Kubernetes API withKUBECONFIGenv variable
option. For creating development time clusters, we recommend usingKinD.If you use this project to test Helm charts against Giant Swarm App Platform, theexistingcluster must already have the platform components installed. Please refer to and use
theapp-test-suitetool to easily
createKinDbased clusters with all the components already installed.Writing testsThe easiest way to get started is by checking ourexamples.The list of available fixtures can be found by runningpytest --fixtures, but
you can also just checkthe most important fixtures.FullAPI docsare also available.ContributingContributions are very welcome.Project is managed withpoetry,
to start developing runpoetry installTests for all supported python versions can be run withtox:poetry run tox -- --log-cli-level info tests/Please ensurethe coverageat least stays the same before you submit a pull request.Creating a new releasemerge your changes tomasterbrancheditpyproject.tomland update the project version; editCHANGELOG.md; commitcreate a new tag with the same version in git, i.e.git tag v1.1.1push your changes to GitHub to trigger a releasegit push; git push origin v1.1.1LicenseSeeLICENSE.ChangelogSeeCHANGELOG.md.IssuesIf you encounter any problems, pleasefile an issuealong with a detailed description.