summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorSloane Hertel <19572925+s-hertel@users.noreply.github.com>2022-04-14 21:18:30 +0200
committerGitHub <noreply@github.com>2022-04-14 21:18:30 +0200
commit76273a6b800cbdf38f71089be1ab3d9622031c1b (patch)
tree27f0a620a8df968b6ef6cf82aa3ffbddf424ff57 /test/integration
parentUpdate pip example with standard lowercase http[s]_proxy env vars (#77515) (diff)
downloadansible-76273a6b800cbdf38f71089be1ab3d9622031c1b.tar.xz
ansible-76273a6b800cbdf38f71089be1ab3d9622031c1b.zip
Clean up integration tests (#77516)
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/targets/ansible-galaxy-collection/tasks/install.yml54
-rw-r--r--test/integration/targets/ansible-galaxy-collection/tasks/verify.yml38
-rw-r--r--test/integration/targets/module_defaults/test_action_group_metadata.yml20
3 files changed, 55 insertions, 57 deletions
diff --git a/test/integration/targets/ansible-galaxy-collection/tasks/install.yml b/test/integration/targets/ansible-galaxy-collection/tasks/install.yml
index 9959dc60d4..d23c9cb3ff 100644
--- a/test/integration/targets/ansible-galaxy-collection/tasks/install.yml
+++ b/test/integration/targets/ansible-galaxy-collection/tasks/install.yml
@@ -207,6 +207,9 @@
command: ansible-galaxy collection install -r '{{ galaxy_dir }}/test_req.yml' {{ galaxy_verbosity }}
ignore_errors: True
register: result
+ environment:
+ ANSIBLE_NOCOLOR: True
+ ANSIBLE_FORCE_COLOR: False
- name: remove the requirements file
file:
@@ -216,9 +219,7 @@
- assert:
that: error == expected_error
vars:
- reset_color: '\x1b\[0m'
- color: '\x1b\[[0-9];[0-9]{2}m'
- error: "{{ result.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
+ error: "{{ result.stderr | regex_replace('\\n', ' ') }}"
expected_error: >-
ERROR! Failed to resolve the requested dependencies map.
Got the candidate namespace3.name:1.0.0 (direct request)
@@ -227,14 +228,15 @@
- name: test error for mismatched dependency versions
vars:
- reset_color: '\x1b\[0m'
- color: '\x1b\[[0-9];[0-9]{2}m'
- error: "{{ result.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
+ error: "{{ result.stderr | regex_replace('\\n', ' ') }}"
expected_error: >-
ERROR! Failed to resolve the requested dependencies map.
Got the candidate namespace3.name:1.0.0 (dependency of tmp_parent.name:1.0.0)
which didn't satisfy all of the following requirements:
* namespace3.name:1.2.0
+ environment:
+ ANSIBLE_NOCOLOR: True
+ ANSIBLE_FORCE_COLOR: False
block:
- name: init a new parent collection
command: ansible-galaxy collection init tmp_parent.name --init-path '{{ galaxy_dir }}/scratch'
@@ -546,6 +548,8 @@
environment:
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
ANSIBLE_GALAXY_REQUIRED_VALID_SIGNATURE_COUNT: all
+ ANSIBLE_NOCOLOR: True
+ ANSIBLE_FORCE_COLOR: False
- name: get result of install collections with ansible-galaxy install - {{ test_name }}
slurp:
@@ -571,9 +575,7 @@
- (install_req_actual.results[0].content | b64decode | from_json).collection_info.version == '1.0.0'
- (install_req_actual.results[1].content | b64decode | from_json).collection_info.version == '1.0.0'
vars:
- install_stderr: "{{ install_req.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
- reset_color: '\x1b\[0m'
- color: '\x1b\[[0-9];[0-9]{2}m'
+ install_stderr: "{{ install_req.stderr | regex_replace('\\n', ' ') }}"
- name: clean up collections from last test
file:
@@ -594,6 +596,8 @@
keyring: "{{ gpg_homedir }}/pubring.kbx"
environment:
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
+ ANSIBLE_NOCOLOR: True
+ ANSIBLE_FORCE_COLOR: False
- name: get result of install collections with ansible-galaxy install - {{ test_name }}
slurp:
@@ -619,9 +623,7 @@
- (install_req_actual.results[1].content | b64decode | from_json).collection_info.version == '1.0.0'
- (install_req_actual.results[2].content | b64decode | from_json).collection_info.version == '1.0.0'
vars:
- install_stderr: "{{ install_req.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
- reset_color: '\x1b\[0m'
- color: '\x1b\[[0-9];[0-9]{2}m'
+ install_stderr: "{{ install_req.stderr | regex_replace('\\n', ' ') }}"
- name: clean up collections from last test
file:
@@ -645,6 +647,8 @@
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
ANSIBLE_GALAXY_REQUIRED_VALID_SIGNATURE_COUNT: all
ANSIBLE_GALAXY_IGNORE_SIGNATURE_STATUS_CODES: BADSIG # cli option is appended and both status codes are ignored
+ ANSIBLE_NOCOLOR: True
+ ANSIBLE_FORCE_COLOR: False
- name: get result of install collections with ansible-galaxy install - {{ test_name }}
slurp:
@@ -670,9 +674,7 @@
- (install_req_actual.results[1].content | b64decode | from_json).collection_info.version == '1.0.0'
- (install_req_actual.results[2].content | b64decode | from_json).collection_info.version == '1.0.0'
vars:
- install_stderr: "{{ install_req.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
- reset_color: '\x1b\[0m'
- color: '\x1b\[[0-9];[0-9]{2}m'
+ install_stderr: "{{ install_req.stderr | regex_replace('\\n', ' ') }}"
- name: clean up collections from last test
file:
@@ -808,6 +810,8 @@
command: ansible-galaxy collection install namespace1.name1 -vvvv {{ signature_option }} {{ keyring_option }}
environment:
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
+ ANSIBLE_NOCOLOR: True
+ ANSIBLE_FORCE_COLOR: False
vars:
signature_option: "--signature file://{{ gpg_homedir }}/namespace1-name1-1.0.9-MANIFEST.json.asc"
keyring_option: '--keyring {{ gpg_homedir }}/i_do_not_exist.kbx'
@@ -837,18 +841,17 @@
Configure a keyring for ansible-galaxy to use
or disable signature verification.
Skipping signature verification.
- actual_warning: "{{ keyring_error.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
- stdout_no_color: "{{ keyring_error.stdout | regex_replace(reset_color) | regex_replace(color) }}"
+ actual_warning: "{{ keyring_error.stderr | regex_replace('\\n', ' ') }}"
# Remove formatting from the reason so it's one line
- actual_error: "{{ stdout_no_color | regex_replace('\"') | regex_replace('\\n') | regex_replace(' ', ' ') }}"
- reset_color: '\x1b\[0m'
- color: '\x1b\[[0-9];[0-9]{2}m'
+ actual_error: "{{ keyring_error.stdout | regex_replace('\"') | regex_replace('\\n') | regex_replace(' ', ' ') }}"
# TODO: Uncomment once signatures are provided by pulp-galaxy-ng
#- name: install collection with signature provided by Galaxy server (no keyring)
# command: ansible-galaxy collection install namespace1.name1 {{ galaxy_verbosity }}
# environment:
# ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
+# ANSIBLE_NOCOLOR: True
+# ANSIBLE_FORCE_COLOR: False
# ignore_errors: yes
# register: keyring_warning
#
@@ -867,9 +870,7 @@
# Configure a keyring for ansible-galaxy to use
# or disable signature verification.
# Skipping signature verification.
-# actual_warning: "{{ keyring_warning.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
-# reset_color: '\x1b\[0m'
-# color: '\x1b\[[0-9];[0-9]{2}m'
+# actual_warning: "{{ keyring_warning.stderr | regex_replace('\\n', ' ') }}"
- name: install simple collection from first accessible server with valid detached signature
command: ansible-galaxy collection install namespace1.name1 {{ galaxy_verbosity }} {{ signature_options }}
@@ -912,6 +913,8 @@
command: ansible-galaxy collection install namespace1.name1 -vvvv {{ signature_options }}
environment:
ANSIBLE_COLLECTIONS_PATH: '{{ galaxy_dir }}/ansible_collections'
+ ANSIBLE_NOCOLOR: True
+ ANSIBLE_FORCE_COLOR: False
vars:
signature_options: "--signature {{ signature }} --keyring {{ keyring }}"
signature: "file://{{ gpg_homedir }}/namespace2-name-1.0.0-MANIFEST.json.asc"
@@ -929,11 +932,8 @@
expected_errors:
- "* This is the counterpart to SUCCESS and used to indicate a program failure."
- "* The signature with the keyid has not been verified okay."
- stdout_no_color: "{{ invalid_signature.stdout | regex_replace(reset_color) | regex_replace(color) }}"
# Remove formatting from the reason so it's one line
- install_stdout: "{{ stdout_no_color | regex_replace('\"') | regex_replace('\\n') | regex_replace(' ', ' ') }}"
- reset_color: '\x1b\[0m'
- color: '\x1b\[[0-9];[0-9]{2}m'
+ install_stdout: "{{ invalid_signature.stdout | regex_replace('\"') | regex_replace('\\n') | regex_replace(' ', ' ') }}"
- name: validate collection directory was not created
file:
diff --git a/test/integration/targets/ansible-galaxy-collection/tasks/verify.yml b/test/integration/targets/ansible-galaxy-collection/tasks/verify.yml
index abe6fcc9f4..dfe3d0f714 100644
--- a/test/integration/targets/ansible-galaxy-collection/tasks/verify.yml
+++ b/test/integration/targets/ansible-galaxy-collection/tasks/verify.yml
@@ -301,6 +301,9 @@
keyring: "{{ gpg_homedir }}/pubring.kbx"
register: verify
ignore_errors: yes
+ environment:
+ ANSIBLE_NOCOLOR: True
+ ANSIBLE_FORCE_COLOR: False
- assert:
that:
@@ -312,11 +315,8 @@
expected_errors:
- "* This is the counterpart to SUCCESS and used to indicate a program failure."
- "* The signature with the keyid has not been verified okay."
- stdout_no_color: "{{ verify.stdout | regex_replace(reset_color) | regex_replace(color) }}"
# Remove formatting from the reason so it's one line
- verify_stdout: "{{ stdout_no_color | regex_replace('\"') | regex_replace('\\n') | regex_replace(' ', ' ') }}"
- reset_color: '\x1b\[0m'
- color: '\x1b\[[0-9];[0-9]{2}m'
+ verify_stdout: "{{ verify.stdout | regex_replace('\"') | regex_replace('\\n') | regex_replace(' ', ' ') }}"
# This command is hardcoded with -vvvv purposefully to evaluate extra verbosity messages
- name: verify the installed collection with invalid detached signature offline
@@ -327,6 +327,9 @@
keyring: "{{ gpg_homedir }}/pubring.kbx"
register: verify
ignore_errors: yes
+ environment:
+ ANSIBLE_NOCOLOR: True
+ ANSIBLE_FORCE_COLOR: False
- assert:
that:
@@ -338,11 +341,8 @@
expected_errors:
- "* This is the counterpart to SUCCESS and used to indicate a program failure."
- "* The signature with the keyid has not been verified okay."
- stdout_no_color: "{{ verify.stdout | regex_replace(reset_color) | regex_replace(color) }}"
# Remove formatting from the reason so it's one line
- verify_stdout: "{{ stdout_no_color | regex_replace('\"') | regex_replace('\\n') | regex_replace(' ', ' ') }}"
- reset_color: '\x1b\[0m'
- color: '\x1b\[[0-9];[0-9]{2}m'
+ verify_stdout: "{{ verify.stdout | regex_replace('\"') | regex_replace('\\n') | regex_replace(' ', ' ') }}"
- include_tasks: revoke_gpg_key.yml
@@ -355,6 +355,9 @@
keyring: "{{ gpg_homedir }}/pubring.kbx"
register: verify
ignore_errors: yes
+ environment:
+ ANSIBLE_NOCOLOR: True
+ ANSIBLE_FORCE_COLOR: False
- assert:
that:
@@ -366,11 +369,8 @@
expected_errors:
- "* The used key has been revoked by its owner."
- "* The signature with the keyid is good, but the signature was made by a revoked key."
- stdout_no_color: "{{ verify.stdout | regex_replace(reset_color) | regex_replace(color) }}"
# Remove formatting from the reason so it's one line
- verify_stdout: "{{ stdout_no_color | regex_replace('\"') | regex_replace('\\n') | regex_replace(' ', ' ') }}"
- reset_color: '\x1b\[0m'
- color: '\x1b\[[0-9];[0-9]{2}m'
+ verify_stdout: "{{ verify.stdout | regex_replace('\"') | regex_replace('\\n') | regex_replace(' ', ' ') }}"
# This command is hardcoded with no verbosity purposefully to evaluate overall gpg failure
- name: verify that ignoring the signature error and no successful signatures is not successful verification
@@ -383,6 +383,8 @@
ignore_errors: yes
environment:
ANSIBLE_GALAXY_IGNORE_SIGNATURE_STATUS_CODES: REVKEYSIG,KEYREVOKED
+ ANSIBLE_NOCOLOR: True
+ ANSIBLE_FORCE_COLOR: False
- assert:
that:
@@ -394,11 +396,8 @@
ignored_errors:
- "* The used key has been revoked by its owner."
- "* The signature with the keyid is good, but the signature was made by a revoked key."
- stdout_no_color: "{{ verify.stdout | regex_replace(reset_color) | regex_replace(color) }}"
# Remove formatting from the reason so it's one line
- verify_stdout: "{{ stdout_no_color | regex_replace('\"') | regex_replace('\\n') | regex_replace(' ', ' ') }}"
- reset_color: '\x1b\[0m'
- color: '\x1b\[[0-9];[0-9]{2}m'
+ verify_stdout: "{{ verify.stdout | regex_replace('\"') | regex_replace('\\n') | regex_replace(' ', ' ') }}"
# This command is hardcoded with -vvvv purposefully to evaluate extra verbosity messages
- name: verify that ignoring the signature error and no successful signatures and required signature count all is successful verification
@@ -412,6 +411,8 @@
environment:
ANSIBLE_GALAXY_IGNORE_SIGNATURE_STATUS_CODES: REVKEYSIG,KEYREVOKED
ANSIBLE_GALAXY_REQUIRED_VALID_SIGNATURE_COUNT: all
+ ANSIBLE_NOCOLOR: True
+ ANSIBLE_FORCE_COLOR: False
- assert:
that:
@@ -429,11 +430,8 @@
ignored_errors:
- "* The used key has been revoked by its owner."
- "* The signature with the keyid is good, but the signature was made by a revoked key."
- stdout_no_color: "{{ verify.stdout | regex_replace(reset_color) | regex_replace(color) }}"
# Remove formatting from the reason so it's one line
- verify_stdout: "{{ stdout_no_color | regex_replace('\"') | regex_replace('\\n') | regex_replace(' ', ' ') }}"
- reset_color: '\x1b\[0m'
- color: '\x1b\[[0-9];[0-9]{2}m'
+ verify_stdout: "{{ verify.stdout | regex_replace('\"') | regex_replace('\\n') | regex_replace(' ', ' ') }}"
- name: use lenient signature verification (default) without providing signatures
command: ansible-galaxy collection verify namespace1.name1:1.0.0 -vvvv --keyring {{ gpg_homedir }}/pubring.kbx
diff --git a/test/integration/targets/module_defaults/test_action_group_metadata.yml b/test/integration/targets/module_defaults/test_action_group_metadata.yml
index d2ba8dc206..e2555b1f29 100644
--- a/test/integration/targets/module_defaults/test_action_group_metadata.yml
+++ b/test/integration/targets/module_defaults/test_action_group_metadata.yml
@@ -1,9 +1,9 @@
---
- hosts: localhost
gather_facts: no
- vars:
- reset_color: '\x1b\[0m'
- color: '\x1b\[[0-9];[0-9]{2}m'
+ environment:
+ ANSIBLE_NOCOLOR: True
+ ANSIBLE_FORCE_COLOR: False
tasks:
- template:
@@ -18,7 +18,7 @@
- assert:
that: metadata_warning not in warnings
vars:
- warnings: "{{ result.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
+ warnings: "{{ result.stderr | regex_replace('\\n', ' ') }}"
metadata_warning: "Invalid metadata was found"
- template:
@@ -33,7 +33,7 @@
- assert:
that: metadata_warning in warnings
vars:
- warnings: "{{ result.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
+ warnings: "{{ result.stderr | regex_replace('\\n', ' ') }}"
metadata_warning: >-
Invalid metadata was found for action_group testns.testcoll.bad_metadata_format while loading module_defaults.
The only expected key is metadata, but got keys: metadata, unexpected_key
@@ -50,7 +50,7 @@
- assert:
that: metadata_warning in warnings
vars:
- warnings: "{{ result.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
+ warnings: "{{ result.stderr | regex_replace('\\n', ' ') }}"
metadata_warning: >-
Invalid metadata was found for action_group testns.testcoll.multiple_metadata while loading module_defaults.
The group contains multiple metadata entries.
@@ -67,7 +67,7 @@
- assert:
that: metadata_warning in warnings
vars:
- warnings: "{{ result.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
+ warnings: "{{ result.stderr | regex_replace('\\n', ' ') }}"
metadata_warning: >-
Invalid metadata was found for action_group testns.testcoll.bad_metadata_options while loading module_defaults.
The metadata contains unexpected keys: unexpected_key
@@ -84,7 +84,7 @@
- assert:
that: metadata_warning in warnings
vars:
- warnings: "{{ result.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
+ warnings: "{{ result.stderr | regex_replace('\\n', ' ') }}"
metadata_warning: >-
Invalid metadata was found for action_group testns.testcoll.bad_metadata_type while loading module_defaults.
The metadata is not a dictionary. Got ['testgroup']
@@ -101,7 +101,7 @@
- assert:
that: metadata_warning in warnings
vars:
- warnings: "{{ result.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
+ warnings: "{{ result.stderr | regex_replace('\\n', ' ') }}"
metadata_warning: >-
Invalid metadata was found for action_group testns.testcoll.bad_metadata_option_type while loading module_defaults.
The metadata contains unexpected key types: extend_group is {'name': 'testgroup'} (expected type list)
@@ -115,7 +115,7 @@
- assert:
that: metadata_warning not in warnings
vars:
- warnings: "{{ result.stderr | regex_replace(reset_color) | regex_replace(color) | regex_replace('\\n', ' ') }}"
+ warnings: "{{ result.stderr | regex_replace('\\n', ' ') }}"
metadata_warning: "Invalid metadata was found for action_group"
- file: