mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 08:53:07 -06:00
DCD-224: Refactor to simplify directory layout and testing.
This commit is contained in:
@@ -15,9 +15,11 @@ atl_home_base: "/var/atlassian/application-data"
|
|||||||
atl_product_home: "{{ atl_home_base }}/{{ atl_product_family }}"
|
atl_product_home: "{{ atl_home_base }}/{{ atl_product_family }}"
|
||||||
atl_product_home_shared: "{{ atl_shared_mountpoint }}/{{ atl_product_family }}/shared"
|
atl_product_home_shared: "{{ atl_shared_mountpoint }}/{{ atl_product_family }}/shared"
|
||||||
|
|
||||||
atl_product_installation_base: "/opt/atlassian"
|
atl_installation_base: "/opt/atlassian"
|
||||||
atl_product_installation_dir: "{{ atl_product_installation_base }}/{{ atl_product_edition }}"
|
atl_product_installation_base: "{{ atl_installation_base }}/{{ atl_product_edition }}"
|
||||||
atl_installer_temp: "{{ atl_product_installation_base }}/tmp"
|
atl_product_installation_target: "{{ atl_installation_base }}/{{ atl_product_edition }}/current"
|
||||||
|
atl_installer_temp: "{{ atl_installation_base }}/tmp"
|
||||||
|
|
||||||
|
|
||||||
# The following are imports from the environment. These are generally
|
# The following are imports from the environment. These are generally
|
||||||
# set in /etc/atl by the CloudFormation template and sourced before
|
# set in /etc/atl by the CloudFormation template and sourced before
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ provisioner:
|
|||||||
group_vars: ../../../../group_vars/
|
group_vars: ../../../../group_vars/
|
||||||
verifier:
|
verifier:
|
||||||
name: testinfra
|
name: testinfra
|
||||||
|
additional_files_or_dirs:
|
||||||
|
- ../../resources/tests/test_*.py
|
||||||
lint:
|
lint:
|
||||||
name: flake8
|
name: flake8
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|||||||
@@ -7,11 +7,6 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|||||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||||
|
|
||||||
|
|
||||||
def test_version_downloaded(host):
|
|
||||||
verfile = host.file('/media/atl/jira/shared/jira-software.version')
|
|
||||||
assert verfile.exists
|
|
||||||
|
|
||||||
|
|
||||||
def test_version_file_is_latest(host):
|
def test_version_file_is_latest(host):
|
||||||
verfile = host.file('/media/atl/jira/shared/jira-software.version')
|
verfile = host.file('/media/atl/jira/shared/jira-software.version')
|
||||||
assert verfile.exists
|
assert verfile.exists
|
||||||
@@ -28,4 +23,3 @@ def test_latest_is_downloaded(host):
|
|||||||
installer = host.file('/opt/atlassian/tmp/jira-software.'+upstream+'.tar.gz')
|
installer = host.file('/opt/atlassian/tmp/jira-software.'+upstream+'.tar.gz')
|
||||||
assert installer.exists
|
assert installer.exists
|
||||||
assert installer.user == 'root'
|
assert installer.user == 'root'
|
||||||
assert installer.mode == 0o0755
|
|
||||||
|
|||||||
17
roles/jira_download/molecule/resources/tests/test_common.py
Normal file
17
roles/jira_download/molecule/resources/tests/test_common.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import os
|
||||||
|
import urllib.request
|
||||||
|
|
||||||
|
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/jira/shared/jira-software.version')
|
||||||
|
assert verfile.exists
|
||||||
|
|
||||||
|
def test_symlink_created(host):
|
||||||
|
target = host.file('/opt/atlassian/jira-software/current')
|
||||||
|
assert target.exists
|
||||||
|
assert target.is_symlink
|
||||||
@@ -19,6 +19,8 @@ provisioner:
|
|||||||
group_vars: ../../../../group_vars/
|
group_vars: ../../../../group_vars/
|
||||||
verifier:
|
verifier:
|
||||||
name: testinfra
|
name: testinfra
|
||||||
|
additional_files_or_dirs:
|
||||||
|
- ../../resources/tests/test_*.py
|
||||||
lint:
|
lint:
|
||||||
name: flake8
|
name: flake8
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|||||||
@@ -7,24 +7,19 @@ testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|||||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||||
|
|
||||||
|
|
||||||
def test_version_downloaded(host):
|
def test_version_is_correct(host):
|
||||||
verfile = host.file('/media/atl/jira/shared/jira-software.version')
|
|
||||||
assert verfile.exists
|
|
||||||
|
|
||||||
|
|
||||||
def test_version_is_latest(host):
|
|
||||||
verfile = host.file('/media/atl/jira/shared/jira-software.version')
|
verfile = host.file('/media/atl/jira/shared/jira-software.version')
|
||||||
assert verfile.exists
|
assert verfile.exists
|
||||||
|
|
||||||
assert verfile.content.decode("UTF-8").strip() == "7.13.2"
|
assert verfile.content.decode("UTF-8").strip() == "7.13.2"
|
||||||
|
|
||||||
def test_latest_is_downloaded(host):
|
def test_is_downloaded(host):
|
||||||
installer = host.file('/opt/atlassian/tmp/jira-software.7.13.2.tar.gz')
|
installer = host.file('/opt/atlassian/tmp/jira-software.7.13.2.tar.gz')
|
||||||
assert installer.exists
|
assert installer.exists
|
||||||
assert installer.user == 'root'
|
assert installer.user == 'root'
|
||||||
|
|
||||||
def test_latest_is_unpacked(host):
|
def test_is_unpacked(host):
|
||||||
installer = host.file('/opt/atlassian/jira-software/atlassian-jira-software-7.13.2-standalone')
|
installer = host.file('/opt/atlassian/jira-software/7.13.2')
|
||||||
assert installer.exists
|
assert installer.exists
|
||||||
assert installer.is_directory
|
assert installer.is_directory
|
||||||
assert installer.user == 'jira'
|
assert installer.user == 'jira'
|
||||||
|
|||||||
@@ -30,11 +30,27 @@
|
|||||||
mode: 0644
|
mode: 0644
|
||||||
force: false
|
force: false
|
||||||
|
|
||||||
|
- name: Create target version directory
|
||||||
|
file:
|
||||||
|
path: "{{ atl_product_installation_base }}/{{ atl_product_version_file.stdout }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ atl_product_user }}"
|
||||||
|
|
||||||
- name: Unpack the product packages
|
- name: Unpack the product packages
|
||||||
unarchive:
|
unarchive:
|
||||||
remote_src: true
|
remote_src: true
|
||||||
src: "{{ atl_product_download }}"
|
src: "{{ atl_product_download }}"
|
||||||
dest: "{{ atl_product_installation_dir }}"
|
dest: "{{ atl_product_installation_base }}/{{ atl_product_version_file.stdout }}"
|
||||||
owner: "{{ atl_product_user }}"
|
owner: "{{ atl_product_user }}"
|
||||||
group: "{{ atl_product_user }}"
|
group: "{{ atl_product_user }}"
|
||||||
mode: 0755
|
mode: 0755
|
||||||
|
# Strip off the lead product/version specific directory to normaise naming
|
||||||
|
extra_opts:
|
||||||
|
- "--strip-components=1"
|
||||||
|
|
||||||
|
- name: Symlink the installed version to current
|
||||||
|
file:
|
||||||
|
src: "{{ atl_product_installation_base }}/{{ atl_product_version_file.stdout }}"
|
||||||
|
dest: "{{ atl_product_installation_target }}"
|
||||||
|
state: link
|
||||||
|
force: true
|
||||||
|
|||||||
@@ -18,4 +18,4 @@
|
|||||||
- "{{ atl_product_home }}"
|
- "{{ atl_product_home }}"
|
||||||
- "{{ atl_installer_temp }}"
|
- "{{ atl_installer_temp }}"
|
||||||
- "{{ atl_product_home_shared }}"
|
- "{{ atl_product_home_shared }}"
|
||||||
- "{{ atl_product_installation_dir }}"
|
- "{{ atl_product_installation_base }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user