From c1e1936419c41e6324304127833664f3237f47e9 Mon Sep 17 00:00:00 2001
From: pwalczysko
Date: Wed, 13 Nov 2024 17:24:04 +0000
Subject: [PATCH] Remove most of the tests, remove lint
---
molecule/bootstrap/molecule.yml | 28 --------
molecule/docker-prod/Dockerfile.j2 | 22 ------
molecule/docker-prod/converge.yml | 19 -----
molecule/docker-prod/molecule.yml | 56 ---------------
molecule/docker-prod/prepare.yml | 22 ------
molecule/docker-prod/tests/test_default.py | 39 ----------
molecule/nightshade-webclients/molecule.yml | 58 ---------------
.../tests/test_default.py | 40 -----------
molecule/ome-demoserver/molecule.yml | 1 -
molecule/ome-dundeeomero/Dockerfile.j2 | 22 ------
molecule/ome-dundeeomero/molecule.yml | 59 ---------------
.../ome-dundeeomero/tests/test_default.py | 46 ------------
molecule/ome-pg-prod/molecule_disabled.yml | 28 --------
molecule/ome-pg-prod/prepare.yml | 9 ---
molecule/ome-pg-prod/tests/test_default.py | 16 -----
molecule/release/molecule.yml | 37 ----------
molecule/release/prepare.yml | 72 -------------------
molecule/release/tests/test_default.py | 49 -------------
18 files changed, 623 deletions(-)
delete mode 100644 molecule/bootstrap/molecule.yml
delete mode 100644 molecule/docker-prod/Dockerfile.j2
delete mode 100644 molecule/docker-prod/converge.yml
delete mode 100644 molecule/docker-prod/molecule.yml
delete mode 100644 molecule/docker-prod/prepare.yml
delete mode 100644 molecule/docker-prod/tests/test_default.py
delete mode 100644 molecule/nightshade-webclients/molecule.yml
delete mode 100644 molecule/nightshade-webclients/tests/test_default.py
delete mode 100644 molecule/ome-dundeeomero/Dockerfile.j2
delete mode 100644 molecule/ome-dundeeomero/molecule.yml
delete mode 100644 molecule/ome-dundeeomero/tests/test_default.py
delete mode 100644 molecule/ome-pg-prod/molecule_disabled.yml
delete mode 100644 molecule/ome-pg-prod/prepare.yml
delete mode 100644 molecule/ome-pg-prod/tests/test_default.py
delete mode 100644 molecule/release/molecule.yml
delete mode 100644 molecule/release/prepare.yml
delete mode 100644 molecule/release/tests/test_default.py
diff --git a/molecule/bootstrap/molecule.yml b/molecule/bootstrap/molecule.yml
deleted file mode 100644
index 359f74fe..00000000
--- a/molecule/bootstrap/molecule.yml
+++ /dev/null
@@ -1,28 +0,0 @@
----
-dependency:
- name: galaxy
- options:
- role-file: requirements.yml
-driver:
- name: docker
-lint: |
- yamllint .
- ansible-lint
- flake8
-platforms:
- - name: omedev
- image: centos:7
-provisioner:
- name: ansible
- playbooks:
- converge: ../../bootstrap/playbook.yml
- lint:
- name: ansible-lint
-scenario:
- name: bootstrap
- test_sequence:
- - lint
- - dependency
- - syntax
-verifier:
- name: testinfra
diff --git a/molecule/docker-prod/Dockerfile.j2 b/molecule/docker-prod/Dockerfile.j2
deleted file mode 100644
index 7e2d467d..00000000
--- a/molecule/docker-prod/Dockerfile.j2
+++ /dev/null
@@ -1,22 +0,0 @@
-# Molecule managed
-
-{% if item.registry is defined %}
-FROM {{ item.registry.url }}/{{ item.image }}
-{% else %}
-FROM {{ item.image }}
-{% endif %}
-
-{% if item.env is defined %}
-{% for var, value in item.env.items() %}
-{% if value %}
-ENV {{ var }} {{ value }}
-{% endif %}
-{% endfor %}
-{% endif %}
-
-RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo python-jmespath bash ca-certificates iproute2 && apt-get clean; \
- elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \
- elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo python36-jmespath python38-jmespath yum-plugin-ovl bash iproute ca-certificates && 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 iproute2 && 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 iproute2 && xbps-remove -O; fi
diff --git a/molecule/docker-prod/converge.yml b/molecule/docker-prod/converge.yml
deleted file mode 100644
index 775d3456..00000000
--- a/molecule/docker-prod/converge.yml
+++ /dev/null
@@ -1,19 +0,0 @@
----
-- name: Converge
- hosts: ome-dockr-prod1.openmicroscopy.org
- tasks:
- - name: Workaround to get host IP inside docker
- shell: hostname -I | cut -d' ' -f1
- register: hostname_ip
- check_mode: false
- changed_when: false
- tags:
- # Ignore [306] Shells that use pipes should set the pipefail option
- - skip_ansible_lint
-
- - name: Set address of postgres for redmine
- set_fact:
- redmine_tracker_db_host: "{{ hostname_ip.stdout }}"
-
-- name: Import-playbook
- import_playbook: ../../omedev/docker-prod-apps.yml
diff --git a/molecule/docker-prod/molecule.yml b/molecule/docker-prod/molecule.yml
deleted file mode 100644
index f43e3aa3..00000000
--- a/molecule/docker-prod/molecule.yml
+++ /dev/null
@@ -1,56 +0,0 @@
----
-dependency:
- name: galaxy
- options:
- role-file: requirements.yml
-driver:
- name: docker
-lint: |
- yamllint .
- ansible-lint
- flake8
-platforms:
- - name: ome-dockr-prod1.openmicroscopy.org
- image: centos/systemd:latest
- command: /sbin/init
- privileged: true
- groups:
- - docker-hosts
- - omedev-docker
- published_ports:
- - "0.0.0.0:9090:9090/tcp"
-provisioner:
- name: ansible
- playbooks:
- prepare: prepare.yml
- converge: converge.yml
- inventory:
- host_vars:
- ome-dockr-prod1.openmicroscopy.org:
- ome_monitored_node_exporter_hosts:
- - node.example.org
- ome_monitored_postgres_hosts:
- - pg.example.org
- ome_monitored_omero_server_hosts:
- - omeroserver.example.org
- ome_monitored_omero_web_hosts:
- - omeroweb.example.org
- prometheus_docker_data_volume: /srv/prometheus
- nfs_minio_data_volume: /srv/minio
- redmine_tracker_docker_data_volume: /srv/redmine-files
-
- group_vars:
- # all:
- # molecule_test: true
- docker-hosts:
- # This should allow docker-in-docker to work
- docker_storage_driver: vfs
- # Latest version 17.12.1.ce-1.el7.centos has a bug that prevents
- # testing on travis: https://github.com/docker/for-linux/issues/219
- docker_version: 17.09.1.ce-1.el7.centos
- lint:
- name: ansible-lint
-scenario:
- name: docker-prod
-verifier:
- name: testinfra
diff --git a/molecule/docker-prod/prepare.yml b/molecule/docker-prod/prepare.yml
deleted file mode 100644
index 7bb8ba41..00000000
--- a/molecule/docker-prod/prepare.yml
+++ /dev/null
@@ -1,22 +0,0 @@
----
-- name: Prepare
- hosts: ome-dockr-prod1.openmicroscopy.org
- roles:
- - role: ome.postgresql
- postgresql_version: "13"
- postgresql_server_auth:
- - database: redmine
- user: redmine
- address: 0.0.0.0/0
- postgresql_databases:
- - name: redmine
- owner: redmine
- postgresql_users:
- - user: redmine
- password: redmine
- databases:
- - redmine
- postgresql_server_listen: "'*'"
-
-- name: Import playbook
- import_playbook: ../../omedev/playbook.yml
diff --git a/molecule/docker-prod/tests/test_default.py b/molecule/docker-prod/tests/test_default.py
deleted file mode 100644
index ced9ed28..00000000
--- a/molecule/docker-prod/tests/test_default.py
+++ /dev/null
@@ -1,39 +0,0 @@
-import json
-import os
-import testinfra.utils.ansible_runner
-
-testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
- os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
-
-
-def test_prometheus_targets(host):
- out = host.check_output(
- 'curl -k -f --user admin:monitoring '
- 'https://localhost/prometheus/api/v1/targets')
- d = json.loads(out)
- assert d['status'] == 'success'
- assert d['data']['droppedTargets'] == []
- unique_instances = set(
- t['labels']['instance'] for t in d['data']['activeTargets'])
- assert len({
- 'node.example.org:443',
- 'pg.example.org:443',
- 'omeroserver.example.org:443',
- 'omeroweb.example.org:443',
- 'idr.openmicroscopy.org:443',
- 'idr1.openmicroscopy.org:443',
- 'idr2.openmicroscopy.org:443',
- 'localhost:9090',
- }.difference(unique_instances)) == 0
-
-
-def test_minio_connect(host):
- out = host.check_output('curl -s http://localhost:9000 -I')
- assert 'Server: MinIO/' in out
-
-
-def test_redmine_connect(host):
- out = host.check_output(
- 'curl -k -f -L -H "Host: idr-redmine-docker.openmicroscopy.org" '
- 'https://localhost/')
- assert 'Redmine' in out
diff --git a/molecule/nightshade-webclients/molecule.yml b/molecule/nightshade-webclients/molecule.yml
deleted file mode 100644
index 71cd0c18..00000000
--- a/molecule/nightshade-webclients/molecule.yml
+++ /dev/null
@@ -1,58 +0,0 @@
----
-dependency:
- name: galaxy
- options:
- role-file: requirements.yml
-driver:
- name: docker
-lint: |
- yamllint .
- ansible-lint
- flake8
-platforms:
- - name: ns-webclients
- image: centos/systemd
- command: /sbin/init
- privileged: true
- groups:
- - docker-hosts
- - omero-web
- - monitored
-provisioner:
- name: ansible
- options:
- diff: true
- inventory:
- group_vars:
- all:
- molecule_test: true
- docker-hosts:
- # firewalld isn't installed, don't attempt to disable
- iptables_raw_disable_firewalld: false
- playbooks:
- converge: ../../site.yml
- lint:
- name: ansible-lint
-scenario:
- name: nightshade-webclients
- converge_sequence:
- - converge
- test_sequence:
- - destroy
- # dependency must come first so that ansible-lint will see a custom module
- # This might be fixed by https://github.com/ansible/molecule/pull/1739
- - dependency
- - lint
- - syntax
- - create
- - prepare
- - converge
- # FIXME: Some tasks are not idempotent
- # - idempotence
- ################################################################################
- # FIXME: Tests hang on Travis but pass locally
- # - verify
- ################################################################################
- - destroy
-verifier:
- name: testinfra
diff --git a/molecule/nightshade-webclients/tests/test_default.py b/molecule/nightshade-webclients/tests/test_default.py
deleted file mode 100644
index a88b0cc6..00000000
--- a/molecule/nightshade-webclients/tests/test_default.py
+++ /dev/null
@@ -1,40 +0,0 @@
-import os
-import pytest
-import testinfra.utils.ansible_runner
-
-testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
- os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
-
-OMERO = '/opt/omero/server/OMERO.server/bin/omero'
-OMERO_LOGIN = '-C -s localhost -u root -w omero'
-
-
-@pytest.mark.parametrize("name", [
- 'nginx',
- 'omero-web',
- 'prometheus-node-exporter',
-])
-def test_service_running_and_enabled(host, name):
- service = host.service(name)
- assert service.is_running
- assert service.is_enabled
-
-
-def test_omero_metrics(host):
- out = host.check_output(
- 'curl -f -u monitoring:monitoring -k '
- 'https://localhost/django_prometheus/metrics')
- assert "django_http_responses_body_total_bytes_count" in out
-
-
-def test_omero_metrics_auth_fail(host):
- out = host.run(
- 'curl -f -u monitoring:incorrect -k '
- 'https://localhost/django_prometheus/metrics')
- assert out.rc == 22
- assert '401' in out.stderr
-
-
-def test_omero_nginx_ssl(host):
- out = host.check_output('curl -fkI https://localhost/')
- assert 'Location: /webclient/' in out
diff --git a/molecule/ome-demoserver/molecule.yml b/molecule/ome-demoserver/molecule.yml
index 60086e99..2902a5e0 100644
--- a/molecule/ome-demoserver/molecule.yml
+++ b/molecule/ome-demoserver/molecule.yml
@@ -28,7 +28,6 @@ scenario:
# dependency must come first so that ansible-lint will see a custom module
# This might be fixed by https://github.com/ansible/molecule/pull/1739
- dependency
- - lint
- syntax
verifier:
name: testinfra
diff --git a/molecule/ome-dundeeomero/Dockerfile.j2 b/molecule/ome-dundeeomero/Dockerfile.j2
deleted file mode 100644
index 00b7fd61..00000000
--- a/molecule/ome-dundeeomero/Dockerfile.j2
+++ /dev/null
@@ -1,22 +0,0 @@
-# Molecule managed
-
-{% if item.registry is defined %}
-FROM {{ item.registry.url }}/{{ item.image }}
-{% else %}
-FROM {{ item.image }}
-{% endif %}
-
-{% if item.env is defined %}
-{% for var, value in item.env.items() %}
-{% if value %}
-ENV {{ var }} {{ value }}
-{% endif %}
-{% endfor %}
-{% endif %}
-
-RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates iproute2 && apt-get clean; \
- elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python*-dnf bash iproute && dnf clean all; \
- elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash iproute ca-certificates && 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 iproute2 && 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 iproute2 && xbps-remove -O; fi
diff --git a/molecule/ome-dundeeomero/molecule.yml b/molecule/ome-dundeeomero/molecule.yml
deleted file mode 100644
index 8260f968..00000000
--- a/molecule/ome-dundeeomero/molecule.yml
+++ /dev/null
@@ -1,59 +0,0 @@
----
-dependency:
- name: galaxy
- options:
- role-file: requirements.yml
-driver:
- name: docker
-lint: |
- yamllint .
- ansible-lint
- flake8
-platforms:
- - name: ome-dundeeomero.openmicroscopy.org
- image: centos/systemd
- command: /sbin/init
- privileged: true
- groups:
- - docker-hosts
- - omero-server
- - monitored
-provisioner:
- name: ansible
- options:
- diff: true
- # skip-tags:
- # - "skip_molecule"
- inventory:
- group_vars:
- all:
- molecule_test: true
- docker-hosts:
- # firewalld isn't installed, don't attempt to disable
- iptables_raw_disable_firewalld: false
- playbooks:
- converge: ../../site.yml
- lint:
- name: ansible-lint
- # env:
- # ANSIBLE_ROLES_PATH: ../../vendor
-scenario:
- name: ome-dundeeomero
- converge_sequence:
- - converge
- test_sequence:
- - destroy
- # dependency must come first so that ansible-lint will see a custom module
- # This might be fixed by https://github.com/ansible/molecule/pull/1739
- - dependency
- - lint
- - syntax
- - create
- - prepare
- - converge
- # FIXME: Some tasks are not idempotent
- # - idempotence
- - verify
- - destroy
-verifier:
- name: testinfra
diff --git a/molecule/ome-dundeeomero/tests/test_default.py b/molecule/ome-dundeeomero/tests/test_default.py
deleted file mode 100644
index dc1ac485..00000000
--- a/molecule/ome-dundeeomero/tests/test_default.py
+++ /dev/null
@@ -1,46 +0,0 @@
-import os
-import pytest
-import testinfra.utils.ansible_runner
-
-testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
- os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
-
-OMERO = '/opt/omero/server/OMERO.server/bin/omero'
-OMERO_LOGIN = '-C -s localhost -u root -w omero'
-
-
-@pytest.mark.parametrize("name", [
- 'nginx',
- 'omero-server',
- 'postgresql-11',
- 'prometheus-node-exporter',
- 'prometheus-omero-exporter',
- 'prometheus-postgres-exporter',
-])
-def test_service_running_and_enabled(host, name):
- service = host.service(name)
- assert service.is_running
- assert service.is_enabled
-
-
-def test_omero_login(host):
- with host.sudo('omero-server'):
- host.check_output(
- '/opt/omero/server/OMERO.server/bin/omero '
- 'login -C -s localhost -u root -w omero')
-
-
-@pytest.mark.parametrize("curl", [
- 'localhost:9449/metrics',
- '-u monitoring:monitoring -k https://localhost/metrics/9449',
-])
-def test_omero_metrics(host, curl):
- out = host.check_output('curl -f %s' % curl)
- assert 'omero_sessions_active' in out
-
-
-def test_omero_metrics_auth_fail(host):
- out = host.run(
- 'curl -f -u monitoring:incorrect -k https://localhost/metrics/9449')
- assert out.rc == 22
- assert '401' in out.stderr
diff --git a/molecule/ome-pg-prod/molecule_disabled.yml b/molecule/ome-pg-prod/molecule_disabled.yml
deleted file mode 100644
index b2feddfb..00000000
--- a/molecule/ome-pg-prod/molecule_disabled.yml
+++ /dev/null
@@ -1,28 +0,0 @@
----
-dependency:
- name: galaxy
- options:
- role-file: requirements.yml
-driver:
- name: docker
-lint: |
- yamllint .
- ansible-lint
- flake8
-platforms:
- - name: ome-pg-prod1.openmicroscopy.org
- image: centos/systemd
- image_version: latest
- command: /sbin/init
- privileged: true
-provisioner:
- name: ansible
- playbooks:
- prepare: prepare.yml
- converge: ../../postgres/ome-pg-prod.yml
- lint:
- name: ansible-lint
-scenario:
- name: ome-pg-prod
-verifier:
- name: testinfra
diff --git a/molecule/ome-pg-prod/prepare.yml b/molecule/ome-pg-prod/prepare.yml
deleted file mode 100644
index 04a5e83f..00000000
--- a/molecule/ome-pg-prod/prepare.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-# Workaround lack of cron on Docker
-- name: Prepare pg prod
- hosts: ome-pg-prod1.openmicroscopy.org
- tasks:
- - name: Install cron
- become: true
- ansible.builtin.yum:
- name: cronie
- state: present
diff --git a/molecule/ome-pg-prod/tests/test_default.py b/molecule/ome-pg-prod/tests/test_default.py
deleted file mode 100644
index baa73f3b..00000000
--- a/molecule/ome-pg-prod/tests/test_default.py
+++ /dev/null
@@ -1,16 +0,0 @@
-import os
-import testinfra.utils.ansible_runner
-
-testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
- os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
-
-
-def test_service_running_and_enabled(host):
- assert host.service('postgresql-9.6').is_running
- assert host.service('postgresql-9.6').is_enabled
-
-
-def test_dbs(host):
- out = host.check_output(
- 'PGPASSWORD=idr-redmine psql -hlocalhost -Uidr-redmine -l -tA')
- assert 'idr-redmine|idr-redmine|UTF8|' in out
diff --git a/molecule/release/molecule.yml b/molecule/release/molecule.yml
deleted file mode 100644
index add768eb..00000000
--- a/molecule/release/molecule.yml
+++ /dev/null
@@ -1,37 +0,0 @@
----
-dependency:
- name: galaxy
-driver:
- name: docker
-lint: |
- yamllint .
- ansible-lint
- flake8
-platforms:
- - name: release
- image: centos:7
- groups:
- - idr0-slot3.openmicroscopy.org
- - name: prerelease
- image: centos:7
- groups:
- - idr0-slot3.openmicroscopy.org
-provisioner:
- name: ansible
- playbooks:
- converge: ../../release/release-acceptance.yml
- inventory:
- group_vars:
- idr0-slot3.openmicroscopy.org:
- product: component
- host_vars:
- prerelease:
- version: '3.2.0-rc1'
- release:
- version: 3.2.0
- lint:
- name: ansible-lint
-scenario:
- name: release
-verifier:
- name: testinfra
diff --git a/molecule/release/prepare.yml b/molecule/release/prepare.yml
deleted file mode 100644
index 7f4743fd..00000000
--- a/molecule/release/prepare.yml
+++ /dev/null
@@ -1,72 +0,0 @@
----
-- name: Prepare release
- hosts: all
- vars:
- www_folders:
- - /uod/idr/www/docs.openmicroscopy.org
- - /uod/idr/www/downloads.openmicroscopy.org
- releases:
- - 3.2.0
- - 3.2.0-rc1
- tasks:
- - name: Create existing released components
- ansible.builtin.file:
- path: "{{ item }}/component/3.1.8"
- state: directory
- owner: root
- group: root
- mode: 01555
- with_items: "{{ www_folders }}"
- - name: Create minor version directory
- ansible.builtin.file:
- path: "{{ item }}/component/3.1"
- state: directory
- with_items: "{{ www_folders }}"
- - name: Create minor version redirects
- ansible.builtin.copy:
- dest: "{{ item }}/component/3.1/.htaccess"
- content: "Redirect 301 /component/3.1 /component/3.1.8"
- with_items: "{{ www_folders }}"
- - name: Create major version directory
- ansible.builtin.file:
- path: "{{ item }}/component/3"
- state: directory
- with_items: "{{ www_folders }}"
- - name: Create major version redirects
- ansible.builtin.copy:
- dest: "{{ item }}/component/3/.htaccess"
- content: "Redirect 301 /component/3 /component/3.1.8"
- with_items: "{{ www_folders }}"
- - name: Create latest version directory
- ansible.builtin.file:
- path: "{{ item }}/component/latest"
- state: directory
- with_items: "{{ www_folders }}"
- - name: Create latest version redirects
- ansible.builtin.copy:
- dest: "{{ item }}/component/latest/.htaccess"
- content: "Redirect 301 /component/latest /component/3.1.8"
- with_items: "{{ www_folders }}"
- - name: Create new release components
- ansible.builtin.file:
- path: "{{ item[0] }}/component/{{ item[1] }}"
- state: directory
- mode: 01777
- with_nested:
- - "{{ www_folders }}"
- - "{{ releases }}"
- - name: Create .htaccess file
- ansible.builtin.file:
- path: "{{ item[0] }}/component/{{ item[1] }}/.htaccess"
- state: touch
- with_nested:
- - "{{ www_folders }}"
- - "{{ releases }}"
- - name: Create mock content
- ansible.builtin.file:
- path: "{{ item[0] }}/component/{{ item[1] }}/test"
- state: touch
- mode: 01777
- with_nested:
- - "{{ www_folders }}"
- - "{{ releases }}"
diff --git a/molecule/release/tests/test_default.py b/molecule/release/tests/test_default.py
deleted file mode 100644
index b1961472..00000000
--- a/molecule/release/tests/test_default.py
+++ /dev/null
@@ -1,49 +0,0 @@
-import os
-import pytest
-import testinfra.utils.ansible_runner
-
-testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
- os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
-
-DOWNLOADS_URL = "/uod/idr/www/downloads.openmicroscopy.org"
-DOCS_URL = "/uod/idr/www/docs.openmicroscopy.org"
-
-
-@pytest.mark.parametrize('base_folder', [DOWNLOADS_URL, DOCS_URL])
-def test_permissions(host, base_folder):
- v = host.ansible.get_variables()
- assert not host.file('%s/component/%s/.htaccess' % (
- base_folder, v['version'])).exists
-
- f = host.file('%s/component/%s' % (base_folder, v['version']))
- assert f.exists
- assert f.user == 'root'
- assert oct(f.mode) == '0o1555'
-
-
-@pytest.mark.parametrize('base_folder', [DOWNLOADS_URL, DOCS_URL])
-def test_redirects(host, base_folder):
- v = host.ansible.get_variables()
- hostname = host.backend.get_hostname()
- f = host.file('%s/component/3.2/.htaccess' % base_folder)
- if hostname == 'release':
- assert f.exists
- assert f.content_string == (
- 'Redirect 301 /component/3.2 /component/%s' % v['version'])
- elif hostname == 'prelease':
- assert not f.exists
- f = host.file('%s/component/3/.htaccess' % base_folder)
- assert f.exists
- if hostname == 'release':
- assert f.content_string == (
- 'Redirect 301 /component/3 /component/%s' % v['version'])
- elif hostname == 'prelease':
- assert f.content_string == 'Redirect 301 /component/3 /component/3.1.8'
- f = host.file('%s/component/latest/.htaccess' % base_folder)
- assert f.exists
- if hostname == 'release':
- assert f.content_string == (
- 'Redirect 301 /component/latest /component/%s' % v['version'])
- elif hostname == 'prelease':
- assert (f.content_string ==
- 'Redirect 301 /component/latest /component/3.1.8')