Skip to content

Commit

Permalink
Merge pull request #108 from bedroge/playbook_test_step
Browse files Browse the repository at this point in the history
Run the ReFrame tests at the end of the playbook
  • Loading branch information
boegel authored Jun 21, 2021
2 parents 8541357 + eb383e5 commit 7f4e54e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 5 deletions.
4 changes: 0 additions & 4 deletions .github/actions/install_compatibility_layer/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,3 @@ cat << EOF > hosts
EOF

ansible-playbook -v --connection=local --inventory=hosts -e ansible_python_interpreter=python3 -e gentoo_prefix_path=$1 ${GITHUB_WORKSPACE}/ansible/playbooks/install.yml

# A successful installation should at least have Lmod and archspec,
# so let's check if we can use them.
source $1/usr/share/Lmod/init/profile && module avail && $1/usr/bin/archspec cpu
8 changes: 8 additions & 0 deletions ansible/playbooks/roles/compatibility_layer/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@

- include_tasks: create_host_symlinks.yml

- include_tasks: test.yml
tags:
- test

- name: Publish transaction
command: "cvmfs_server publish {{ cvmfs_repository }}"
when: cvmfs_start_transaction and cvmfs_publish_transaction
Expand All @@ -39,3 +43,7 @@
- name: Abort transaction
command: "cvmfs_server abort {{ cvmfs_repository }}"
when: cvmfs_start_transaction and cvmfs_abort_transaction_on_failures

- name: Exit because of failure
fail:
msg: "Task {{ ansible_failed_task }} failed, with result {{ ansible_failed_result }}."
23 changes: 23 additions & 0 deletions ansible/playbooks/roles/compatibility_layer/tasks/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Run a ReFrame test suite to validate the correctness
# of the compatibility layer installation.
---

- name: Copy ReFrame test file
copy:
src: "{{ playbook_dir }}/../../test/compat_layer.py"
dest: /tmp/compat_layer.py
mode: 0644
tags:
- test

- name: Run ReFrame tests
command: reframe -r -v -c /tmp/compat_layer.py
environment:
EESSI_VERSION: "{{ eessi_version }}"
EESSI_OS: "{{ eessi_host_os }}"
EESSI_ARCH: "{{ eessi_host_arch }}"
register: reframe_cmd
changed_when: false
failed_when: reframe_cmd.rc != 0
tags:
- test
5 changes: 4 additions & 1 deletion test/compat_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class RunInGentooPrefixTestError(rfm.core.exceptions.ReframeError):
class RunInGentooPrefixTest(rfm.RunOnlyRegressionTest):
eessi_repo_dir = '/cvmfs/pilot.eessi-hpc.org'
eessi_version = parameter(
os.environ.get('EESSI_VERSION', os.readlink(os.path.join(eessi_repo_dir, 'latest'))).split(',')
os.environ.get('EESSI_VERSION', 'latest').split(',')
)
eessi_arch = parameter(
os.environ.get('EESSI_ARCH', platform.machine()).split(',')
Expand All @@ -23,6 +23,9 @@ class RunInGentooPrefixTest(rfm.RunOnlyRegressionTest):
def __init__(self):
self.valid_systems = ['*']
self.valid_prog_environs = ['*']
if self.eessi_version == 'latest':
# resolve the "latest" symlink to the actual version
self.eessi_version = os.readlink(os.path.join(eessi_repo_dir, 'latest'))
self.compat_dir = os.path.join(
self.eessi_repo_dir,
self.eessi_version,
Expand Down

0 comments on commit 7f4e54e

Please sign in to comment.