diff --git a/roles/bitbucket_config/molecule/default/Dockerfile.j2 b/roles/bitbucket_config/molecule/default/Dockerfile.j2 new file mode 100644 index 0000000..e6aa95d --- /dev/null +++ b/roles/bitbucket_config/molecule/default/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/bitbucket_config/molecule/default/molecule.yml b/roles/bitbucket_config/molecule/default/molecule.yml new file mode 100644 index 0000000..7f082f6 --- /dev/null +++ b/roles/bitbucket_config/molecule/default/molecule.yml @@ -0,0 +1,36 @@ +--- +dependency: + name: galaxy +driver: + name: docker +lint: + name: yamllint +platforms: + - name: amazon_linux2 + image: amazonlinux:2 + groups: + - aws_node_local + ulimits: + - nofile:262144:262144 + - name: ubuntu_lts + image: ubuntu:bionic + groups: + - aws_node_local + ulimits: + - nofile:262144:262144 +provisioner: + name: ansible + options: + skip-tags: runtime_pkg + lint: + name: ansible-lint + options: + x: ["701"] + inventory: + links: + group_vars: ../../../../group_vars/ +verifier: + name: testinfra + lint: + name: flake8 + enabled: false diff --git a/roles/bitbucket_config/molecule/default/playbook.yml b/roles/bitbucket_config/molecule/default/playbook.yml new file mode 100644 index 0000000..f9c424b --- /dev/null +++ b/roles/bitbucket_config/molecule/default/playbook.yml @@ -0,0 +1,19 @@ +--- +- name: Converge + hosts: all + vars: + atl_product_family: "stash" + atl_product_edition: "bitbucket" + atl_product_user: "bitbucket" + atl_product_version: "6.3.1" + + atl_product_home: "{{ atl_shared_mountpoint }}/{{ atl_product_edition }}" + + atl_jdbc_user: 'bb_db_user' + atl_jdbc_password: 'molecule_password' + + roles: + - role: linux_common + - role: product_common + - role: product_install + - role: bitbucket_config diff --git a/roles/bitbucket_config/molecule/default/tests/test_default.py b/roles/bitbucket_config/molecule/default/tests/test_default.py new file mode 100644 index 0000000..00593ec --- /dev/null +++ b/roles/bitbucket_config/molecule/default/tests/test_default.py @@ -0,0 +1,16 @@ +import os + +import testinfra.utils.ansible_runner + +testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( + os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') + + +def test_config_file(host): + f = host.file('/media/atl/bitbucket/shared/bitbucket.properties') + assert f.exists + assert f.user == 'bitbucket' + + assert f.contains("jdbc.driver=org.postgresql.Driver") + assert f.contains("jdbc.user=bb_db_user") + assert f.contains("jdbc.password=molecule_password")