-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: integrate pytest-molecule
plugin
#124
Changes from 13 commits
a1bf2a1
2f68be2
d4c7c3c
d35539d
67dd05b
0de974d
e97022e
8665f9a
1648519
70657eb
21b0de7
3a0adc3
e07b0b2
373ef00
5c6418d
79802d9
6e8325e
aff79e0
ddf74b3
2dd8d4f
e7386d1
5d1677a
699e7d2
e8652c8
e085bc2
94a0af0
b0f07f5
6202eda
f051d4a
2aeb3a8
f53d18a
97582b2
55baec0
6f7deb0
8e2fe4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
coverage | ||
pytest>=6,<8.0.0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
# | ||
# This file is autogenerated by pip-compile with Python 3.7 | ||
# This file is autogenerated by pip-compile with Python 3.9 | ||
# by the following command: | ||
# | ||
# pip-compile --extra=docs --extra=test --no-annotate --output-file=.config/requirements.txt --resolver=backtracking --strip-extras --unsafe-package=ruamel-yaml-clib pyproject.toml | ||
# | ||
ansible-core==2.15.0 | ||
attrs==22.2.0 | ||
cffi==1.15.1 | ||
coverage==7.2.2 | ||
cryptography==40.0.2 | ||
exceptiongroup==1.1.1 | ||
importlib-metadata==6.6.0 | ||
importlib-resources==5.0.7 | ||
iniconfig==2.0.0 | ||
jinja2==3.1.2 | ||
markupsafe==2.1.2 | ||
packaging==23.0 | ||
pluggy==1.0.0 | ||
pycparser==2.21 | ||
pytest==7.2.2 | ||
pyyaml==6.0 | ||
resolvelib==1.0.1 | ||
tomli==2.0.1 | ||
typing-extensions==4.5.0 | ||
zipp==3.15.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
*********************************** | ||
Delegated driver installation guide | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this root molecule directory supported to be here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah looks like it's for the tests....... It can be moved to a /tests/fixtures/molecule directory There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can move this in a seperate PR There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so should I move it or not in this PR? |
||
*********************************** | ||
|
||
Requirements | ||
============ | ||
|
||
This driver is delegated to the developer. Up to the developer to implement | ||
requirements. | ||
|
||
Install | ||
======= | ||
|
||
This driver is delegated to the developer. Up to the developer to implement | ||
requirements. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
- name: Converge | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- name: "Include pytest-ansible" | ||
ansible.builtin.include_role: | ||
name: "pytest-ansible" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
- name: Create | ||
hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
no_log: "{{ molecule_no_log }}" | ||
tasks: | ||
# TODO: Developer must implement and populate 'server' variable | ||
|
||
- when: server.changed | default(false) | bool | ||
block: | ||
- name: Populate instance config dict | ||
ansible.builtin.set_fact: | ||
instance_conf_dict: | ||
{ | ||
"instance": "{{ }}", | ||
"address": "{{ }}", | ||
"user": "{{ }}", | ||
"port": "{{ }}", | ||
"identity_file": "{{ }}", | ||
} | ||
with_items: "{{ server.results }}" | ||
register: instance_config_dict | ||
|
||
- name: Convert instance config dict to a list | ||
ansible.builtin.set_fact: | ||
instance_conf: "{{ instance_config_dict.results | map(attribute='ansible_facts.instance_conf_dict') | list }}" | ||
|
||
- name: Dump instance config | ||
ansible.builtin.copy: | ||
content: | | ||
# Molecule managed | ||
|
||
{{ instance_conf | to_json | from_json | to_yaml }} | ||
dest: "{{ molecule_instance_config }}" | ||
mode: 0600 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
- name: Destroy | ||
hosts: localhost | ||
connection: local | ||
gather_facts: false | ||
no_log: "{{ molecule_no_log }}" | ||
tasks: | ||
# Developer must implement. | ||
|
||
# Mandatory configuration for Molecule to function. | ||
|
||
- name: Populate instance config | ||
ansible.builtin.set_fact: | ||
instance_conf: {} | ||
|
||
- name: Dump instance config | ||
ansible.builtin.copy: | ||
content: | | ||
# Molecule managed | ||
|
||
{{ instance_conf | to_json | from_json | to_yaml }} | ||
dest: "{{ molecule_instance_config }}" | ||
mode: 0600 | ||
when: server.changed | default(false) | bool |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
state: present | ||
|
||
driver: | ||
name: delegated | ||
|
||
platforms: | ||
- name: instance | ||
|
||
verifier: | ||
name: ansible | ||
|
||
provisioner: | ||
name: ansible | ||
log: true | ||
config_options: | ||
defaults: | ||
interpreter_python: auto | ||
verbosity: 1 | ||
|
||
scenario: | ||
name: test_scenario | ||
test_sequence: | ||
- lint | ||
- dependency | ||
- syntax | ||
- create | ||
- prepare | ||
- converge | ||
- verify |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
# This is an example playbook to execute Ansible tests. | ||
|
||
- name: Verify | ||
hosts: all | ||
gather_facts: false | ||
tasks: | ||
- name: Example assertion | ||
ansible.builtin.assert: | ||
that: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is why py3.7 and 3.8 are failing, core is pinned here, but to a version that isn't compatible with 3.7 or 3.8