Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Commit

Permalink
Changed to use Molecule Wrapper for tests (#29)
Browse files Browse the repository at this point in the history
To make it easier for other developers to test the role.
  • Loading branch information
freemanjp authored Sep 14, 2018
1 parent 9c3c1b2 commit e15e26c
Show file tree
Hide file tree
Showing 7 changed files with 791 additions and 32 deletions.
1 change: 1 addition & 0 deletions .moleculew/ansible_version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.6.4
1 change: 1 addition & 0 deletions .moleculew/docker_lib_version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.5.0
1 change: 1 addition & 0 deletions .moleculew/molecule_version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.17.0
1 change: 1 addition & 0 deletions .moleculew/python_version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.15
41 changes: 11 additions & 30 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
language: python
python: '2.7'

# Spin off separate builds for each of the following versions of Ansible
env:
- ANSIBLE_VERSION=2.4.6
- ANSIBLE_VERSION=2.6.3
global:
- MOLECULEW_USE_SYSTEM=true
matrix:
# Spin off separate builds for each of the following versions of Ansible
- MOLECULEW_ANSIBLE=2.4.6
- MOLECULEW_ANSIBLE=2.6.3

# Require the standard build environment
sudo: required
Expand All @@ -17,37 +20,15 @@ dist: trusty
services:
- docker

# Cache Ansible and Molecule to speed things up
cache:
- pip

before_install:
- sudo apt-get -qq update
- sudo apt-get install -o Dpkg::Options::='--force-confold' --force-yes -y docker-ce

install:
# Install Ansible
- pip install "ansible~=$ANSIBLE_VERSION"

# Install Python API for Docker (required by Molecule Docker driver)
# Limit version as workaround for: https://github.com/ansible/ansible/issues/35612
- pip install 'docker<3.0'

# Install Molecule
- pip install 'molecule==2.16.0'

# Check Ansible version
- ansible --version

# Check Molecule version
- molecule --version
# Install dependencies
- ./moleculew wrapper-install

# Build the Docker images
- molecule create --scenario-name=$MOLECULE_SCENARIO
- molecule destroy --scenario-name=$MOLECULE_SCENARIO
# Display versions
- ./moleculew wrapper-versions

script:
- molecule test --scenario-name=$MOLECULE_SCENARIO
- ./moleculew test

branches:
only:
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,20 @@ To develop or test you'll need to have installed the following:
* [Ansible](https://www.ansible.com/)
* [Molecule](http://molecule.readthedocs.io/)
To test this role run the following command from the project root:
Because the above can be tricky to install, this project includes
[Molecule Wrapper](https://github.com/gantsign/molecule-wrapper). Molecule
Wrapper is a shell script that installs Molecule and it's dependencies (apart
from Linux) and then executes Molecule with the command you pass it.
To test this role using Molecule Wrapper run the following command from the
project root:
```bash
molecule test
./moleculew test
```

Note: some of the dependencies need `sudo` permission to install.

License
-------

Expand Down
Loading

0 comments on commit e15e26c

Please sign in to comment.