Skip to content
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

WIP: Add ansible-role-functional-centos-7 job #11

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 24 additions & 4 deletions .zuul.yaml
@@ -1,7 +1,27 @@
- nodeset:
name: centos-7
nodes:
- name: centos-7
label: dib-centos-7

- job:
name: ansible-role-functional-base
abstract: true
parent: tox
description: |
Run functional functional tests for ansible-role projects.

Uses tox with the ``functional`` environment.
pre-run: tests/playbooks/ansible-role-functional/pre.yaml
run: tests/playbooks/tox-with-sudo/run.yaml
vars:
tox_envlist: functional

- job:
name: ansible-role-functional-centos-7
parent: ansible-role-functional-base

- project:
check:
jobs:
- tox-linters
gate:
jobs:
- tox-linters
- ansible-role-functional-centos-7
1 change: 1 addition & 0 deletions test-requirements.txt
@@ -1 +1,2 @@
flake8
ansible
2 changes: 2 additions & 0 deletions tests/ansible.cfg
@@ -0,0 +1,2 @@
[defaults]
roles_path = ../..
11 changes: 11 additions & 0 deletions tests/playbooks/ansible-role-functional/pre.yaml
@@ -0,0 +1,11 @@
- hosts: all
name: Set up SSH login
tasks:
- name: Allow ssh login into localhost
shell:
cmd: |
# Allow user to ssh into localhost
ssh-keygen -f ~/.ssh/id_rsa -N ""
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh-keyscan localhost >> ~/.ssh/known_hosts
ssh-keyscan 127.0.0.1 >> ~/.ssh/known_hosts
3 changes: 3 additions & 0 deletions tests/playbooks/tox-with-sudo/run.yaml
@@ -0,0 +1,3 @@
- hosts: all
roles:
- tox
5 changes: 3 additions & 2 deletions tests/test.yml
@@ -1,5 +1,6 @@
---
- hosts: localhost
remote_user: root
vars:
rolename: "{{ lookup('pipe', 'pwd') | dirname | basename }}"
roles:
- network-engine
- "{{ rolename }}"
10 changes: 10 additions & 0 deletions tox.ini
Expand Up @@ -6,6 +6,16 @@ skipsdist = True
[testenv]
deps = -r{toxinidir}/test-requirements.txt

[testenv:functional]
commands =
ansible-playbook -i tests/inventory tests/test.yaml
passenv =
HOME
USER
setenv =
ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg
PYTHONUNBUFFERED = 1

[testenv:venv]
commands = {posargs}

Expand Down