Skip to content

Commit

Permalink
[skip travis] normalize molecule.yml files
Browse files Browse the repository at this point in the history
Signed-off-by: Charlie Mordant <cmordant1@gmail.com>
  • Loading branch information
Tcharl committed Jun 3, 2023
1 parent c245ec3 commit 21ef977
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion molecule/default/molecule.yml
Expand Up @@ -12,7 +12,7 @@ driver:
name: virtualbox
platforms:
- name: dns.osgiliath.test
box: fedora/38-cloud-base
box: ${TESTBOX:-fedora/38-cloud-base}
provider_options:
cpus: 2
memory: 4096
Expand Down
6 changes: 3 additions & 3 deletions molecule/default/tests/test_default.py
Expand Up @@ -3,22 +3,22 @@

def test_hosts_file_contains_the_new_entry(host):
command = r"""cat /etc/hosts | \
egrep -c \
grep -Ec \
'[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\s+poc\.osgiliath\.test'"""
cmd = host.run(command)
assert int(cmd.stdout) >= 1


def test_additional_hostname1_added(host):
command = r"""cat /etc/hosts | \
egrep -c '^192\.168\.122\.1\s+idm\.osgiliath\.test$'"""
grep -Ec '^192\.168\.122\.1\s+idm\.osgiliath\.test$'"""
cmd = host.run(command)
assert '1' in cmd.stdout


def test_additional_hostname2_added(host):
command = r"""cat /etc/hosts | \
egrep -c '^192\.168\.122\.2.+infra\.osgiliath\.test'"""
grep -Ec '^192\.168\.122\.2.+infra\.osgiliath\.test'"""
cmd = host.run(command)
assert '1' in cmd.stdout

Expand Down
2 changes: 1 addition & 1 deletion molecule/kvm/molecule.yml
Expand Up @@ -12,7 +12,7 @@ driver:
name: libvirt
platforms:
- name: dns.osgiliath.test
box: fedora/38-cloud-base
box: ${TESTBOX:-fedora/38-cloud-base}
provider_options:
driver: "kvm"
cpus: 2
Expand Down
2 changes: 1 addition & 1 deletion molecule/parallels/molecule.yml
Expand Up @@ -12,7 +12,7 @@ driver:
name: parallels
platforms:
- name: dns.osgiliath.test
box: tcharl/fedora-36-aarch64
box: ${TESTBOX:-bento/fedora-38-arm64}
provider_options:
cpus: 2
memory: 2048
Expand Down
4 changes: 2 additions & 2 deletions tasks/host.yml
Expand Up @@ -3,7 +3,7 @@
- name: Host | check ip is in hostfile
ansible.builtin.shell: >
set -o pipefail &&
cat /etc/hosts | egrep -c '{{ ip.replace('\.', '\\.') }}'
cat /etc/hosts | grep -Ec '{{ ip.replace('\.', '\\.') }}'
register: hosts_ip_entry_exists
ignore_errors: true
failed_when: false
Expand All @@ -12,7 +12,7 @@
- name: Host | check ip and hostname is in hostfile
ansible.builtin.shell: >
set -o pipefail &&
cat /etc/hosts | egrep -c '{{ ip.replace('\.', '\\.') }}.*{{ hostname.replace('\.', '\\.') }}'
cat /etc/hosts | grep -Ec '{{ ip.replace('\.', '\\.') }}.*{{ hostname.replace('\.', '\\.') }}'
register: hosts_entry_exists
ignore_errors: true
failed_when: false
Expand Down
15 changes: 9 additions & 6 deletions tox.ini
Expand Up @@ -44,12 +44,6 @@ commands =
yamllint .
flake8
ansible-lint
[testenv:create]
setenv =
DEPENDENCY_ENABLED=False
deps =
-r requirements-dev.txt
commands = molecule create {posargs}
[common-ansible-path]
setenv =
ANSIBLE_ROLES_PATH={toxinidir}/../community:{toxinidir}/../oss:{toxinidir}/..
Expand All @@ -58,6 +52,15 @@ commands =
mkdir -p {toxinidir}/../community
mkdir -p {toxinidir}/../oss
mkdir -p {toxinidir}/../community-collections
[testenv:create]
allowlist_externals=mkdir
setenv =
{[common-ansible-path]setenv}
deps =
-r requirements-dev.txt
commands =
{[common-ansible-path]commands}
molecule create {posargs}
[testenv:converge]
allowlist_externals=mkdir
setenv =
Expand Down

0 comments on commit 21ef977

Please sign in to comment.