Remove integration tests from ara-infra, move them to ara
Now that ara-{clients,server,plugins} have been merged back into ara, it's easier to keep everything in the same repository. Change-Id: I8baf5701abb4bd030c5f0b321790482e0f9c229b
This commit is contained in:
parent
6132dd9222
commit
d082cb29dc
@ -13,44 +13,6 @@
|
||||
post-run: tests/website-post.yaml
|
||||
success-url: logs/build/
|
||||
|
||||
- job:
|
||||
name: ara-component-integration-base
|
||||
parent: base
|
||||
vars:
|
||||
integration_ansible_name: "{{ ansible_user_dir }}/src/github.com/ansible/ansible"
|
||||
integration_ansible_version: null
|
||||
required-projects:
|
||||
- openstack/ara-infra
|
||||
- openstack/ara-server
|
||||
- openstack/ara-plugins
|
||||
- openstack/ara-clients
|
||||
run: playbooks/integration-tests.yaml
|
||||
post-run: tests/integration-post.yaml
|
||||
|
||||
- job:
|
||||
name: ara-integration-fedora-devel
|
||||
parent: ara-component-integration-base
|
||||
nodeset: fedora-latest
|
||||
required-projects:
|
||||
- name: github.com/ansible/ansible
|
||||
override-checkout: devel
|
||||
|
||||
- job:
|
||||
name: ara-integration-fedora-2.7
|
||||
parent: ara-component-integration-base
|
||||
nodeset: fedora-latest
|
||||
required-projects:
|
||||
- name: github.com/ansible/ansible
|
||||
override-checkout: stable-2.7
|
||||
|
||||
- job:
|
||||
name: ara-integration-ubuntu-2.6
|
||||
parent: ara-component-integration-base
|
||||
nodeset: ubuntu-bionic
|
||||
required-projects:
|
||||
- name: github.com/ansible/ansible
|
||||
override-checkout: stable-2.6
|
||||
|
||||
- job:
|
||||
name: ara-server-role-integration-base
|
||||
parent: base
|
||||
@ -84,16 +46,10 @@
|
||||
check:
|
||||
jobs:
|
||||
- ara-infra-website
|
||||
- ara-integration-fedora-2.7
|
||||
- ara-integration-fedora-devel:
|
||||
voting: false
|
||||
- ara-integration-ubuntu-2.6
|
||||
- ara-server-role-integration-ubuntu
|
||||
- ara-server-role-integration-fedora
|
||||
gate:
|
||||
jobs:
|
||||
- ara-infra-website
|
||||
- ara-integration-fedora-2.7
|
||||
- ara-integration-ubuntu-2.6
|
||||
- ara-server-role-integration-ubuntu
|
||||
- ara-server-role-integration-fedora
|
||||
|
@ -1,7 +0,0 @@
|
||||
- name: Run ARA integration tests
|
||||
hosts: all
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- name: Include the integration-tests role
|
||||
include_role:
|
||||
name: integration-tests
|
@ -1,37 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Root directory where integration tests will prepare and store data
|
||||
integration_root: "/tmp/ara-integration-tests"
|
||||
|
||||
# Directory where the virtualenv will be created
|
||||
integration_virtualenv: "{{ integration_root }}/venv"
|
||||
|
||||
# Directory where ARA_BASE_DIR will be set
|
||||
integration_data: "{{ integration_root }}/data"
|
||||
|
||||
# Whether the root directory should be cleaned up between runs
|
||||
integration_cleanup: true
|
||||
|
||||
# Name of the Ansible package
|
||||
# This can be "ansible" which will use pip or it could be something like
|
||||
# /home/user/git/ansible as well as git+https://github.com/ansible/ansible
|
||||
integration_ansible_name: ansible
|
||||
|
||||
# Version of Ansible from pypi to install
|
||||
integration_ansible_version: latest
|
@ -1,139 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Clean up integration test root
|
||||
file:
|
||||
path: "{{ integration_root }}"
|
||||
state: absent
|
||||
when: integration_cleanup | bool
|
||||
|
||||
- name: Create integration test root
|
||||
file:
|
||||
path: "{{ integration_root }}"
|
||||
state: directory
|
||||
|
||||
# Zuul already prepares the src repository on the remote node
|
||||
- name: Symlink Zuul repositories to integration test root
|
||||
file:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ integration_root }}/{{ item | basename }}"
|
||||
state: link
|
||||
loop:
|
||||
- "{{ ansible_user_dir }}/src/git.openstack.org/openstack/ara-infra"
|
||||
- "{{ ansible_user_dir }}/src/git.openstack.org/openstack/ara-clients"
|
||||
- "{{ ansible_user_dir }}/src/git.openstack.org/openstack/ara-plugins"
|
||||
- "{{ ansible_user_dir }}/src/git.openstack.org/openstack/ara-server"
|
||||
when: zuul is defined
|
||||
|
||||
- when: zuul is not defined
|
||||
block:
|
||||
- name: Prepare git repositories when not using Zuul
|
||||
git:
|
||||
repo: "{{ item }}"
|
||||
dest: "{{ integration_root }}/{{ item | basename }}"
|
||||
depth: 1
|
||||
force: yes
|
||||
loop:
|
||||
- "https://git.openstack.org/openstack/ara-clients"
|
||||
- "https://git.openstack.org/openstack/ara-plugins"
|
||||
- "https://git.openstack.org/openstack/ara-server"
|
||||
|
||||
# git rev-parse --show-toplevel returns the root git directory
|
||||
# We are synchronizing the current repository rather than cloning it in
|
||||
# order to be able to test local (unmerged) code if necessary.
|
||||
- name: Synchronize ara-infra to integration root
|
||||
synchronize:
|
||||
src: "{{ lookup('pipe', 'git rev-parse --show-toplevel') }}"
|
||||
dest: "{{ integration_root }}/"
|
||||
delete: yes
|
||||
|
||||
# If a version is not explicitly set we want to make sure to
|
||||
# completely omit the version argument to pip, as it will be coming
|
||||
# from the long-form integration_ansible_name variable. Additionally, if
|
||||
# the version is the special value "latest", then we also want to omit
|
||||
# any version number, but also set the package state to "latest".
|
||||
- name: Set Ansible version for installation
|
||||
set_fact:
|
||||
_install_ansible_version: "{{ integration_ansible_version }}"
|
||||
when: integration_ansible_version not in ("", "latest")
|
||||
|
||||
- name: Set Ansible package state for installation
|
||||
set_fact:
|
||||
_install_ansible_state: latest
|
||||
when: integration_ansible_version == "latest"
|
||||
|
||||
- name: Initialize virtual environment with Ansible
|
||||
pip:
|
||||
name: "{{ integration_ansible_name }}"
|
||||
version: "{{ _install_ansible_version | default(omit, True) }}"
|
||||
state: "{{ _install_ansible_state | default(omit, True) }}"
|
||||
virtualenv: "{{ integration_virtualenv }}"
|
||||
virtualenv_python: python3
|
||||
|
||||
- name: Install ARA packages in virtual environment for integration tests
|
||||
pip:
|
||||
name:
|
||||
- "{{ integration_root }}/ara-clients"
|
||||
- "{{ integration_root }}/ara-plugins"
|
||||
- "{{ integration_root }}/ara-server"
|
||||
state: present
|
||||
virtualenv: "{{ integration_virtualenv }}"
|
||||
virtualenv_python: python3
|
||||
|
||||
- name: Get ARA plugins directory
|
||||
command: "{{ integration_root }}/venv/bin/python -m ara.plugins"
|
||||
register: ara_plugins
|
||||
|
||||
# These aren't in the same task (i.e, with loop) so we can tell individual test
|
||||
# runs apart easily rather than keeping all the output bundled in a single task.
|
||||
# TODO: Add validation for the tests
|
||||
- environment:
|
||||
ANSIBLE_CALLBACK_PLUGINS: "{{ ara_plugins.stdout }}/callback"
|
||||
ANSIBLE_ACTION_PLUGINS: "{{ ara_plugins.stdout }}/action"
|
||||
ARA_DEBUG: true
|
||||
ARA_LOG_LEVEL: DEBUG
|
||||
ARA_BASE_DIR: "{{ integration_data }}"
|
||||
ARA_SECRET_KEY: testing
|
||||
vars:
|
||||
ansible_playbook: "{{ integration_virtualenv }}/bin/ansible-playbook -vvv"
|
||||
test_root: "{{ integration_root }}/ara-infra/tests/integration"
|
||||
block:
|
||||
# smoke.yaml tests setting ara_playbook_name in one of three plays
|
||||
- name: Run smoke.yaml integration test
|
||||
command: "{{ ansible_playbook }} {{ test_root }}/smoke.yaml"
|
||||
|
||||
- name: Run hosts.yaml integration test
|
||||
command: "{{ ansible_playbook }} {{ test_root }}/hosts.yaml"
|
||||
|
||||
- name: Run import.yaml integration test
|
||||
command: "{{ ansible_playbook }} {{ test_root }}/import.yaml"
|
||||
|
||||
# Tests setting ara_playbook_name as an extra var
|
||||
- name: Run failed.yaml integration test
|
||||
command: >
|
||||
{{ ansible_playbook }} {{ test_root }}/failed.yaml -e ara_playbook_name="Failed playbook"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Run incomplete.yaml integration test
|
||||
shell: |
|
||||
{{ ansible_playbook }} {{ test_root }}/incomplete.yaml &
|
||||
sleep 5
|
||||
kill $!
|
||||
args:
|
||||
executable: /bin/bash
|
||||
ignore_errors: yes
|
@ -1,37 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Integration tests post-run
|
||||
hosts: all
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- name: Create server log directory
|
||||
file:
|
||||
path: "{{ ansible_user_dir }}/workspace/logs"
|
||||
state: directory
|
||||
recurse: yes
|
||||
|
||||
- name: Recover integration test data
|
||||
command: cp -rp /tmp/ara-integration-tests/data {{ ansible_user_dir }}/workspace/logs/data
|
||||
|
||||
- name: Upload log artifacts
|
||||
synchronize:
|
||||
src: "{{ ansible_user_dir }}/workspace/logs"
|
||||
dest: "{{ zuul.executor.log_root }}"
|
||||
mode: pull
|
||||
verify_host: true
|
@ -1,25 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Failed playbook
|
||||
hosts: localhost
|
||||
tasks:
|
||||
- fail:
|
||||
msg: "This is a failed playbook"
|
||||
tags:
|
||||
- skip_ansible_lint
|
@ -1,48 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Create fake hosts for host tests
|
||||
hosts: localhost
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- name: Add fake hosts in inventory
|
||||
add_host:
|
||||
name: "{{ item }}"
|
||||
ansible_host: "127.0.0.1"
|
||||
ansible_connection: "local"
|
||||
with_items:
|
||||
- host1
|
||||
- host2
|
||||
- host3
|
||||
|
||||
- name: ARA Hosts test play
|
||||
hosts: all
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- name: Ping
|
||||
ping:
|
||||
|
||||
- name: Do something only on host1
|
||||
set_fact:
|
||||
something: 'done'
|
||||
when: inventory_hostname == 'host1'
|
||||
|
||||
- name: Fail something only on host2
|
||||
command: /bin/false
|
||||
when: inventory_hostname == 'host2'
|
||||
ignore_errors: true
|
@ -1,20 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- import_playbook: imported.yaml
|
||||
|
@ -1,34 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Tests for the new import tasks from Ansible 2.4
|
||||
- name: Import a role
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Import role
|
||||
import_role:
|
||||
name: imported-role
|
||||
|
||||
- name: Include a role
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Include role
|
||||
include_role:
|
||||
name: imported-role
|
@ -1,34 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Tests for https://github.com/ansible/ansible/issues/30385
|
||||
- name: Test include role without static
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Include role without static
|
||||
include_role:
|
||||
name: included-role
|
||||
|
||||
- name: Test include role with static
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Include role with static
|
||||
include_role:
|
||||
name: included-role
|
@ -1,27 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Incomplete playbook
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- debug:
|
||||
msg: "This playbook is meant to be interrupted"
|
||||
- name: Sleep for thirty seconds
|
||||
command: sleep 30
|
||||
changed_when: false
|
@ -1,20 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
role_message: "This message is from an imported role"
|
||||
task_message: "This message is from an imported task in an imported role"
|
@ -1,20 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- debug:
|
||||
msg: "{{ task_message }}"
|
@ -1,23 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Import task
|
||||
import_tasks: imported-task.yaml
|
||||
|
||||
- name: Include task
|
||||
include_tasks: imported-task.yaml
|
@ -1,20 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
role_message: "This message is from an included role"
|
||||
task_message: "This message is from an included task in an included role"
|
@ -1,20 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- debug:
|
||||
msg: "{{ task_message }}"
|
@ -1,20 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- debug:
|
||||
msg: "{{ role_message }}"
|
@ -1,29 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
list_items:
|
||||
- one
|
||||
- two
|
||||
|
||||
dict_items:
|
||||
one:
|
||||
name: "key-one"
|
||||
value: "value-one"
|
||||
two:
|
||||
name: "key-two"
|
||||
value: "value-two"
|
@ -1,199 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Ensure no_log is respected
|
||||
- name: Print normal data
|
||||
debug:
|
||||
msg: "normal data"
|
||||
|
||||
- name: Print confidential data
|
||||
debug:
|
||||
msg: "confidential data"
|
||||
no_log: "yes"
|
||||
|
||||
# ARA record and read modules specific tests
|
||||
- name: Record data with no type
|
||||
ara_record:
|
||||
key: "notype"
|
||||
value: "text"
|
||||
register: notype
|
||||
|
||||
- name: Validate notype key
|
||||
assert:
|
||||
that:
|
||||
- notype.key == "notype"
|
||||
- notype.value == "text"
|
||||
- notype.type == "text"
|
||||
|
||||
- name: Update notype key with specified playbook
|
||||
ara_record:
|
||||
playbook_id: "{{ notype.playbook_id }}"
|
||||
key: "notype"
|
||||
value: "updated text"
|
||||
type: "text"
|
||||
register: notype_update
|
||||
|
||||
- name: Validate notype key
|
||||
assert:
|
||||
that:
|
||||
- notype_update.key == "notype"
|
||||
- notype_update.value == "updated text"
|
||||
- notype_update.type == "text"
|
||||
|
||||
- name: Record data with text type
|
||||
ara_record:
|
||||
key: "foo"
|
||||
value: "bar"
|
||||
type: "text"
|
||||
|
||||
- name: Update existing key's value and type
|
||||
ara_record:
|
||||
key: "foo"
|
||||
value: "http://barfoo"
|
||||
type: "url"
|
||||
register: foo
|
||||
|
||||
- name: Validate foo key
|
||||
assert:
|
||||
that:
|
||||
- foo.key == "foo"
|
||||
- foo.value == "http://barfoo"
|
||||
- foo.type == "url"
|
||||
|
||||
- name: Add another k/v pair with ara_record
|
||||
ara_record:
|
||||
key: "bar"
|
||||
value: '{ "foo": "bar" }'
|
||||
type: "json"
|
||||
register: bar
|
||||
|
||||
- name: Validate bar key
|
||||
assert:
|
||||
that:
|
||||
- bar.key == "bar"
|
||||
- "bar.value == '{ \"foo\": \"bar\" }'"
|
||||
- bar.type == "json"
|
||||
|
||||
- name: Record a list value
|
||||
vars:
|
||||
someitems:
|
||||
- one
|
||||
- two
|
||||
- three
|
||||
- go
|
||||
ara_record:
|
||||
key: "somelist"
|
||||
value: "{{ someitems }}"
|
||||
type: "list"
|
||||
register: somelist
|
||||
|
||||
- name: Validate somelist key
|
||||
vars:
|
||||
someitems:
|
||||
- one
|
||||
- two
|
||||
- three
|
||||
- go
|
||||
assert:
|
||||
that:
|
||||
- somelist.key == "somelist"
|
||||
- somelist.value == someitems
|
||||
- somelist.type == "list"
|
||||
|
||||
- name: Record a dict value
|
||||
vars:
|
||||
dictdata:
|
||||
foo: "bar"
|
||||
bar: "foo"
|
||||
ara_record:
|
||||
key: "somedict"
|
||||
value: "{{ dictdata }}"
|
||||
type: "dict"
|
||||
register: somedict
|
||||
|
||||
- name: Validate somedict key
|
||||
vars:
|
||||
dictdata:
|
||||
foo: "bar"
|
||||
bar: "foo"
|
||||
assert:
|
||||
that:
|
||||
- somedict.key == "somedict"
|
||||
- somedict.value == dictdata
|
||||
- somedict.type == "dict"
|
||||
|
||||
- name: Record a list as a text type
|
||||
vars:
|
||||
list:
|
||||
- foo
|
||||
- bar
|
||||
ara_record:
|
||||
key: "list_as_text"
|
||||
value: "{{ list }}"
|
||||
type: "text"
|
||||
register: list_as_text
|
||||
|
||||
# The key is still recorded as an actual list, however, it will be rendered
|
||||
# as text in the UI.
|
||||
- name: Validate list_as_text key
|
||||
vars:
|
||||
list:
|
||||
- foo
|
||||
- bar
|
||||
assert:
|
||||
that:
|
||||
- list_as_text.key == "list_as_text"
|
||||
- list_as_text.value == list
|
||||
- list_as_text.value != "[u'foo', u'bar']"
|
||||
- list_as_text.type == "text"
|
||||
|
||||
# Things that should fail
|
||||
- name: Record with no key
|
||||
ara_record:
|
||||
value: "value"
|
||||
ignore_errors: "yes"
|
||||
register: nokey
|
||||
|
||||
- name: Validate nokey failure
|
||||
assert:
|
||||
that:
|
||||
- nokey.failed
|
||||
|
||||
- name: Record with no value
|
||||
ara_record:
|
||||
key: "key"
|
||||
ignore_errors: "yes"
|
||||
register: novalue
|
||||
|
||||
- name: Validate novalue failure
|
||||
assert:
|
||||
that:
|
||||
- novalue.failed
|
||||
|
||||
- name: Record with invalid type
|
||||
ara_record:
|
||||
key: "key"
|
||||
value: "value"
|
||||
type: "hadoop"
|
||||
ignore_errors: "yes"
|
||||
register: invalid
|
||||
|
||||
- name: Validate invalid failure
|
||||
assert:
|
||||
that:
|
||||
- invalid.failed
|
@ -1,23 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: Deferred setup
|
||||
setup:
|
||||
|
||||
- include_tasks: ara-ops.yaml
|
||||
- include_tasks: test-ops.yaml
|
@ -1,56 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Tests some things around blocks, failures and rescues
|
||||
|
||||
- block:
|
||||
- name: Debug message
|
||||
debug:
|
||||
msg: "Successful debug task"
|
||||
- name: Return false
|
||||
command: /bin/false
|
||||
- name: Command that should not run
|
||||
debug:
|
||||
msg: "This should never run"
|
||||
rescue:
|
||||
- name: Rescue task
|
||||
debug:
|
||||
msg: "Rescue was called successfully"
|
||||
always:
|
||||
- name: Task that should always run
|
||||
debug:
|
||||
msg: "This should always be printed"
|
||||
|
||||
- name: Test a skipped task
|
||||
debug:
|
||||
msg: "This is skipped"
|
||||
when: false
|
||||
|
||||
- name: Test with_items
|
||||
debug:
|
||||
msg: "{{ item }}"
|
||||
with_items: "{{ list_items }}"
|
||||
|
||||
- name: Test with_dict
|
||||
debug:
|
||||
msg: "{{ item.value.name }}: {{ item.value.value }}"
|
||||
with_dict: "{{ dict_items }}"
|
||||
|
||||
- name: Test for XSS
|
||||
command: echo "<script>alert(document.cookie)</script>"
|
||||
changed_when: False
|
@ -1,55 +0,0 @@
|
||||
---
|
||||
# Copyright (c) 2018 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of ARA Records Ansible.
|
||||
#
|
||||
# ARA is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# ARA is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with ARA. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
- name: ARA Tasks test play
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
vars:
|
||||
ara_playbook_name: Smoke tests
|
||||
tasks:
|
||||
- name: ARA Integration test
|
||||
debug:
|
||||
msg: "ARA Integration test"
|
||||
tags:
|
||||
- tagged
|
||||
roles:
|
||||
- { role: "smoke-tests" }
|
||||
|
||||
- name: Add a host with non-ascii characters
|
||||
hosts: localhost
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Add a host with non-ascii character
|
||||
add_host:
|
||||
name: "höstñämë"
|
||||
ansible_host: "127.0.0.1"
|
||||
ansible_connection: "local"
|
||||
tags:
|
||||
- untag
|
||||
- verytag
|
||||
|
||||
- name: Play with non-ascii characters - ä, ö, ü
|
||||
hosts: höstñämë
|
||||
gather_facts: yes
|
||||
tasks:
|
||||
- name: Task with non-ascii characters - ä, ö, ü
|
||||
debug:
|
||||
msg: "This is a task result with non-ascii characters: ä, ö, ü"
|
||||
tags:
|
||||
- untag
|
||||
- verytag
|
Loading…
Reference in New Issue
Block a user