Skip to content

Commit

Permalink
aws_ssm - Rework (and enable) integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tremble committed Jan 12, 2023
1 parent 316f0ac commit db747be
Show file tree
Hide file tree
Showing 47 changed files with 440 additions and 302 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/20230112-aws_ssm-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
trivial:
- aws_ssm - Rework and enable aws_ssm integration tests
1 change: 1 addition & 0 deletions tests/integration/targets/connection/aliases
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Used to test basic operation once a connection plugin has established a connection
hidden
disabled
7 changes: 4 additions & 3 deletions tests/integration/targets/connection/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ set -eux

[ -f "${INVENTORY}" ]

# Run connection tests with both the default and C locale.
ansible-playbook test_connection.yml -i "${INVENTORY}" "$@"

ansible-playbook test_connection.yml -i "${INVENTORY}" "$@"
LC_ALL=C LANG=C ansible-playbook test_connection.yml -i "${INVENTORY}" "$@"
# Ansible 2.14 dropped support for non UTF-8 Locale
# https://github.com/ansible/ansible/pull/78175
# LC_ALL=C LANG=C ansible-playbook test_connection.yml -i "${INVENTORY}" "$@"
5 changes: 0 additions & 5 deletions tests/integration/targets/connection_aws_ssm/aliases

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion tests/integration/targets/connection_aws_ssm/meta/main.yml

This file was deleted.

7 changes: 7 additions & 0 deletions tests/integration/targets/connection_aws_ssm_amazon/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
time=10m

# Historically very unstable, work ongoing to improve this
unstable

cloud/aws
connection_aws_ssm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- hosts: localhost
roles:
- role: ../setup_connection_aws_ssm
vars:
target_os: amazon
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- hosts: localhost
tasks:
- include_role:
name: ../setup_connection_aws_ssm
tasks_from: cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependencies:
- connection
- setup_connection_aws_ssm
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env bash

PLAYBOOK_DIR=$(pwd)
set -eux

CMD_ARGS=("$@")

# Destroy Environment
cleanup() {

cd ../connection_aws_ssm

cd "${PLAYBOOK_DIR}"
ansible-playbook -c local aws_ssm_integration_test_teardown.yml "${CMD_ARGS[@]}"

}
Expand All @@ -26,6 +26,6 @@ set -x
cd ../connection

# Execute Integration tests
INVENTORY=../connection_aws_ssm/ssm_inventory ./test.sh \
INVENTORY="${PLAYBOOK_DIR}/ssm_inventory" ./test.sh \
-e target_hosts=aws_ssm \
"$@"
7 changes: 7 additions & 0 deletions tests/integration/targets/connection_aws_ssm_fedora/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
time=10m

# Historically very unstable, work ongoing to improve this
unstable

cloud/aws
connection_aws_ssm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- hosts: localhost
roles:
- role: ../setup_connection_aws_ssm
vars:
target_os: fedora
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- hosts: localhost
tasks:
- include_role:
name: ../setup_connection_aws_ssm
tasks_from: cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dependencies:
- connection
- setup_connection_aws_ssm
31 changes: 31 additions & 0 deletions tests/integration/targets/connection_aws_ssm_fedora/runme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

PLAYBOOK_DIR=$(pwd)
set -eux

CMD_ARGS=("$@")

# Destroy Environment
cleanup() {

cd "${PLAYBOOK_DIR}"
ansible-playbook -c local aws_ssm_integration_test_teardown.yml "${CMD_ARGS[@]}"

}

trap "cleanup" EXIT

# Setup Environment
ansible-playbook -c local aws_ssm_integration_test_setup.yml "$@"

# Export the AWS Keys
set +x
. ./aws-env-vars.sh
set -x

cd ../connection

# Execute Integration tests
INVENTORY="${PLAYBOOK_DIR}/ssm_inventory" ./test.sh \
-e target_hosts=aws_ssm \
"$@"
7 changes: 7 additions & 0 deletions tests/integration/targets/connection_aws_ssm_ubuntu/aliases
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
time=10m

# Historically very unstable, work ongoing to improve this
unstable

cloud/aws
connection_aws_ssm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- hosts: localhost
roles:
- role: ../setup_connection_aws_ssm
vars:
target_os: ubuntu
Loading

0 comments on commit db747be

Please sign in to comment.