Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Commit

Permalink
Add unit tests to CI (#407)
Browse files Browse the repository at this point in the history
* Add unit tests to CI

The unit tests were not being run during CI. This adds a GitHub Action
for it.

* Add changelog fragment
  • Loading branch information
gravesm authored Apr 5, 2021
1 parent c9157ce commit d6f2511
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,29 @@ jobs:
run: make test-molecule
working-directory: ./ansible_collections/community/kubernetes

unit:
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ['2.7', '3.7']
steps:
- name: Check out code
uses: actions/checkout@v2
with:
path: ansible_collections/community/kubernetes

- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python_version }}

- name: Install ansible base (devel branch)
run: pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check

- name: Run unit tests on Python ${{ matrix.python_version }}
run: make test-unit PYTHON_VERSION=${{ matrix.python_version }}
working-directory: ./ansible_collections/community/kubernetes

downstream-sanity-29:
runs-on: ubuntu-latest
strategy:
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ test-integration:
test-molecule:
molecule test

test-unit:
ansible-test units --docker -v --color --python $(PYTHON_VERSION) $(?TEST_ARGS)

downstream-test-sanity:
./utils/downstream.sh -s

Expand Down
2 changes: 2 additions & 0 deletions changelogs/fragments/407-enable-unit-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- enable unit tests in CI (https://github.com/ansible-collections/community.kubernetes/pull/407).
2 changes: 1 addition & 1 deletion tests/unit/module_utils/test_helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_run_helm_with_params():
"api_key": "my-api-key",
"ca_cert": "my-ca-cert",
"host": "some-host",
"kube_context": "my-context",
"context": "my-context",
"release_namespace": "a-release-namespace",
"validate_certs": False,
}
Expand Down

0 comments on commit d6f2511

Please sign in to comment.