Repository navigation
166 lines (145 loc) · 6.62 KB
/
Copy pathwebdav-tests.yml
File metadata and controls
166 lines (145 loc) · 6.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
---
name: "Run WebDAV tests"
on:
push:
branches:
- development
- 'release-[0-9]+.[0-9]+'
paths:
- '.github/workflows/webdav-tests.yml'
- 'docker/images/davrods/**'
pull_request:
jobs:
build:
runs-on: ubuntu-24.04
if: |
${{ ! contains(github.event.head_commit.message, '#nowebdavtests') &&
( github.event_name == 'push' ||
github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
)
}}
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: 3.9
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
# For release branches, we use the WebDAV tests of that release.
# For other branches, we use the tests of the development branch.
- name: Determine Yoda ruleset repository branch
shell: bash
run: |
if [[ "${{ steps.extract_branch.outputs.branch }}" =~ ^"release-" ]]; then
echo "branch=${{ steps.extract_branch.outputs.branch }}" >> $GITHUB_OUTPUT
else
echo "branch=development" >> $GITHUB_OUTPUT
fi
id: yoda_repo_branch
- name: Clone Yoda repo for Docker Setup
run: |
git clone -b "${{ steps.extract_branch.outputs.branch }}" --single-branch https://github.com/UtrechtUniversity/yoda.git
- name: Clone Yoda ruleset repo for tests
run: |
git clone -b "${{ steps.yoda_repo_branch.outputs.branch }}" --single-branch https://github.com/UtrechtUniversity/yoda-ruleset.git
- name: Prepare hosts file for API tests
run: |
sudo echo "127.0.0.1 portal.yoda eus.yoda data.yoda public.yoda" | sudo tee -a /etc/hosts
- name: Install test dependencies
run: |
sudo apt install -y docker-compose
cd yoda-ruleset/tests
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
- name: Pull Docker images
run: |
cd yoda/docker/compose
docker-compose pull
- name: Build local Davrods image
shell: bash
run: |
cd yoda/docker/images/davrods
if [[ -f stage-uploads.sh ]]; then bash ./stage-uploads.sh ; fi
./build.sh
- name: Start Dockerized Yoda
run: |
cd yoda/docker/compose
../up.sh -d
- name: Wait until Dockerized setup is ready
shell: bash
run: |
echo "Waiting for portal to be available ..."
until curl -k --output /dev/null --silent --head --fail https://portal.yoda:8443; do printf '.' ; sleep 1; done
echo "Waiting for EUS to be available ..."
until curl -k --output /dev/null --silent --head --fail https://eus.yoda:8444; do printf '.' ; sleep 1; done
docker exec provider.yoda sh -c 'until sudo -u irods ils /tempZone > /dev/null 2>&1 ; do echo Waiting for iRODS to start ... ; sleep 1; done'
- name: Pull and install latest version of ruleset
shell: bash
run: |
cd yoda/docker/compose
docker exec provider.yoda sh -c 'set -x ; find /etc/irods/yoda-ruleset -print0 2>/dev/null | sudo xargs -0 -r -I{} bash -c "chown -v irods:irods \"{}\" || true"'
docker exec provider.yoda sh -c 'set -x ; cd /etc/irods/yoda-ruleset && sudo -u irods git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" && sudo -u irods git pull && sudo -u irods git status'
docker exec provider.yoda sh -c "set -x ; cd /etc/irods/yoda-ruleset && sudo -u irods git checkout ${{ steps.yoda_repo_branch.outputs.branch }} && sudo -u irods python3 -m pip --no-cache-dir install --user --break-system-packages -r /etc/irods/yoda-ruleset/requirements.txt && sudo -u irods make && sudo -u irods make install"
docker exec provider.yoda sh -c 'kill -HUP $(cat /var/run/irods/irods-server.pid)'
- name: Wait until iRODS and Davrods are ready for tests
shell: bash
run: |
cd yoda/docker/compose
until [ "$(curl -k --output /dev/null -w '%{http_code}' --silent https://data.yoda:8445)" != "000" ] ; do printf '.' ; sleep 1; done
# Wait a bit until the iRODS connection looks stable enough, and the restart is
# apparently finished.
docker exec data.yoda sh -c '
responses=0
responsesneeded=8
while [ "$responses" -lt "$responsesneeded" ]; do
if nc -z provider.yoda 1247 2>/dev/null;
then responses=$((responses+1));
echo "Response number ${responses}/${responsesneeded} from iRODS"
else responses=0;
echo "No response from iRODS."
fi
sleep 0.5
done'
# Wait for Davrods to be available too
echo "Waiting for Davrods to be available ..."
until [ "$(curl -k --output /dev/null -w '%{http_code}' --silent https://data.yoda:8445)" != "000" ] ; do printf '.' ; sleep 1; done
docker exec data.yoda sh -c '
until nc -vz provider.yoda 1247 > /dev/null 2>&1;
do echo "Waiting until iRODS provider is reachable from Davrods container ...";
sleep 1;
done'
# iRODS connections appears to be stable and Davrods is online: ready to start tests.
echo "Ready to start WebDAV tests."
- name: Run WebDAV tests
run: |
cd yoda-ruleset/tests
source venv/bin/activate
echo "WebDAV tests starting now."
python3 -m pytest --webdav -o cache_dir=mycache --environment environments/docker.json step_defs/webdav/test_webdav.py
- name: Output rodsLogs
if: failure()
run: |
docker exec provider.yoda sh -c 'cat /var/lib/irods-log/rodsLog*'
- name: Output EUS server logs
if: failure()
run: |
docker exec eus.yoda sh -c 'set -x ; for log in error.log access.log ; do echo "${log}:" ; cat "/var/log/apache2/$log" ; echo; done'
- name: Output portal web server logs
if: failure()
run: |
docker exec portal.yoda sh -c 'set -x ; for log in error.log portal_access.log ; do echo "${log}:" ; cat "/var/log/apache2/$log" ; echo; done'
- name: Output DavRODS server logs
if: failure()
run: |
docker exec data.yoda sh -c 'set -x ; for log in error.log webdav_access.log webdav_anon_access.log; do echo "${log}:" ; cat "/var/log/apache2/$log" ; echo; done'
# Uncomment section below when needed for debugging.
#
# - name: Setup tmate session for debugging
# uses: mxschmitt/action-tmate@v3
# if: ${{ failure() }}
# with:
# limit-access-to-actor: true