From 361a914446a949f6c45a5495caf8a6dae21f19ae Mon Sep 17 00:00:00 2001 From: Mykhailo Usatenko Date: Fri, 29 Jul 2022 09:58:49 +0300 Subject: [PATCH] CLIP-1619 Create testcase with custom version containing uppercase letters --- .../Dockerfile.j2 | 14 +++++++++++ .../converge.yml | 12 ++++++++++ .../molecule.yml | 23 +++++++++++++++++++ .../tests/test_default.py | 22 ++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 roles/product_install/molecule/confluence_version_with_uppercase/Dockerfile.j2 create mode 100644 roles/product_install/molecule/confluence_version_with_uppercase/converge.yml create mode 100644 roles/product_install/molecule/confluence_version_with_uppercase/molecule.yml create mode 100644 roles/product_install/molecule/confluence_version_with_uppercase/tests/test_default.py diff --git a/roles/product_install/molecule/confluence_version_with_uppercase/Dockerfile.j2 b/roles/product_install/molecule/confluence_version_with_uppercase/Dockerfile.j2 new file mode 100644 index 0000000..e6aa95d --- /dev/null +++ b/roles/product_install/molecule/confluence_version_with_uppercase/Dockerfile.j2 @@ -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 diff --git a/roles/product_install/molecule/confluence_version_with_uppercase/converge.yml b/roles/product_install/molecule/confluence_version_with_uppercase/converge.yml new file mode 100644 index 0000000..68ab242 --- /dev/null +++ b/roles/product_install/molecule/confluence_version_with_uppercase/converge.yml @@ -0,0 +1,12 @@ +--- +- name: Converge + hosts: all + vars: + atl_product_family: "confluence" + atl_product_edition: "confluence" + atl_product_user: "confluence" + atl_product_version: "7.20.0-CONFSERVER-63193-m01" + roles: + - role: linux_common + - role: product_common + - role: product_install diff --git a/roles/product_install/molecule/confluence_version_with_uppercase/molecule.yml b/roles/product_install/molecule/confluence_version_with_uppercase/molecule.yml new file mode 100644 index 0000000..3ea826a --- /dev/null +++ b/roles/product_install/molecule/confluence_version_with_uppercase/molecule.yml @@ -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 diff --git a/roles/product_install/molecule/confluence_version_with_uppercase/tests/test_default.py b/roles/product_install/molecule/confluence_version_with_uppercase/tests/test_default.py new file mode 100644 index 0000000..2baef93 --- /dev/null +++ b/roles/product_install/molecule/confluence_version_with_uppercase/tests/test_default.py @@ -0,0 +1,22 @@ +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/confluence/shared-home/confluence.version') + assert verfile.exists + assert verfile.content.decode("UTF-8").strip() == "7.20.0-CONFSERVER-63193-m01" + +def test_symlink_created(host): + target = host.file('/opt/atlassian/confluence/current') + assert target.exists + assert target.is_symlink + +def test_unpacked(host): + verfile = host.file('/opt/atlassian/confluence/current/bin/catalina.sh') + assert verfile.exists