Skip to content

Commit da0139a

Browse files
authored
Initial commit for ansible-test support (#63)
* Add general integration test configuration * Add unit test for core_exe filters * Add integration tests for Light and Medium (HA) duty environments for Level 1 networking * Ignore and add template for integration_config.yml * Update example password * Add idempotent task for CDP setup * Convert cdpy install to HTTPS * Increase timeout for AWS VPC Endpoint deletions Signed-off-by: Webster Mudge <wmudge@cloudera.com>
1 parent 7e1e5a4 commit da0139a

File tree

35 files changed

+780
-7
lines changed

35 files changed

+780
-7
lines changed

.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
1+
# Copyright 2022 Cloudera, Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
# Keep the Galaxy builds
216
!cloudera-exe-*.tar.gz
317

418
# Remove ansible-test output
519
tests/output
620

21+
# Remove any integration configuration
22+
tests/integration/integration_config.yml
23+
724
# Remove molecule testing deployments
825
**/molecule/*/deployment
926

TESTING.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Testing
2+
3+
The collection uses `ansible-test` for unit and integration testing.
4+
5+
```bash
6+
# Sanity tests
7+
ansible-test sanity --docker --python 3.9
8+
9+
# Unit tests
10+
ansible-test units --docker --python 3.9
11+
12+
# Integration tests
13+
ansible-test integration --docker
14+
```
15+
16+
To run the _integration_ tests, you first need to have a running virtual environment configured with Ansible (`core`) and the required collections. When you run `ansible-test`, the program will bootstrap the [requirements|tests/integration/requirements.txt] in the Docker container and mount the `ANSIBLE_COLLECTION_PATHS`.
17+
18+
```bash
19+
# In your favorite VENV...
20+
pip3 install ansible-core
21+
ansible-galaxy collection install -p collections -r galaxy.yml
22+
export ANSIBLE_COLLECTION_PATHS="$(pwd)/collections"
23+
```
24+
25+
You also need to provide AWS credentials and test configuration in the `integration_config.yml` file. This file is *not* included in the project, as it will contain sensitive data, but there is a template -- `integration_config.yml.template` -- that you can copy and update as needed.
26+

plugins/filter/core_exe.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
# Copyright 2021 Cloudera, Inc. All Rights Reserved.
4+
# Copyright 2022 Cloudera, Inc. All Rights Reserved.
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.
@@ -53,6 +53,7 @@ def combine_onto(*terms, **kwargs):
5353

5454
return result
5555

56+
5657
class FilterModule(object):
5758
''' Derivatives of Ansible jinja2 filters '''
5859

@@ -61,4 +62,4 @@ def filters(self):
6162
'combine_onto': combine_onto
6263
}
6364

64-
return filters
65+
return filters

requirements.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2022 Cloudera, Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
# Python internals
216
wheel
317

@@ -12,4 +26,4 @@ netaddr # ansible.netcommon.ipaddr
1226
molecule[lint]==3.4 # Pinned due to https://github.com/ansible-community/molecule/issues/3243
1327

1428
# CDPCLI / cdpy
15-
git+git://github.com/cloudera-labs/cdpy@main#egg=cdpy
29+
git+https://github.com/cloudera-labs/cdpy@main#egg=cdpy

requirements_aws.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2022 Cloudera, Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
# Amazon Web Services
216

317
awscli>=1.18.222

requirements_azure.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2022 Cloudera, Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
# Azure
216

317
# NOTE: The Azure CLI is installed as a OS package.

requirements_gcp.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# Copyright 2022 Cloudera, Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
115
# Google Cloud
216

317
# NOTE: google-cloud-sdk, including the CLI, is installed as OS package.

roles/freeipa_host_group/tasks/main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22

3-
# Copyright 2021 Cloudera, Inc. All Rights Reserved.
3+
# Copyright 2022 Cloudera, Inc. All Rights Reserved.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -69,4 +69,3 @@
6969
name: "{{ item }}"
7070
groups: "{{ freeipa_host_group__host_group_name }}"
7171
loop: "{{ __freeipa_server_public_ip }}"
72-

roles/infrastructure/tasks/teardown_aws_network.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
vpc-id: "{{ infra__aws_vpc_id }}"
224224
register: __infra_existing_endpoints_wait
225225
until: __infra_existing_endpoints_wait.vpc_endpoints | length == 0
226-
retries: 15
226+
retries: 30
227227
delay: 10
228228

229229
- name: Delete VPC Endpoint Security Group

roles/infrastructure/tasks/teardown_azure_network.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22

3-
# Copyright 2021 Cloudera, Inc. All Rights Reserved.
3+
# Copyright 2022 Cloudera, Inc. All Rights Reserved.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)