Skip to content

Commit

Permalink
Merge pull request #16 from DonGiovanni83/feature/init-molecule
Browse files Browse the repository at this point in the history
Init local molecule testing with vagrant
  • Loading branch information
DonGiovanni83 authored Sep 6, 2023
2 parents 8a85df4 + 082b081 commit fa9cd90
Show file tree
Hide file tree
Showing 7 changed files with 774 additions and 592 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ test-sanity:
test-coverage-report:
pipenv run ansible-test coverage report

test: test-sanity test-unit test-coverage-report
test-molecule:
pipenv run molecule test --all

test: test-sanity test-unit test-coverage-report test-molecule
9 changes: 5 additions & 4 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ verify_ssl = true
name = "pypi"

[packages]
ansible = "*"

[dev-packages]
antsibull-docs = "*"
ansible = "==8.2.0"
molecule = "<6"
antsibull-docs = "==2.3.1"
coverage = "==6.5.0"
# See current bug https://github.com/ansible-community/molecule-plugins/issues/176
molecule-plugins = {extras = ["vagrant"], git = "https://github.com/ansible-community/molecule-plugins.git"}

[requires]
python_version = "3.10"
1,290 changes: 703 additions & 587 deletions Pipfile.lock

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions molecule/get_xml_tag/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: converge
hosts: all
tasks:
- name: Converge - Read theme value from config
puzzle.opnsense.get_xml_tag:
tag: theme
register: theme_value

- ansible.builtin.assert:
that: theme_value.msg == "opnsense"
45 changes: 45 additions & 0 deletions molecule/get_xml_tag/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
scenario:
name: default
test_sequence:
# - dependency not relevant uless we have requirements
- destroy
- syntax
- create
- converge
- idempotence
- verify
- destroy

driver:
name: vagrant
parallel: true

platforms:
- name: "22.7"
hostname: false
box: puzzle/opnsense
box_version: "22.7"
memory: 1024
cpus: 2
instance_raw_config_args:
- 'vm.guest = :freebsd'
- 'ssh.sudo_command = "%c"'
- 'ssh.shell = "/bin/sh"'
- name: "23.1"
box: puzzle/opnsense
hostname: false
box_version: "23.1"
memory: 1024
cpus: 2
instance_raw_config_args:
- 'vm.guest = :freebsd'
- 'ssh.sudo_command = "%c"'
- 'ssh.shell = "/bin/sh"'

provisioner:
name: ansible
verifier:
name: ansible
options:
become: true
6 changes: 6 additions & 0 deletions molecule/get_xml_tag/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Verify connectivity to server
hosts: all
tasks:
- name: Ping the server
ansible.builtin.ping:
Empty file added plugins/modules/__init__.py
Empty file.

0 comments on commit fa9cd90

Please sign in to comment.