ITSD-94667 Add molecule test for the case where an alternate url is provided for both the tarball and obr

This commit is contained in:
Glenn Stewart
2022-06-22 13:16:31 +10:00
parent eb51caec94
commit abf3aefd63
4 changed files with 123 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,38 @@
---
- name: Converge
hosts: all
vars:
atl_product_family: "jira"
atl_product_edition: "jira-software"
atl_product_user: "jira"
# Version 8.14.0 is chosen deliberately as it is a version where jira and jira-software returns different buildNumber from MPAC
# See DCD-1216 for context
atl_product_version: "8.14.0"
atl_install_jsd_as_obr: true
# This tests for an edge case where the product URL and OBR are source from a provided URL.
# Although marketplace (mpac) is used in this example, this could potentially be in a non mpac url.
# In this case it would not be possible to query atl_jsd_build_info to source the atl_jsd_build. One is therefore provided.
atl_source_obr_from_marketplace: false
atl_jsd_build: "8.14.0"
atl_product_download_url: "https://www.atlassian.com/software/jira/downloads/binary/atlassian-jira-software-8.14.0.tar.gz"
atl_obr_download_url: "https://marketplace.atlassian.com/download/apps/1213632/version/1040180000"
atl_systemd_service_name: "jira.service"
atl_jdbc_encoding: 'UNICODE'
atl_jdbc_collation: 'C'
atl_jdbc_ctype: 'C'
atl_jdbc_template: 'template0'
pre_tasks:
- name: Create cache dir
file:
path: '/media/atl/jira/shared/'
state: directory
- name: Seed version
copy:
dest: '/media/atl/jira/shared/jira-core.version'
content: "8.14.0"
force: false # For idempotency check
roles:
- role: linux_common
- role: product_common
- role: product_install

View File

@@ -0,0 +1,23 @@
---
dependency:
name: galaxy
driver:
name: docker
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
inventory:
links:
group_vars: ../../../../group_vars/
verifier:
name: testinfra

View File

@@ -0,0 +1,48 @@
import os
from six.moves import urllib
import testinfra.utils.ansible_runner
import json
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_version_is_correct(host):
verfile = host.file('/media/atl/jira/shared/jira-software.version')
assert verfile.exists
assert verfile.content.decode("UTF-8").strip() == "8.14.0"
def test_is_downloaded(host):
installer = host.file('/media/atl/downloads/jira-software.8.14.0-x64.bin')
assert installer.exists
assert installer.user == 'root'
def test_completed_lockfile(host):
lockfile = host.file('/media/atl/downloads/jira-software.8.14.0-x64.bin_completed')
assert lockfile.exists
assert lockfile.user == 'root'
def test_is_unpacked(host):
installer = host.file('/opt/atlassian/jira-software/8.14.0/atlassian-jira/')
assert installer.exists
assert installer.is_directory
assert installer.user == 'jira'
assert installer.mode == 0o0755
def test_obr_is_downloaded(host):
installer = host.file('/media/atl/downloads/jira-servicedesk-application-4.14.0.obr')
assert installer.exists
assert installer.user == 'root'
def test_obr_completed_lockfile(host):
lockfile = host.file('/media/atl/downloads/jira-servicedesk-application-4.14.0.obr_completed')
assert lockfile.exists
assert lockfile.user == 'root'
def test_obr_is_unpacked(host):
jsdjar = host.file('/media/atl/jira/shared/plugins/installed-plugins/jira-servicedesk-application-4.14.0.jar')
assert jsdjar.exists
assert jsdjar.user == 'jira'
assert jsdjar.mode == 0o0750