Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,30 @@ on:

jobs:
test:
name: test [${{ matrix.type }}-py${{ matrix.python }}${{ matrix.type == 'integration' && format('-Ⓐ{0}', matrix.artifactory) || '' }}]
permissions:
contents: read
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
type:
- unit
- integration
artifactory:
- latest
- 6.23.42
python:
- '3.8'
- '3.9'
# - '3.10' # tests totally broken.. mocks don't seem to work
# - '3.11-dev' # test broken: AttributeError: module 'pathlib' has no attribute '_Accessor'
exclude:
- type: unit
artifactory: latest
env:
PYTEST_ADDOPTS: '--color=yes'
GALACTORY_TEST_ARTIFACTORY_TAG: ${{ matrix.artifactory }}
outputs:
relver: ${{ steps.setvars.outputs.relver }}
branch: ${{ steps.setvars.outputs.branch }}
Expand All @@ -38,8 +49,13 @@ jobs:
working-directory: tests
run: pip install -r requirements.txt

- name: Pull
if: matrix.type == 'integration'
working-directory: tests/artifactory
run: docker compose pull

- name: Pytest
run: pytest tests/
run: pytest tests/${{ matrix.type }}

- name: Set vars
id: setvars
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ exclude = ["changelogs"]

[tool.pytest.ini_options]
minversion = "7.1"
addopts = "--cov --cov-report=xml"
# addopts = "--docker-compose=artifactory/docker-compose.yml"
addopts = "--cov --cov-report=xml --docker-compose=tests/artifactory/docker-compose.yml --docker-compose-remove-volumes --use-running-containers"
# addopts = "-ra -q"
testpaths = [
"unit",
# "integration",
"integration",
]
2 changes: 1 addition & 1 deletion tests/artifactory/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: '3'
services:
artifactory:
container_name: artifactory
image: docker.bintray.io/jfrog/artifactory-oss:latest
image: docker.bintray.io/jfrog/artifactory-oss:${GALACTORY_TEST_ARTIFACTORY_TAG:-latest}
ports:
- 8081:8081
- 8082:8082
Expand Down
16 changes: 16 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ def _finder(*paths):
return _finder


@pytest.fixture(scope='session')
def data_finder():
def _finder(*paths):
here = os.path.dirname(os.path.realpath(__file__))
data = os.path.join(here, 'data', *paths)
return data
return _finder


@pytest.fixture(scope='session')
def collection_finder(data_finder):
def _finder(*paths):
return data_finder('collections', *paths)
return _finder


@pytest.fixture(scope='session')
def fixture_loader(fixture_finder):
class FixtureLoader:
Expand Down
3 changes: 3 additions & 0 deletions tests/data/collections/briantist.one/v0.1.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ansible Collection - briantist.whatever

Documentation for the collection.
61 changes: 61 additions & 0 deletions tests/data/collections/briantist.one/v0.1.0/galaxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
### REQUIRED
# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
# content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with
# underscores or numbers and cannot contain consecutive underscores
namespace: briantist

# The name of the collection. Has the same character restrictions as 'namespace'
name: one

# The version of the collection. Must be compatible with semantic versioning
version: 0.1.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md

# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
# @nicks:irc/im.site#channel'
authors:
- your name <example@domain.com>


### OPTIONAL but strongly recommended
# A short summary description of the collection
description: your collection description

# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
license:
- GPL-2.0-or-later

# The path to the license file for the collection. This path is relative to the root of the collection. This key is
# mutually exclusive with 'license'
license_file: ''

# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
# requirements as 'namespace' and 'name'
tags: []

# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
# collection label 'namespace.name'. The value is a version range
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
# range specifiers can be set and are separated by ','
dependencies: {}

# The URL of the originating SCM repository
repository: http://example.com/repository

# The URL to any online docs
documentation: http://docs.example.com

# The URL to the homepage of the collection/project
homepage: http://example.com

# The URL to the collection issue tracker
issues: http://example.com/issue/tracker

# A list of file glob-like patterns used to filter any files or directories that should not be included in the build
# artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This
# uses 'fnmatch' to match the files or directories. Some directories and files like 'galaxy.yml', '*.pyc', '*.retry',
# and '.git' are always filtered
build_ignore: []
2 changes: 2 additions & 0 deletions tests/data/collections/briantist.one/v0.1.0/meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
requires_ansible: '>=2.11'
31 changes: 31 additions & 0 deletions tests/data/collections/briantist.one/v0.1.0/plugins/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Collections Plugins Directory

This directory can be used to ship various plugins inside an Ansible collection. Each plugin is placed in a folder that
is named after the type of plugin it is in. It can also include the `module_utils` and `modules` directory that
would contain module utils and modules respectively.

Here is an example directory of the majority of plugins currently supported by Ansible:

```
└── plugins
├── action
├── become
├── cache
├── callback
├── cliconf
├── connection
├── filter
├── httpapi
├── inventory
├── lookup
├── module_utils
├── modules
├── netconf
├── shell
├── strategy
├── terminal
├── test
└── vars
```

A full list of plugin types can be found at [Working With Plugins](https://docs.ansible.com/ansible-core/2.13/plugins/plugins.html).
3 changes: 3 additions & 0 deletions tests/data/collections/briantist.one/v0.2.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ansible Collection - briantist.whatever

Documentation for the collection.
61 changes: 61 additions & 0 deletions tests/data/collections/briantist.one/v0.2.0/galaxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
### REQUIRED
# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
# content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with
# underscores or numbers and cannot contain consecutive underscores
namespace: briantist

# The name of the collection. Has the same character restrictions as 'namespace'
name: one

# The version of the collection. Must be compatible with semantic versioning
version: 0.2.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md

# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
# @nicks:irc/im.site#channel'
authors:
- your name <example@domain.com>


### OPTIONAL but strongly recommended
# A short summary description of the collection
description: your collection description

# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
license:
- GPL-2.0-or-later

# The path to the license file for the collection. This path is relative to the root of the collection. This key is
# mutually exclusive with 'license'
license_file: ''

# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
# requirements as 'namespace' and 'name'
tags: []

# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
# collection label 'namespace.name'. The value is a version range
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
# range specifiers can be set and are separated by ','
dependencies: {}

# The URL of the originating SCM repository
repository: http://example.com/repository

# The URL to any online docs
documentation: http://docs.example.com

# The URL to the homepage of the collection/project
homepage: http://example.com

# The URL to the collection issue tracker
issues: http://example.com/issue/tracker

# A list of file glob-like patterns used to filter any files or directories that should not be included in the build
# artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This
# uses 'fnmatch' to match the files or directories. Some directories and files like 'galaxy.yml', '*.pyc', '*.retry',
# and '.git' are always filtered
build_ignore: []
2 changes: 2 additions & 0 deletions tests/data/collections/briantist.one/v0.2.0/meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
requires_ansible: '>=2.11'
31 changes: 31 additions & 0 deletions tests/data/collections/briantist.one/v0.2.0/plugins/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Collections Plugins Directory

This directory can be used to ship various plugins inside an Ansible collection. Each plugin is placed in a folder that
is named after the type of plugin it is in. It can also include the `module_utils` and `modules` directory that
would contain module utils and modules respectively.

Here is an example directory of the majority of plugins currently supported by Ansible:

```
└── plugins
├── action
├── become
├── cache
├── callback
├── cliconf
├── connection
├── filter
├── httpapi
├── inventory
├── lookup
├── module_utils
├── modules
├── netconf
├── shell
├── strategy
├── terminal
├── test
└── vars
```

A full list of plugin types can be found at [Working With Plugins](https://docs.ansible.com/ansible-core/2.13/plugins/plugins.html).
3 changes: 3 additions & 0 deletions tests/data/collections/briantist.two/v1.1.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ansible Collection - briantist.whatever

Documentation for the collection.
61 changes: 61 additions & 0 deletions tests/data/collections/briantist.two/v1.1.0/galaxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
### REQUIRED
# The namespace of the collection. This can be a company/brand/organization or product namespace under which all
# content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with
# underscores or numbers and cannot contain consecutive underscores
namespace: briantist

# The name of the collection. Has the same character restrictions as 'namespace'
name: two

# The version of the collection. Must be compatible with semantic versioning
version: 1.1.0

# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
readme: README.md

# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
# @nicks:irc/im.site#channel'
authors:
- your name <example@domain.com>


### OPTIONAL but strongly recommended
# A short summary description of the collection
description: your collection description

# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only
# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file'
license:
- GPL-2.0-or-later

# The path to the license file for the collection. This path is relative to the root of the collection. This key is
# mutually exclusive with 'license'
license_file: ''

# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character
# requirements as 'namespace' and 'name'
tags: []

# Collections that this collection requires to be installed for it to be usable. The key of the dict is the
# collection label 'namespace.name'. The value is a version range
# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version
# range specifiers can be set and are separated by ','
dependencies: {}

# The URL of the originating SCM repository
repository: http://example.com/repository

# The URL to any online docs
documentation: http://docs.example.com

# The URL to the homepage of the collection/project
homepage: http://example.com

# The URL to the collection issue tracker
issues: http://example.com/issue/tracker

# A list of file glob-like patterns used to filter any files or directories that should not be included in the build
# artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This
# uses 'fnmatch' to match the files or directories. Some directories and files like 'galaxy.yml', '*.pyc', '*.retry',
# and '.git' are always filtered
build_ignore: []
2 changes: 2 additions & 0 deletions tests/data/collections/briantist.two/v1.1.0/meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
requires_ansible: '>=2.11'
31 changes: 31 additions & 0 deletions tests/data/collections/briantist.two/v1.1.0/plugins/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Collections Plugins Directory

This directory can be used to ship various plugins inside an Ansible collection. Each plugin is placed in a folder that
is named after the type of plugin it is in. It can also include the `module_utils` and `modules` directory that
would contain module utils and modules respectively.

Here is an example directory of the majority of plugins currently supported by Ansible:

```
└── plugins
├── action
├── become
├── cache
├── callback
├── cliconf
├── connection
├── filter
├── httpapi
├── inventory
├── lookup
├── module_utils
├── modules
├── netconf
├── shell
├── strategy
├── terminal
├── test
└── vars
```

A full list of plugin types can be found at [Working With Plugins](https://docs.ansible.com/ansible-core/2.13/plugins/plugins.html).
3 changes: 3 additions & 0 deletions tests/data/collections/briantist.two/v2.2.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ansible Collection - briantist.whatever

Documentation for the collection.
Loading