summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLee Garrett <lgarrett@rocketjump.eu>2023-07-17 14:21:21 +0200
committerLee Garrett <lgarrett@rocketjump.eu>2023-07-17 14:21:21 +0200
commita00ca87e07387d5be8152f7e1d2a69701f9949d6 (patch)
tree9f930fb63b5bda3aa8b40bb94b348a305ba9eb74 /test
parent8d9a6d9cdf440b0a9b254a8a4bf063c0cb6a6201 (diff)
downloaddebian-ansible-core-a00ca87e07387d5be8152f7e1d2a69701f9949d6.zip
New upstream version 2.14.7
Diffstat (limited to 'test')
-rw-r--r--test/integration/targets/canonical-pep517-self-packaging/minimum-build-constraints.txt1
-rw-r--r--test/integration/targets/canonical-pep517-self-packaging/modernish-build-constraints.txt1
-rw-r--r--test/integration/targets/uri/tasks/main.yml12
-rw-r--r--test/lib/ansible_test/_internal/data.py9
-rw-r--r--test/lib/ansible_test/_internal/git.py2
-rw-r--r--test/lib/ansible_test/_internal/provider/layout/__init__.py2
-rw-r--r--test/lib/ansible_test/_internal/provider/layout/ansible.py15
-rw-r--r--test/lib/ansible_test/_internal/provider/layout/collection.py10
8 files changed, 40 insertions, 12 deletions
diff --git a/test/integration/targets/canonical-pep517-self-packaging/minimum-build-constraints.txt b/test/integration/targets/canonical-pep517-self-packaging/minimum-build-constraints.txt
index ea5d8084..3ba47aeb 100644
--- a/test/integration/targets/canonical-pep517-self-packaging/minimum-build-constraints.txt
+++ b/test/integration/targets/canonical-pep517-self-packaging/minimum-build-constraints.txt
@@ -13,4 +13,3 @@ docutils == 0.16
Jinja2 == 3.0.0
MarkupSafe == 2.0.0
PyYAML == 5.3
-straight.plugin == 1.4.2
diff --git a/test/integration/targets/canonical-pep517-self-packaging/modernish-build-constraints.txt b/test/integration/targets/canonical-pep517-self-packaging/modernish-build-constraints.txt
index 7f744afd..9b8e9d0a 100644
--- a/test/integration/targets/canonical-pep517-self-packaging/modernish-build-constraints.txt
+++ b/test/integration/targets/canonical-pep517-self-packaging/modernish-build-constraints.txt
@@ -8,4 +8,3 @@ docutils == 0.19
Jinja2 == 3.1.2
MarkupSafe == 2.1.2
PyYAML == 6.0
-straight.plugin == 1.5.0 # WARNING: v1.5.0 doesn't have a Git tag / src
diff --git a/test/integration/targets/uri/tasks/main.yml b/test/integration/targets/uri/tasks/main.yml
index 7fa687b4..9ba09ece 100644
--- a/test/integration/targets/uri/tasks/main.yml
+++ b/test/integration/targets/uri/tasks/main.yml
@@ -687,6 +687,18 @@
that:
- result.json.json[0] == 'JSON Test Pattern pass1'
+- name: Test find JSON as subtype
+ uri:
+ url: "https://{{ httpbin_host }}/response-headers?content-type=application/ld%2Bjson"
+ method: POST
+ return_content: true
+ register: result
+
+- name: Validate JSON as subtype
+ assert:
+ that:
+ - result.json is defined
+
- name: Make request that includes password in JSON keys
uri:
url: "https://{{ httpbin_host}}/get?key-password=value-password"
diff --git a/test/lib/ansible_test/_internal/data.py b/test/lib/ansible_test/_internal/data.py
index 379ee7b0..67f7a06c 100644
--- a/test/lib/ansible_test/_internal/data.py
+++ b/test/lib/ansible_test/_internal/data.py
@@ -10,7 +10,6 @@ from .util import (
ApplicationError,
import_plugins,
is_subdir,
- is_valid_identifier,
ANSIBLE_LIB_ROOT,
ANSIBLE_TEST_ROOT,
ANSIBLE_SOURCE_ROOT,
@@ -219,12 +218,8 @@ class DataContext:
elif 'ansible_collections' not in cwd.split(os.path.sep):
blocks.append('No "ansible_collections" parent directory was found.')
- if self.content.collection:
- if not is_valid_identifier(self.content.collection.namespace):
- blocks.append(f'The namespace "{self.content.collection.namespace}" is an invalid identifier or a reserved keyword.')
-
- if not is_valid_identifier(self.content.collection.name):
- blocks.append(f'The name "{self.content.collection.name}" is an invalid identifier or a reserved keyword.')
+ if isinstance(self.content.unsupported, list):
+ blocks.extend(self.content.unsupported)
message = '\n'.join(blocks)
diff --git a/test/lib/ansible_test/_internal/git.py b/test/lib/ansible_test/_internal/git.py
index 4685f1d2..b6c5c7b4 100644
--- a/test/lib/ansible_test/_internal/git.py
+++ b/test/lib/ansible_test/_internal/git.py
@@ -77,7 +77,7 @@ class Git:
def get_branch_fork_point(self, branch: str) -> str:
"""Return a reference to the point at which the given branch was forked."""
- cmd = ['merge-base', '--fork-point', branch]
+ cmd = ['merge-base', branch, 'HEAD']
return self.run_git(cmd).strip()
def is_valid_ref(self, ref: str) -> bool:
diff --git a/test/lib/ansible_test/_internal/provider/layout/__init__.py b/test/lib/ansible_test/_internal/provider/layout/__init__.py
index 4eca05ce..a0a0609b 100644
--- a/test/lib/ansible_test/_internal/provider/layout/__init__.py
+++ b/test/lib/ansible_test/_internal/provider/layout/__init__.py
@@ -95,7 +95,7 @@ class ContentLayout(Layout):
unit_module_path: str,
unit_module_utils_path: str,
unit_messages: t.Optional[LayoutMessages],
- unsupported: bool = False,
+ unsupported: bool | list[str] = False,
) -> None:
super().__init__(root, paths)
diff --git a/test/lib/ansible_test/_internal/provider/layout/ansible.py b/test/lib/ansible_test/_internal/provider/layout/ansible.py
index d2f8cc81..3ee818a5 100644
--- a/test/lib/ansible_test/_internal/provider/layout/ansible.py
+++ b/test/lib/ansible_test/_internal/provider/layout/ansible.py
@@ -8,6 +8,11 @@ from . import (
LayoutProvider,
)
+from ...util import (
+ ANSIBLE_SOURCE_ROOT,
+ ANSIBLE_TEST_ROOT,
+)
+
class AnsibleLayout(LayoutProvider):
"""Layout provider for Ansible source."""
@@ -26,6 +31,15 @@ class AnsibleLayout(LayoutProvider):
module_utils='lib/ansible/module_utils',
)
+ errors: list[str] = []
+
+ if root != ANSIBLE_SOURCE_ROOT:
+ errors.extend((
+ f'Cannot test "{root}" with ansible-test from "{ANSIBLE_TEST_ROOT}".',
+ '',
+ f'Did you intend to run "{root}/bin/ansible-test" instead?',
+ ))
+
return ContentLayout(
root,
paths,
@@ -43,4 +57,5 @@ class AnsibleLayout(LayoutProvider):
unit_module_path='test/units/modules',
unit_module_utils_path='test/units/module_utils',
unit_messages=None,
+ unsupported=errors,
)
diff --git a/test/lib/ansible_test/_internal/provider/layout/collection.py b/test/lib/ansible_test/_internal/provider/layout/collection.py
index d747f31f..a9221be6 100644
--- a/test/lib/ansible_test/_internal/provider/layout/collection.py
+++ b/test/lib/ansible_test/_internal/provider/layout/collection.py
@@ -53,6 +53,14 @@ class CollectionLayout(LayoutProvider):
integration_targets_path = self.__check_integration_path(paths, integration_messages)
self.__check_unit_path(paths, unit_messages)
+ errors: list[str] = []
+
+ if not is_valid_identifier(collection_namespace):
+ errors.append(f'The namespace "{collection_namespace}" is an invalid identifier or a reserved keyword.')
+
+ if not is_valid_identifier(collection_name):
+ errors.append(f'The name "{collection_name}" is an invalid identifier or a reserved keyword.')
+
return ContentLayout(
root,
paths,
@@ -74,7 +82,7 @@ class CollectionLayout(LayoutProvider):
unit_module_path='tests/unit/plugins/modules',
unit_module_utils_path='tests/unit/plugins/module_utils',
unit_messages=unit_messages,
- unsupported=not (is_valid_identifier(collection_namespace) and is_valid_identifier(collection_name)),
+ unsupported=errors,
)
@staticmethod