Skip to content

Commit

Permalink
Add molecule tests for prebuilt client
Browse files Browse the repository at this point in the history
  • Loading branch information
dometto committed Apr 8, 2024
1 parent 94dcf40 commit adffb73
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 34 deletions.
35 changes: 35 additions & 0 deletions molecule/_common/_inc_pre_tasks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---

- name: Install dependencies (yum)
yum:
# For completeness this should include git, but on EL7 we install a newer git from SCL in the Dockerfile to deal
# with automatic line ending conversion in the default git 1.8 breaking idempotence
#name: [sudo, git, make, bzip2]
name: [sudo, make, bzip2]
when: ansible_os_family == "RedHat" and ansible_distribution_major_version is version("8", "<")
- name: Install dependencies (dnf)
dnf:
name: [sudo, git, make, bzip2]
when: ansible_os_family == "RedHat" and ansible_distribution_major_version is version("8", ">=")
- name: Install dependencies (apt)
apt:
name: [sudo, git, make, python3-venv, python3-setuptools]
when: ansible_os_family == "Debian"

# This is to cheat at idempotence, which will fail if a commit is merged between converge and idempotence.
- name: Check whether server dir exists
stat:
path: "{{ galaxy_root }}/server"
register: __molecule_dir_check
- name: Collect current commit id
git:
clone: false
dest: "{{ galaxy_root }}/server"
repo: https://github.com/galaxyproject/galaxy.git
changed_when: false
become: "{{ __molecule_dir_check.stat.exists }}"
become_user: "{{ galaxy_privsep_user }}"
register: __molecule_git_check
- name: Set galaxy_commit_id
set_fact:
galaxy_commit_id: "{{ __molecule_git_check.before or ((__galaxy_version == 'dev') | ternary('dev', 'release_' ~ __galaxy_version)) }}"
35 changes: 1 addition & 34 deletions molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,6 @@
conda_auto_init: false
pip_virtualenv_command: /usr/bin/python3 -m venv
pre_tasks:

- name: Install dependencies (yum)
yum:
# For completeness this should include git, but on EL7 we install a newer git from SCL in the Dockerfile to deal
# with automatic line ending conversion in the default git 1.8 breaking idempotence
#name: [sudo, git, make, bzip2]
name: [sudo, make, bzip2]
when: ansible_os_family == "RedHat" and ansible_distribution_major_version is version("8", "<")
- name: Install dependencies (dnf)
dnf:
name: [sudo, git, make, bzip2]
when: ansible_os_family == "RedHat" and ansible_distribution_major_version is version("8", ">=")
- name: Install dependencies (apt)
apt:
name: [sudo, git, make, python3-venv, python3-setuptools]
when: ansible_os_family == "Debian"

# This is to cheat at idempotence, which will fail if a commit is merged between converge and idempotence.
- name: Check whether server dir exists
stat:
path: "{{ galaxy_root }}/server"
register: __molecule_dir_check
- name: Collect current commit id
git:
clone: false
dest: "{{ galaxy_root }}/server"
repo: https://github.com/galaxyproject/galaxy.git
changed_when: false
become: "{{ __molecule_dir_check.stat.exists }}"
become_user: "{{ galaxy_privsep_user }}"
register: __molecule_git_check
- name: Set galaxy_commit_id
set_fact:
galaxy_commit_id: "{{ __molecule_git_check.before or ((__galaxy_version == 'dev') | ternary('dev', 'release_' ~ __galaxy_version)) }}"
- include_tasks: "../_common/_inc_pre_tasks.yml"
roles:
- role: galaxyproject.galaxy
31 changes: 31 additions & 0 deletions molecule/prebuilt_client/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
- name: Converge
hosts: all
vars:
galaxy_client_use_prebuilt: true # This scenario tests with the prebuilt client
__galaxy_version: "{{ lookup('env', 'GALAXY_VERSION') }}"
galaxy_create_user: yes
galaxy_manage_paths: yes
galaxy_manage_clone: yes
galaxy_manage_download: no
galaxy_manage_existing: no
galaxy_manage_systemd: yes
# role default is < 22.05
galaxy_manage_gravity: "{{ false if __galaxy_major_version is version('22.01', '<') else true }}"
galaxy_systemd_mode: "{{ 'mule' if __galaxy_major_version is version('22.01', '<') else 'gravity' }}"
galaxy_config_style: yaml
galaxy_layout: root-dir
galaxy_root: /srv/galaxy
galaxy_separate_privileges: yes
galaxy_user: galaxy
galaxy_group: galaxy
galaxy_privsep_user: gxpriv
galaxy_config:
galaxy:
database_connection: sqlite:///{{ galaxy_mutable_data_dir }}/universe.sqlite
conda_auto_init: false
pip_virtualenv_command: /usr/bin/python3 -m venv
pre_tasks:
- include_tasks: "../_common/_inc_pre_tasks.yml"
roles:
- role: galaxyproject.galaxy
26 changes: 26 additions & 0 deletions molecule/prebuilt_client/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
dependency:
name: galaxy
options:
force: false # don't fetch every time
role-file: molecule/_common/requirements.yml
requirements-file: molecule/_common/requirements.yml
driver:
name: docker
platforms:
- name: galaxy-scenario-prebuilt_client
image: ${FROM_IMAGE:-centos:7}
platform: linux/amd64
# override default sleep loop, use Dockerfile CMD
command: ""
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
privileged: true
dockerfile: ../_common/Dockerfile.j2
pre_build_image: false
provisioner:
name: ansible
env:
GALAXY_VERSION: ${GALAXY_VERSION:-dev}
verifier:
name: ansible
16 changes: 16 additions & 0 deletions molecule/prebuilt_client/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---

- name: Verify
hosts: all
vars:
__galaxy_version: "{{ lookup('env', 'GALAXY_VERSION') }}"
tasks:
- name: Check version
uri:
url: http://localhost:8080/api/version
register: response
failed_when: response.status != 200 or (__galaxy_version != 'dev' and response.json.version_major != lookup('env', 'GALAXY_VERSION'))
# this is just to wait until the server is up, we can stop retrying on any response
until: response.status > 0
retries: 60
delay: 1

0 comments on commit adffb73

Please sign in to comment.