ITOPS-2158 Added latest crowd molecule test

This commit is contained in:
Glenn Stewart
2019-11-01 15:27:17 +11:00
parent c10b312148
commit d7ef24eaa9
4 changed files with 104 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi

View File

@@ -0,0 +1,30 @@
---
dependency:
name: galaxy
driver:
name: docker
lint:
name: yamllint
platforms:
- name: amazon_linux2
image: amazonlinux:2
groups:
- aws_node_local
- name: ubuntu_lts
image: ubuntu:bionic
groups:
- aws_node_local
provisioner:
name: ansible
options:
skip-tags: runtime_pkg
lint:
name: ansible-lint
inventory:
links:
group_vars: ../../../../group_vars/
verifier:
name: testinfra
lint:
name: flake8
enabled: false

View File

@@ -0,0 +1,11 @@
---
- name: Converge
hosts: all
vars:
atl_product_family: "crowd"
atl_product_edition: "crowd"
atl_product_user: "crowd"
roles:
- role: linux_common
- role: product_common
- role: product_install

View File

@@ -0,0 +1,49 @@
import os
from six.moves import urllib
import json
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_version_downloaded(host):
verfile = host.file('/media/atl/crowd/shared/crowd.version')
assert verfile.exists
def test_symlink_created(host):
target = host.file('/opt/atlassian/crowd/current')
assert target.exists
assert target.is_symlink
def test_unpacked(host):
verfile = host.file('/opt/atlassian/crowd/current/bin/catalina.sh')
assert verfile.exists
def test_version_file_is_latest(host):
verfile = host.file('/media/atl/crowd/shared/crowd.version')
assert verfile.exists
upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/crowd/versions/latest")
upstream_json = json.load(upstream_fd)
upstream = upstream_json['version']
assert verfile.content.decode("UTF-8").strip() == upstream.strip()
def test_latest_is_downloaded(host):
upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/crowd/versions/latest")
upstream_json = json.load(upstream_fd)
upstream = upstream_json['version']
installer = host.file('/media/atl/crowd/shared/downloads/crowd.'+upstream+'-x64.bin')
assert installer.exists
assert installer.user == 'root'
def test_completed_lockfile(host):
upstream_fd = urllib.request.urlopen("https://marketplace.atlassian.com/rest/2/applications/crowd/versions/latest")
upstream_json = json.load(upstream_fd)
upstream = upstream_json['version']
lockfile = host.file('/media/atl/crowd/shared/downloads/crowd.'+upstream+'-x64.bin_completed')
assert lockfile.exists
assert lockfile.user == 'root'