Skip to content

Commit c9b3dff

Browse files
wmudgejimright
andcommitted
Add integration targets and rebase onto devel (#1)
* Add integration test for cross-account credentials (cloudera-labs#90) * Add integration targets for CDP Environment and general teardown (cloudera-labs#91) * Add multiAZ for AWS environment * Add multi-AZ support for FreeIPA at environment creation * Add multi-AZ support for datalake * Add a common testing role for shared variables * Create integration test for CDP Credentials * Add shared integration CDP Environments for downstream tests (single and multi-AZ) * Create shared infrastructure resources teardown * Rename integration target xaccount to cred * Add and update integration targets for CDP Environments (single and multi-AZ) * Add integration targets for CDP ID Broker mappings (single and multi-AZ) * Add integration targets for CDP Datalakes (single and multi-AZ) * Update testing instructions * Test multi-AZ DL return values * Test single-AZ DL return values * Fix error in cascade value --------- Signed-off-by: Webster Mudge <wmudge@cloudera.com> Signed-off-by: Jim Enright <jenright@cloudera.com> Co-authored-by: Jim Enright <jenright@cloudera.com>
1 parent c1c6230 commit c9b3dff

File tree

41 files changed

+1006
-15
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1006
-15
lines changed

tests/TESTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ See the `integration_config.yml.template` for the infrastructure details availab
5959
ansible-test integration --local
6060
```
6161

62-
Once done with the integration tests, you will need to clean up any remaining CDP assets before tearing down the infrastructure (if needed).
62+
Once done with the integration tests, you will need to clean up any remaining CDP assets before tearing down the infrastructure (if required by your testing setup).
6363
```bash
64-
ansible-test integration --local disabled/teardown
64+
ansible-test integration --local --allow-disabled teardown
6565
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2023 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+
15+
skip/python2
16+
hidden
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
3+
# Copyright 2023 Cloudera, Inc. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
environment_multi_az: "{{ cdp.environment }}-m-it"
18+
environment_single_az: "{{ cdp.environment }}-s-it"
19+
datalake_multi_az: "{{ cdp.datalake }}-m-it"
20+
datalake_single_az: "{{ cdp.datalake }}-m-it"

tests/integration/targets/environ/defaults/main.yml renamed to tests/integration/targets/cred/aliases

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
---
2-
31
# Copyright 2023 Cloudera, Inc. All Rights Reserved.
42
#
53
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,3 +11,5 @@
1311
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1412
# See the License for the specific language governing permissions and
1513
# limitations under the License.
14+
15+
skip/python2
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
3+
# Copyright 2023 Cloudera, Inc. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
xaccount: "{{ cdp.xaccount_credential }}-it"
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
3+
# Copyright 2023 Cloudera, Inc. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
- name: Describe Credential
18+
cloudera.cloud.env_cred_info:
19+
name: "{{ xaccount }}"
20+
register: __cred
21+
22+
- name: Test for Credential existence
23+
ansible.builtin.assert:
24+
that: __cred.credentials | length == 0
25+
fail_msg: "Test credential already exists: {{ xaccount }}"
26+
27+
- name: Construct a Credential
28+
cloudera.cloud.env_cred:
29+
name: "{{ xaccount }}"
30+
cloud: "{{ network.type }}"
31+
role: "{{ identity.xaccount_role }}"
32+
description: "Integration test"
33+
register: __cred
34+
35+
- name: Test for Credential creation
36+
ansible.builtin.assert:
37+
that:
38+
- __cred.credential | length > 0
39+
- __cred.credential.cloudPlatform == (network.type | upper)
40+
- __cred.credential.credentialName == xaccount
41+
42+
- name: Test idempotent creation of a Credential
43+
cloudera.cloud.env_cred:
44+
name: "{{ xaccount }}"
45+
cloud: "{{ network.type }}"
46+
role: "{{ identity.xaccount_role }}"
47+
description: "Integration test"
48+
register: __cred_idempotent
49+
50+
- name: Test for Credential idempotent state
51+
ansible.builtin.assert:
52+
that:
53+
- __cred_idempotent.credential | length > 0
54+
- __cred.credential.crn == __cred_idempotent.credential.crn
55+
- not __cred_idempotent.changed
56+
57+
- name: Destroy Credential
58+
cloudera.cloud.env_cred:
59+
name: "{{ xaccount }}"
60+
state: absent
61+
register: __cred
62+
63+
- name: Describe Credential after destruction
64+
cloudera.cloud.env_cred_info:
65+
name: "{{ xaccount }}"
66+
register: __cred
67+
68+
- name: Test for Credential existence
69+
ansible.builtin.assert:
70+
that: __cred.credentials | length == 0
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Copyright 2023 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+
15+
skip/python2
16+
setup/once/setup_idbroker_multi_az
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
3+
# Copyright 2023 Cloudera, Inc. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
datalake_multi_az: "{{ cdp.datalake }}-multiaz"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
3+
# Copyright 2023 Cloudera, Inc. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
dependencies:
18+
- common
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
3+
# Copyright 2023 Cloudera, Inc. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
- name: Describe multi-AZ Datalake
18+
cloudera.cloud.datalake_info:
19+
name: "{{ datalake_multi_az }}"
20+
register: __dl
21+
22+
- name: Test for multi-AZ Datalake existence
23+
ansible.builtin.assert:
24+
that: __dl.datalakes | length == 0
25+
fail_msg: "Test Datalake already exists: {{ datalake_multi_az }}"
26+
27+
- name: Construct an AWS multi-AZ Datalake
28+
when: network.type == "aws"
29+
cloudera.cloud.datalake:
30+
name: "{{ datalake_multi_az }}"
31+
environment: "{{ environment_multi_az }}"
32+
instance_profile: "{{ identity.idbroker_role }}"
33+
storage: "{{ storage.datalake_location }}"
34+
multi_az: true
35+
register: __dl
36+
37+
- name: Test for multi-AZ Datalake creation
38+
ansible.builtin.assert:
39+
that:
40+
- __dl.datalake | length > 0
41+
- __dl.datalake.cloudPlatform == (network.type | upper)
42+
- __dl.datalake.datalakeName == datalake_multi_az
43+
44+
- name: Test idempotent creation of an AWS multi-AZ Datalake
45+
when: network.type == "aws"
46+
cloudera.cloud.datalake:
47+
name: "{{ datalake_multi_az }}"
48+
environment: "{{ environment_multi_az }}"
49+
instance_profile: "{{ identity.idbroker_role }}"
50+
storage: "{{ storage.datalake_location }}"
51+
multi_az: true
52+
register: __dl_idempotent
53+
54+
- name: Test for multi-AZ Datalake idempotent state
55+
ansible.builtin.assert:
56+
that:
57+
- __dl_idempotent.datalake | length > 0
58+
- __dl.datalake.crn == __dl_idempotent.datalake.crn
59+
- not __dl_idempotent.changed
60+
61+
- name: Destroy multi-AZ Datalake
62+
cloudera.cloud.datalake:
63+
name: "{{ datalake_multi_az }}"
64+
state: absent
65+
register: __dl
66+
67+
- name: Test for multi-AZ Datalake destruction return value
68+
ansible.builtin.assert:
69+
that: not __dl.datalake
70+
71+
- name: Describe multi-AZ Datalake after destruction
72+
cloudera.cloud.datalake_info:
73+
name: "{{ datalake_multi_az }}"
74+
register: __dl
75+
76+
- name: Test for multi-AZ Datalake existence
77+
ansible.builtin.assert:
78+
that: __dl.datalakes | length == 0

0 commit comments

Comments
 (0)