From 90103145e0611bf83d91db2c617332f260ce6358 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Tue, 30 Aug 2016 13:48:49 -0400 Subject: [PATCH] Add basic validation for zuul services Move our testing into an ansible roles. Change-Id: I723de9603e8d6ef3ecf3e6177eb2bc72abf4fe55 Signed-off-by: Paul Belanger --- .gitignore | 1 - .../roles/test.zuul-launcher/tasks/main.yaml | 28 +++++++++++++++++++ .../roles/test.zuul-merger/tasks/main.yaml | 28 +++++++++++++++++++ .../roles/test.zuul-server/tasks/main.yaml | 28 +++++++++++++++++++ playbooks/zuul-launcher.yaml | 13 +-------- playbooks/zuul-merger.yaml | 13 +-------- playbooks/zuul-server.yaml | 13 +-------- 7 files changed, 87 insertions(+), 37 deletions(-) create mode 100644 playbooks/roles/test.zuul-launcher/tasks/main.yaml create mode 100644 playbooks/roles/test.zuul-merger/tasks/main.yaml create mode 100644 playbooks/roles/test.zuul-server/tasks/main.yaml diff --git a/.gitignore b/.gitignore index 241c159..7279786 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ AUTHORS ChangeLog doc/build/ -playbooks/roles diff --git a/playbooks/roles/test.zuul-launcher/tasks/main.yaml b/playbooks/roles/test.zuul-launcher/tasks/main.yaml new file mode 100644 index 0000000..79403aa --- /dev/null +++ b/playbooks/roles/test.zuul-launcher/tasks/main.yaml @@ -0,0 +1,28 @@ +# Copyright 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +--- +- name: Register /opt/venv/zuul-launcher + stat: + path: /opt/venv/zuul-launcher + register: test_zuul_pip_virtualenv_stat + +- name: Assert /opt/venv/zuul-launcher tests + assert: + that: + - test_zuul_pip_virtualenv_stat.stat.exists + - test_zuul_pip_virtualenv_stat.stat.isdir + +- name: Ensure zuul-launcher is running + shell: /usr/sbin/service zuul-launcher status + tags: skip_ansible_lint diff --git a/playbooks/roles/test.zuul-merger/tasks/main.yaml b/playbooks/roles/test.zuul-merger/tasks/main.yaml new file mode 100644 index 0000000..1cdf3d6 --- /dev/null +++ b/playbooks/roles/test.zuul-merger/tasks/main.yaml @@ -0,0 +1,28 @@ +# Copyright 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +--- +- name: Register /opt/venv/zuul-merger + stat: + path: /opt/venv/zuul-merger + register: test_zuul_pip_virtualenv_stat + +- name: Assert /opt/venv/zuul-merger tests + assert: + that: + - test_zuul_pip_virtualenv_stat.stat.exists + - test_zuul_pip_virtualenv_stat.stat.isdir + +- name: Ensure zuul-merger is running + shell: /usr/sbin/service zuul-merger status + tags: skip_ansible_lint diff --git a/playbooks/roles/test.zuul-server/tasks/main.yaml b/playbooks/roles/test.zuul-server/tasks/main.yaml new file mode 100644 index 0000000..6023da2 --- /dev/null +++ b/playbooks/roles/test.zuul-server/tasks/main.yaml @@ -0,0 +1,28 @@ +# Copyright 2016 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +--- +- name: Register /opt/venv/zuul-server + stat: + path: /opt/venv/zuul-server + register: test_zuul_pip_virtualenv_stat + +- name: Assert /opt/venv/zuul-server tests + assert: + that: + - test_zuul_pip_virtualenv_stat.stat.exists + - test_zuul_pip_virtualenv_stat.stat.isdir + +- name: Ensure zuul-server is running + shell: /usr/sbin/service zuul-server status + tags: skip_ansible_lint diff --git a/playbooks/zuul-launcher.yaml b/playbooks/zuul-launcher.yaml index 185c6a7..86fab56 100644 --- a/playbooks/zuul-launcher.yaml +++ b/playbooks/zuul-launcher.yaml @@ -18,18 +18,7 @@ roles: - windmill.jenkins-job-builder - windmill.zuul - - post_tasks: - - name: Register /opt/venv/zuul-launcher - stat: - path: /opt/venv/zuul-launcher - register: test_zuul_pip_virtualenv_stat - - - name: Assert /opt/venv/zuul-launcher tests - assert: - that: - - test_zuul_pip_virtualenv_stat.stat.exists - - test_zuul_pip_virtualenv_stat.stat.isdir + - test.zuul-launcher vars_files: - vars/zuul.yaml diff --git a/playbooks/zuul-merger.yaml b/playbooks/zuul-merger.yaml index 5d5dc44..67fef9a 100644 --- a/playbooks/zuul-merger.yaml +++ b/playbooks/zuul-merger.yaml @@ -17,18 +17,7 @@ roles: - windmill.zuul - - post_tasks: - - name: Register /opt/venv/zuul-merger - stat: - path: /opt/venv/zuul-merger - register: test_zuul_pip_virtualenv_stat - - - name: Assert /opt/venv/zuul-merger tests - assert: - that: - - test_zuul_pip_virtualenv_stat.stat.exists - - test_zuul_pip_virtualenv_stat.stat.isdir + - test.zuul-merger vars_files: - vars/zuul.yaml diff --git a/playbooks/zuul-server.yaml b/playbooks/zuul-server.yaml index 976765d..da8e927 100644 --- a/playbooks/zuul-server.yaml +++ b/playbooks/zuul-server.yaml @@ -18,18 +18,7 @@ roles: - windmill.zuul - windmill.ssh - - post_tasks: - - name: Register /opt/venv/zuul-server - stat: - path: /opt/venv/zuul-server - register: test_zuul_pip_virtualenv_stat - - - name: Assert /opt/venv/zuul-server-env tests - assert: - that: - - test_zuul_pip_virtualenv_stat.stat.exists - - test_zuul_pip_virtualenv_stat.stat.isdir + - test.zuul-server vars_files: - vars/zuul.yaml