Skip to content

Commit e4b07ee

Browse files
committed
ci: run selenium tests
Signed-off-by: Martin Styk <[email protected]>
1 parent d8989c1 commit e4b07ee

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed

.github/workflows/review-checks.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,125 @@ jobs:
223223
run: |
224224
pushd ${{ matrix.test-target }}
225225
./run-tests.sh
226+
227+
228+
selenium-integration-tests:
229+
runs-on: ubuntu-latest
230+
env:
231+
MYSQL_USER: beaker
232+
MYSQL_PASSWORD: beaker
233+
MYSQL_ROOT_PASSWORD: toor
234+
strategy:
235+
fail-fast: false
236+
matrix:
237+
group: [
238+
"test_activity,test_add_system,test_csv_export,test_csv_import,test_csv_roundtrip,test_distro_family,test_distro_search,test_distro_trees,test_distros,test_grid,test_group_edit",
239+
"test_groups,test_help,test_item_count,test_job_ack,test_job_cancel,test_job_delete,test_job_delete_xmlrpc,test_job_export_xml,test_job_matrix,test_job_search,test_jobs",
240+
"test_jobs_old,test_jobs_xmlrpc,test_keytypes,test_labcontrollers,test_log_upload,test_login,test_motd,test_my_menu_tests,test_osversions,test_power_types,test_prefs",
241+
"test_product,test_recipe_search,test_recipes,test_recipes_old,test_recipes_xmlrpc,test_recipetasks,test_recipetasks_xmlrpc,test_reserve_report,test_reserve_system,test_retentiontag,test_system_access_policies",
242+
"test_system_actions,test_system_availability,test_system_commands,test_system_loan,test_system_menu_tests,test_system_note,test_system_pools,test_system_provision,test_system_quickinfo,test_system_return,test_system_search",
243+
"test_system_view,test_systems,test_systems_xmlrpc,test_task_by_name,test_task_search,test_taskactions_xmlrpc,test_tasks,test_users,test_watchdogs,test_xmlrpc"
244+
]
245+
test-target: ["bkr.inttest.server.selenium"]
246+
container:
247+
image: centos:7
248+
options: --init
249+
volumes:
250+
- /node20217:/node20217:rw,rshared
251+
- /node20217:/__e/node20:ro,rshared
252+
services:
253+
database:
254+
image: mariadb:10-ubi
255+
env:
256+
MYSQL_USER: ${{ env.MYSQL_USER }}
257+
MYSQL_PASSWORD: ${{ env.MYSQL_PASSWORD }}
258+
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }}
259+
ports:
260+
- 3306
261+
steps:
262+
- name: Fetch Node 20
263+
run: |
264+
curl -LO https://unofficial-builds.nodejs.org/download/release/v20.9.0/node-v20.9.0-linux-x64-glibc-217.tar.xz
265+
tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217
266+
- name: Fixup CentOS repo files
267+
run: |
268+
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
269+
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
270+
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
271+
272+
# We have to install git 2.18+ to perform checkout via git
273+
# This is possible only via IUS repositories
274+
- name: Install git to allow checkout
275+
run: |
276+
yum install https://repo.ius.io/ius-release-el7.rpm epel-release -y
277+
yum install git236-core -y
278+
279+
- name: Checkout
280+
uses: actions/checkout@v4
281+
282+
# Remove custom git from the IUS repository - git will be reinstalled later as it is needed by beaker itself.
283+
- name: Remove git236 and YUM repositories
284+
run: yum remove git236-core ius-release epel-release -y
285+
286+
- name: Add Beaker Server YUM repository
287+
run: |
288+
curl -o /etc/yum.repos.d/beaker-server.repo https://beaker-project.org/yum/beaker-server-RedHatEnterpriseLinux.repo
289+
290+
- name: Install Beaker dependencies
291+
run: |
292+
yum install bzip2 ca-certificates wget epel-release mariadb beaker-integration-tests -y
293+
yum-builddep beaker.spec -y
294+
yum remove beaker-common \
295+
beaker-client \
296+
beaker-lab-controller \
297+
beaker-server \
298+
beaker-integration-tests -y
299+
300+
- name: Checkout submodules
301+
run: |
302+
git submodule update --init --recursive
303+
304+
- name: Configure database for testing
305+
run: |
306+
cat <<EOT > init.sql
307+
CREATE DATABASE beaker_test;
308+
CREATE DATABASE beaker_migration_test;
309+
GRANT ALL PRIVILEGES ON beaker_test.* TO 'beaker'@'%';
310+
GRANT ALL PRIVILEGES ON beaker_migration_test.* TO 'beaker'@'%';
311+
SET GLOBAL max_allowed_packet=1073741824;
312+
SET GLOBAL character_set_server=utf8;
313+
EOT
314+
315+
mysql -uroot -p${{ env.MYSQL_ROOT_PASSWORD }} -h database < init.sql
316+
sed -i 's/@localhost/@database/g' IntegrationTests/server-test.cfg
317+
318+
- name: Update version
319+
run: |
320+
# Update the version in common/__init__.py, as this file is used in the application and tests to determine the version
321+
current_version=$(grep -oE "__version__ = '[^']+'" Common/bkr/common/__init__.py | cut -d "'" -f 2)
322+
new_version="$current_version.git.$(git rev-parse --short HEAD)"
323+
sed -i "s/__version__ = '$current_version'/__version__ = '$new_version'/" Common/bkr/common/__init__.py
324+
325+
- name: Install Firefox
326+
run: |
327+
yum remove firefox -y
328+
yum install gtk2 -y
329+
330+
# Downloading Firefox from the official website
331+
wget https://download-installer.cdn.mozilla.net/pub/firefox/releases/43.0.4/linux-x86_64/en-US/firefox-43.0.4.tar.bz2
332+
333+
# Extract the tarball
334+
tar xvjf firefox-43.0.4.tar.bz2
335+
336+
# Move Firefox to a directory in PATH
337+
mv firefox /usr/local/bin/
338+
339+
# Link the firefox binary to a location in PATH
340+
ln -s /usr/local/bin/firefox/firefox /usr/bin/firefox
341+
342+
- name: Run integration tests for ${{ matrix.test-target }}
343+
run: |
344+
pushd IntegrationTests
345+
for test_file in $(echo "${{ matrix.group }}" | tr ',' '\n'); do
346+
./run-tests.sh -v ${{ matrix.test-target }}.${test_file}
347+
done

0 commit comments

Comments
 (0)