Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
[meta] centralize development and testing doc in CONTRIBUTING.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jmlrt committed Apr 22, 2020
1 parent e10312d commit 2f36dad
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 211 deletions.
118 changes: 109 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,121 @@
# Contributing to the Elastic helm charts

## Requirements for submiting a pull request

Before submitting a pull request make sure you validated the following
requirements:

* CLA should be signed (see [CLA section][] for more details).

* Charts version shouldn't be bumped (see [Releases section][] for more
details).

* Charts `README.md` should be updated if required (especially updating default
values if they have been changed).

* Templating tests should be added/updated (see [Templating tests section][] for
more details).

* Integration tests should be added/updated (see [Integration tests section][]
for more details).

## CLA (Contributor License Agreement)

If you haven't already you will need to sign the [CLA](https://www.elastic.co/contributor-agreement) before your pull request can be reviewed and merged.
If you haven't already you will need to sign the [CLA][] before your pull
request can be reviewed and merged.

## Branches workflow

Pull request are merged on `master` branch, then they should be backported to
version branches (example `7.7` branch).

>TODO: add more details about version branching.
# Releases

Just like with the rest of the stack, all versions in this helm chart repo are
bumped and released at the same time. There is no need to bump the version in
your pull request.

Charts are released from version branchs (example `7.7` branch).

[Elastic Helm repository][] is updated only during releases.

>TODO: add more details about releases (see also [release.md][]).
## Version bumps
## Testing

Just like with the rest of the stack, all versions in this helm chart repo are bumped and released at the same time. There is no need to bump the version in your pull request.
### Templating tests

## Testing and documentation
Templating tests which can be found in `${CHART}/tests/*.py`
([Example][templating test example]).

When making any changes be sure to also update the following:
These charts use [pytest][] to test the templating logic. The dependencies for
testing can be installed from the [requirements.txt][] in the parent directory:

* Charts README.md
* The templating tests which can be found in `${CHART}/tests/*.py`. [Example](/elasticsearch/tests/elasticsearch_test.py)
* The integration tests which can be found in `${CHART}/examples/*/test/goss.yaml`. [Example](/elasticsearch/examples/default/test/goss.yaml)
```
pip install -r ./requirements.txt
```

Tests can then be run from each chart directory using `make pytest`

You can also use `make template` (equivalent to `helm template` ) to look at the
YAML being generated:

It is possible to run all of the tests and linting inside of a Docker container
using `make test`

Note that templating tests are formated using [Black][], you should run
`make lint-python` (equivalent to `black --diff --check .` ) to validate them or
`black .` to apply formatting before submitting a pull request which will modify
them.

### Integration tests

Integration tests which can be found in `${CHART}/examples/*/test/goss.yaml`
([Example][integration test example]).

Integration tests are run using [goss][] which is a [Serverspec][] like tool
written in golang. See [integration test example][] for an example of what the
tests look like.

The different integration tests are present in each chart's `examples`
directory.

Each charts contains an `examples/default` integration test which validate the
chart deployment with default values.

`examples` directory contains also integration tests for other use cases (for
example: using `oss` Docker images, using `6.x` version or using `security` ).

Every directory which contains some `test` subdirectory is an integration test
(`examples` directory contains also some configuration examples for some
specific scenarios without tests like configuration for specific k8s providers).

To run the goss tests against the default example:

```
cd examples/default
make goss
```

## Adding new features

If you aren't 100% sure that this is a feature that makes sense for everyone. Please open an issue first to discuss with the maintainers before investing a lot of time into it.
If you aren't 100% sure that this is a feature that makes sense for everyone.
Please open an issue first to discuss with the maintainers before investing a
lot of time into it.

[black]: https://black.readthedocs.io/en/stable/
[cla]: https://www.elastic.co/contributor-agreement
[cla section]: #cla-contributor-license-agreement
[elastic helm repository]: https://helm.elastic.co
[goss]: https://github.com/aelsabbahy/goss/blob/master/docs/manual.md
[integration test example]: https://github.com/elastic/helm-charts/blob/master/elasticsearch/examples/default/test/goss.yaml
[integration tests section]: #integration-tests
[pytest]: https://docs.pytest.org/en/latest/
[serverspec]: https://serverspec.org
[templating test example]: https://github.com/elastic/helm-charts/blob/master/elasticsearch/tests/elasticsearch_test.py
[templating tests section]: #templating-tests
[release.md]: https://github.com/elastic/helm-charts/blob/master/helpers/release.md
[releases section]: #releases
[requirements.txt]: https://github.com/elastic/helm-charts/blob/master/requirements.txt
40 changes: 4 additions & 36 deletions apm-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,48 +130,18 @@ used for the automated testing of this Helm chart.
curl localhost:9200/_cat/indices
```

## Testing
## Contributing

This chart uses [pytest][] to test the templating logic. The dependencies for
testing can be installed from the [requirements.txt][] in the parent directory:

```
pip install -r ../requirements.txt
make pytest
```

You can also use `helm template` to look at the YAML being generated:

```
make template
```

It is possible to run all of the tests and linting inside of a Docker container:

```
make test
```

## Integration Testing

Integration tests are run using [goss][] which is a serverspec like tool written
in golang. See [goss.yaml][] for an example of what the tests look like.

To run the goss tests against the default example:

```
cd examples/default
make goss
```
Please check [CONTRIBUTING.md][] before any contribution or for any questions
about our development and testing process.

[affinity]: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
[annotations]: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
[apm server docker image]: https://www.elastic.co/guide/en/apm/server/current/running-on-docker.html
[contributing.md]: https://github.com/elastic/helm-charts/blob/master/CONTRIBUTING.md
[default elasticsearch helm chart]: https://github.com/elastic/helm-charts/tree/master/elasticsearch/README.md#default
[environment variables]: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/#using-environment-variables-inside-of-your-config
[examples]: https://github.com/elastic/helm-charts/tree/master/apm-server/examples
[goss]: https://github.com/aelsabbahy/goss/blob/master/docs/manual.md
[goss.yaml]: https://github.com/elastic/helm-charts/tree/master/apm-server/examples/default/test/goss.yaml
[helm]: https://helm.sh
[horizontal pod autoscaler]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
[imagePullPolicy]: https://kubernetes.io/docs/concepts/containers/images/#updating-images
Expand All @@ -183,8 +153,6 @@ make goss
[podSecurityContext]: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
[priorityClass]: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass
[probe]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
[pytest]: https://docs.pytest.org/en/latest/
[requirements.txt]: https://github.com/elastic/helm-charts/tree/master/requirements.txt
[resources]: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
[service]: https://kubernetes.io/docs/concepts/services-networking/service/
[serviceAccount]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
Expand Down
40 changes: 4 additions & 36 deletions elasticsearch/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -421,46 +421,18 @@ For an example of deploying both a group master nodes and data nodes using
multiple releases of this chart, see the accompanying values files in
`examples/multi`.

## Testing
## Contributing

This chart uses [pytest][] to test the templating logic. The dependencies for
testing can be installed from the [requirements.txt][] in the parent directory:

```
pip install -r ../requirements.txt
make pytest
```

You can also use `helm template` to look at the YAML being generated:

```
make template
```

It is possible to run all of the tests and linting inside of a Docker container:

```
make test
```

## Integration Testing

Integration tests are run using [goss][] which is a serverspec like tool written
in golang. See [goss.yaml][] for an example of what the tests look like.

To run the goss tests against the default example:

```
cd examples/default
make goss
```
Please check [CONTRIBUTING.md][] before any contribution or for any questions
about our development and testing process.

[#63]: https://github.com/elastic/helm-charts/issues/63
[#458]: https://github.com/elastic/helm-charts/pull/458
[7.6.1]: https://github.com/elastic/helm-charts/releases/tag/7.6.1
[alternate scheduler]: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/#specify-schedulers-for-pods
[annotations]: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
[anti-affinity]: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
[contributing.md]: https://github.com/elastic/helm-charts/blob/master/CONTRIBUTING.md
[cluster.name]: https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster.name.html
[clustering and node discovery]: https://github.com/elastic/helm-charts/tree/master/elasticsearch/README.md#clustering-and-node-discovery
[config example]: https://github.com/elastic/helm-charts/tree/master/elasticsearch/examples/config/values.yaml
Expand All @@ -473,8 +445,6 @@ make goss
[elasticsearch docker image]: https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
[environment variables]: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/#using-environment-variables-inside-of-your-config
[examples]: https://github.com/elastic/helm-charts/tree/master/elasticsearch/examples/
[goss]: https://github.com/aelsabbahy/goss/blob/master/docs/manual.md
[goss.yaml]: https://github.com/elastic/helm-charts/tree/master/elasticsearch/examples/default/test/goss.yaml
[helm]: https://helm.sh
[helm/charts stable]: https://github.com/helm/charts/tree/master/stable/elasticsearch/
[how to install plugins guide]: https://github.com/elastic/helm-charts/tree/master/elasticsearch/README.md#how-to-install-plugins
Expand Down Expand Up @@ -502,8 +472,6 @@ make goss
[parent readme]: https://github.com/elastic/helm-charts/tree/master/README.md
[priorityClass]: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass
[probe]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
[pytest]: https://docs.pytest.org/en/latest/
[requirements.txt]: https://github.com/elastic/helm-charts/tree/master/requirements.txt
[resources]: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
[roles]: https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-node.html
[secret]: https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets
Expand Down
40 changes: 4 additions & 36 deletions filebeat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,48 +140,18 @@ indices:
curl localhost:9200/_cat/indices
```

## Testing
## Contributing

This chart uses [pytest][] to test the templating logic. The dependencies for
testing can be installed from the [requirements.txt][] in the parent directory:

```
pip install -r ../requirements.txt
make pytest
```

You can also use `helm template` to look at the YAML being generated:

```
make template
```

It is possible to run all of the tests and linting inside of a Docker container:

```
make test
```

## Integration Testing

Integration tests are run using [goss][] which is a serverspec like tool written
in golang. See [goss.yaml][] for an example of what the tests look like.

To run the goss tests against the default example:

```
cd examples/default
make goss
```
Please check [CONTRIBUTING.md][] before any contribution or for any questions
about our development and testing process.

[affinity]: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
[annotations]: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
[contributing.md]: https://github.com/elastic/helm-charts/blob/master/CONTRIBUTING.md
[default Elasticsearch Helm chart]: https://github.com/elastic/helm-charts/tree/master/elasticsearch/README.md#default
[environment variables]: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/#using-environment-variables-inside-of-your-config
[examples]: https://github.com/elastic/helm-charts/tree/master/filebeat/examples
[filebeat docker image]: https://www.elastic.co/guide/en/beats/filebeat/current/running-on-docker.html
[goss]: https://github.com/aelsabbahy/goss/blob/master/docs/manual.md
[goss.yaml]: https://github.com/elastic/helm-charts/tree/master/filebeat/examples/default/test/goss.yaml
[helm]: https://helm.sh
[hostNetwork]: https://kubernetes.io/docs/concepts/policy/pod-security-policy/#host-namespaces
[hostPath]: https://kubernetes.io/docs/concepts/storage/volumes/#hostpath
Expand All @@ -193,8 +163,6 @@ make goss
[podSecurityContext]: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
[priorityClass]: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass
[probe]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
[pytest]: https://docs.pytest.org/en/latest/
[requirements.txt]: https://github.com/elastic/helm-charts/tree/master/requirements.txt
[resources]: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
[serviceAccount]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/
[tolerations]: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
Expand Down
26 changes: 4 additions & 22 deletions kibana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,29 +180,13 @@ random times.
2. Mutating the state of a running Docker image (by installing plugins) goes
against best practices of containers and immutable infrastructure.

## Testing
## Contributing

This chart uses [pytest][] to test the templating logic. The dependencies for
testing can be installed from the [requirements.txt][] in the parent directory:

```
pip install -r ../requirements.txt
make test
```

You can also use `helm template` to look at the YAML being generated:

```
make template
```

It is possible to run all of the tests and linting inside of a Docker container:

```
make test
```
Please check [CONTRIBUTING.md][] before any contribution or for any questions
about our development and testing process.

[annotations]: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
[contributing.md]: https://github.com/elastic/helm-charts/blob/master/CONTRIBUTING.md
[default elasticsearch helm chart]: https://github.com/elastic/helm-charts/tree/master/elasticsearch/README.md#default
[environment variables]: https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/#using-environment-variables-inside-of-your-config
[kibana docker image]: https://www.elastic.co/guide/en/kibana/current/docker.html
Expand All @@ -216,8 +200,6 @@ make test
[parent readme]: https://github.com/elastic/helm-charts/tree/master/README.md
[priorityClass]: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass
[probe]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/
[pytest]: https://docs.pytest.org/en/latest/
[requirements.txt]: https://github.com/elastic/helm-charts/tree/master/requirements.txt
[resources]: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
[security enabled elasticsearch cluster]: https://github.com/elastic/helm-charts/tree/master/elasticsearch/README.md#security
[securityContext]: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod
Expand Down
Loading

0 comments on commit 2f36dad

Please sign in to comment.