Skip to content

Commit

Permalink
contrail: import the test-suite (ansible-collections#1035)
Browse files Browse the repository at this point in the history
cloudtrail: import the test-suite

Import the test-suite from community.aws with some adjustments:

no cloud/aws in the aliases file, we assume we run the test-suite
using user's own credentials.
runme.sh to simplify the execution with local credentials.
adjust the cloudtrail module FQCN.

Reviewed-by: GomathiselviS <None>
Reviewed-by: Gonéri Le Bouder <goneri@lebouder.net>
  • Loading branch information
goneri authored Sep 22, 2022
1 parent b9de59d commit eb1ee34
Show file tree
Hide file tree
Showing 8 changed files with 1,638 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/migrate_cloudtrail_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trivial:
- cloudtrail - Import the functional tests (https://github.com/ansible-collections/amazon.aws/pull/1035).
2 changes: 0 additions & 2 deletions tests/integration/targets/cloudtrail/aliases
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# reason: missing-policy
unsupported

cloud/aws
8 changes: 8 additions & 0 deletions tests/integration/targets/cloudtrail/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cloudtrail_name: '{{ resource_prefix }}-cloudtrail'
s3_bucket_name: '{{ resource_prefix }}-cloudtrail-bucket'
kms_alias: '{{ resource_prefix }}-cloudtrail'
sns_topic: '{{ resource_prefix }}-cloudtrail-notifications'
cloudtrail_prefix: 'ansible-test-prefix'
cloudwatch_log_group: '{{ resource_prefix }}-cloudtrail'
cloudwatch_role: '{{ resource_prefix }}-cloudtrail'
cloudwatch_no_kms_role: '{{ resource_prefix }}-cloudtrail2'
6 changes: 6 additions & 0 deletions tests/integration/targets/cloudtrail/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- hosts: localhost
gather_facts: no
#serial: 10
roles:
- cloudtrail
1 change: 1 addition & 0 deletions tests/integration/targets/cloudtrail/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dependencies: []
27 changes: 27 additions & 0 deletions tests/integration/targets/cloudtrail/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
#
# Beware: most of our tests here are run in parallel.
# To add new tests you'll need to add a new host to the inventory and a matching
# '{{ inventory_hostname }}'.yml file in roles/ec2_instance/tasks/


set -eux

export ANSIBLE_ROLES_PATH=../
tiny_prefix="$(uuidgen -r|cut -d- -f1)"

# shellcheck disable=SC2016,SC2086
echo '
{
"ansible_test": {
"environment": {
"ANSIBLE_DEBUG_BOTOCORE_LOGS": "True"
},
"module_defaults": null
},
"resource_prefix": "'${tiny_prefix}'",
"tiny_prefix": "'${tiny_prefix}'",
"aws_region": "us-east-2"
}' > _config-file.json

ansible-playbook main.yml -i inventory "$@" -e @_config-file.json
Loading

0 comments on commit eb1ee34

Please sign in to comment.