fix role tests

Ansible role tests were failing due to ansible-lint reporting
multiple errors.

Fixing those errors resolves the failing tests.

Switching gcsfuse to use gcloud's bootstrap to follow the current
docker install instructions.

Removing centos as it's a discontinued distribution.

Adding a check to ensure integration tests are skipped unless they
are run by a branch (a public fork does not pass required
integration test credentials).
This commit is contained in:
Yusuke Tsutsumi 2022-11-26 07:00:46 +00:00 committed by Yusuke Tsutsumi
commit f692dd4c76
21 changed files with 113 additions and 96 deletions

View file

@ -22,6 +22,7 @@ git clone <url> $TARGET_DIR/collections/google/cloud
### prequisites for all tests
- Install the `ansible` package.
- Some container runtime is necessary (e.g. `podman` or `docker`). The instructions use podman.
## Running integration tests
@ -56,4 +57,33 @@ bash ./scripts/bootstrap-project.sh $PROJECT_ID $SERVICE_ACCOUNT_NAME
### Running
Run `ansible-test integration`. Currently some tests are disabled as [test are being verified and added](https://github.com/ansible-collections/google.cloud/issues/499).
Run `ansible-test integration`. Currently some tests are disabled as [test are being verified and added](https://github.com/ansible-collections/google.cloud/issues/499).
## Role tests
### Prequisites for role tests
If you would like to use podman, you must
install the `molecule[podman]` package in PyPI:
```
pip install --upgrade molecule[podman]
```
### Running role tests
Ansible roles are tested via molecule.
```sh
module debug --test -s ${ROLE}
```
Role is the name of the role (e.g. gcloud, gcsfuse).
Add `-d podman` if you would like to use the podman driver.
If the linting fails, that is generally due to `ansible-lint`, which can be run directly:
```
ansible-lint
```