Skip to content

Commit 6703e07

Browse files
authored
Test pipeline fixes and refresh. (#1305)
1 parent d2057d3 commit 6703e07

File tree

7 files changed

+85
-58
lines changed

7 files changed

+85
-58
lines changed

.github/workflows/testing-pipeline.yml

Lines changed: 17 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,90 +7,57 @@ on:
77
branches: [ master ]
88

99
jobs:
10-
test_python_2019:
11-
name: Run Python Unit Tests (CY2019)
12-
runs-on: ubuntu-latest
13-
container: aswf/ci-opencue:2019
14-
steps:
15-
- uses: actions/checkout@v3
16-
- name: Run Python Tests
17-
run: ci/run_python_tests.sh
18-
19-
test_cuebot_2019:
20-
name: Build Cuebot and Run Unit Tests (CY2019)
21-
runs-on: ubuntu-latest
22-
container:
23-
image: aswf/ci-opencue:2019
24-
steps:
25-
- uses: actions/checkout@v3
26-
- name: Build with Gradle
27-
run: |
28-
chown -R aswfuser:aswfgroup .
29-
su -c "cd cuebot && ./gradlew build --stacktrace --info" aswfuser
30-
31-
test_python_2020:
32-
name: Run Python Unit Tests (CY2020)
10+
test_python_2022:
11+
name: Run Python Unit Tests (CY2022)
3312
runs-on: ubuntu-latest
34-
container: aswf/ci-opencue:2020
13+
container: aswf/ci-opencue:2022
3514
steps:
3615
- uses: actions/checkout@v3
3716
- name: Run Python Tests
38-
run: ci/run_python_tests.sh
17+
run: ci/run_python_tests.sh --no-gui
3918

40-
test_cuebot_2020:
41-
name: Build Cuebot and Run Unit Tests (CY2020)
19+
test_cuebot_2022:
20+
name: Build Cuebot and Run Unit Tests (CY2022)
4221
runs-on: ubuntu-latest
4322
container:
44-
image: aswf/ci-opencue:2020
23+
image: aswf/ci-opencue:2022
4524
steps:
4625
- uses: actions/checkout@v3
4726
- name: Build with Gradle
4827
run: |
4928
chown -R aswfuser:aswfgroup .
5029
su -c "cd cuebot && ./gradlew build --stacktrace --info" aswfuser
5130
52-
test_python_2021:
53-
name: Run Python Unit Tests (CY2021)
31+
test_python_2023:
32+
name: Run Python Unit Tests (CY2023)
5433
runs-on: ubuntu-latest
55-
container: aswf/ci-opencue:2021
34+
container: aswf/ci-opencue:2023
5635
steps:
5736
- uses: actions/checkout@v3
5837
- name: Run Python Tests
5938
run: ci/run_python_tests.sh
6039

61-
test_cuebot_2021:
62-
name: Build Cuebot and Run Unit Tests (CY2021)
40+
test_cuebot_2023:
41+
name: Build Cuebot and Run Unit Tests (CY2023)
6342
runs-on: ubuntu-latest
6443
container:
65-
image: aswf/ci-opencue:2021
44+
image: aswf/ci-opencue:2023
6645
steps:
6746
- uses: actions/checkout@v3
6847
- name: Build with Gradle
6948
run: |
7049
chown -R aswfuser:aswfgroup .
7150
su -c "cd cuebot && ./gradlew build --stacktrace --info" aswfuser
7251
73-
test_python_2022:
74-
name: Run Python Unit Tests (CY2022)
52+
test_python2:
53+
name: Run Python Unit Tests using Python2
7554
runs-on: ubuntu-latest
76-
container: aswf/ci-opencue:2022
55+
container: aswf/ci-opencue:2019
7756
steps:
7857
- uses: actions/checkout@v3
7958
- name: Run Python Tests
8059
run: ci/run_python_tests.sh
8160

82-
test_cuebot_2022:
83-
name: Build Cuebot and Run Unit Tests (CY2022)
84-
runs-on: ubuntu-latest
85-
container:
86-
image: aswf/ci-opencue:2022
87-
steps:
88-
- uses: actions/checkout@v3
89-
- name: Build with Gradle
90-
run: |
91-
chown -R aswfuser:aswfgroup .
92-
su -c "cd cuebot && ./gradlew build --stacktrace --info" aswfuser
93-
9461
test_pyside6:
9562
name: Run CueGUI Tests using PySide6
9663
runs-on: ubuntu-latest
@@ -113,7 +80,7 @@ jobs:
11380
name: Test Documentation Build
11481
runs-on: ubuntu-latest
11582
container:
116-
image: aswf/ci-opencue:2020
83+
image: aswf/ci-opencue:2023
11784
steps:
11885
- uses: actions/checkout@v3
11986
- name: Run Sphinx build

ci/run_python_tests.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
#!/bin/bash
22

3+
# Script for running OpenCue unit tests with PySide2.
4+
#
5+
# This script is written to be run within the OpenCue GitHub Actions environment.
6+
# See `.github/workflows/testing-pipeline.yml`.
7+
38
set -e
49

10+
args=("$@")
511
python_version=$(python -V 2>&1)
612
echo "Will run tests using ${python_version}"
713

@@ -23,6 +29,6 @@ PYTHONPATH=pycue:pyoutline python cuesubmit/setup.py test
2329
python rqd/setup.py test
2430

2531
# Xvfb no longer supports Python 2.
26-
if [[ "$python_version" =~ "Python 3" ]]; then
32+
if [[ "$python_version" =~ "Python 3" && ${args[0]} != "--no-gui" ]]; then
2733
ci/run_gui_test.sh
2834
fi

ci/run_python_tests_pyside6.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
3+
# Script for running OpenCue unit tests with PySide6.
4+
#
5+
# This script is written to be run within the OpenCue GitHub Actions environment.
6+
# See `.github/workflows/testing-pipeline.yml`.
7+
8+
set -e
9+
10+
python_version=$(python -V 2>&1)
11+
echo "Will run tests using ${python_version}"
12+
13+
# NOTE: To run this in an almalinux environment, install these packages:
14+
# yum -y install \
15+
# dbus-libs \
16+
# fontconfig \
17+
# gcc \
18+
# libxkbcommon-x11 \
19+
# mesa-libEGL-devel \
20+
# python-devel \
21+
# which \
22+
# xcb-util-keysyms \
23+
# xcb-util-image \
24+
# xcb-util-renderutil \
25+
# xcb-util-wm \
26+
# Xvfb
27+
28+
# Install Python requirements.
29+
python3 -m pip install --user -r requirements.txt -r requirements_gui.txt
30+
# Replace PySide2 with PySide6.
31+
python3 -m pip uninstall -y PySide2
32+
python3 -m pip install --user PySide6==6.3.2
33+
34+
# Protos need to have their Python code generated in order for tests to pass.
35+
python -m grpc_tools.protoc -I=proto/ --python_out=pycue/opencue/compiled_proto --grpc_python_out=pycue/opencue/compiled_proto proto/*.proto
36+
python -m grpc_tools.protoc -I=proto/ --python_out=rqd/rqd/compiled_proto --grpc_python_out=rqd/rqd/compiled_proto proto/*.proto
37+
38+
# Fix compiled proto code for Python 3.
39+
2to3 -wn -f import pycue/opencue/compiled_proto/*_pb2*.py
40+
2to3 -wn -f import rqd/rqd/compiled_proto/*_pb2*.py
41+
42+
python pycue/setup.py test
43+
PYTHONPATH=pycue python pyoutline/setup.py test
44+
PYTHONPATH=pycue python cueadmin/setup.py test
45+
PYTHONPATH=pycue:pyoutline python cuesubmit/setup.py test
46+
python rqd/setup.py test
47+
48+
ci/run_gui_test.sh

cuebot/src/main/resources/conf/ddl/postgres/seed_data.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Insert into SHOW (PK_SHOW,STR_NAME,INT_DEFAULT_MAX_CORES,INT_DEFAULT_MIN_CORES,B_BOOKING_ENABLED,B_DISPATCH_ENABLED,B_ACTIVE) values ('00000000-0000-0000-0000-000000000000', 'testing', 200000, 100, true, true, true);
22

3-
Insert into SHOW_STATS (PK_SHOW,INT_FRAME_INSERT_COUNT,INT_JOB_INSERT_COUNT,INT_FRAME_SUCCESS_COUNT,INT_FRAME_FAIL_COUNT) values ('00000000-0000-0000-0000-000000000000',0,0,0,0)
3+
Insert into SHOW_STATS (PK_SHOW,INT_FRAME_INSERT_COUNT,INT_JOB_INSERT_COUNT,INT_FRAME_SUCCESS_COUNT,INT_FRAME_FAIL_COUNT) values ('00000000-0000-0000-0000-000000000000',0,0,0,0);
44

55
Insert into SHOW_ALIAS (PK_SHOW_ALIAS,PK_SHOW,STR_NAME) values ('00000000-0000-0000-0000-000000000001', '00000000-0000-0000-0000-000000000000', 'test');
66

cuegui/tests/Constants_tests.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
import mock
2727
import pyfakefs.fake_filesystem_unittest
28-
from PySide2 import QtGui
28+
from qtpy import QtGui
2929

3030
import opencue
3131
import cuegui.Constants
@@ -40,6 +40,7 @@
4040
'''
4141

4242

43+
# pylint: disable=import-outside-toplevel,redefined-outer-name,reimported
4344
class ConstantsTests(pyfakefs.fake_filesystem_unittest.TestCase):
4445
def setUp(self):
4546
self.setUpPyfakefs()
@@ -53,6 +54,7 @@ def test__should_load_user_config_from_env_var(self):
5354
self.fs.create_file(config_file_path, contents=CONFIG_YAML)
5455
os.environ['CUEGUI_CONFIG_FILE'] = config_file_path
5556

57+
import cuegui.Constants
5658
result = importlib.reload(cuegui.Constants)
5759

5860
self.assertEqual('98.707.68', result.VERSION)
@@ -65,6 +67,7 @@ def test__should_load_user_config_from_user_profile(self):
6567
config_file_path = '/home/username/.config/opencue/cuegui.yaml'
6668
self.fs.create_file(config_file_path, contents=CONFIG_YAML)
6769

70+
import cuegui.Constants
6871
result = importlib.reload(cuegui.Constants)
6972

7073
self.assertEqual('98.707.68', result.VERSION)
@@ -73,6 +76,7 @@ def test__should_load_user_config_from_user_profile(self):
7376

7477
@mock.patch('platform.system', new=mock.Mock(return_value='Linux'))
7578
def test__should_use_default_values(self):
79+
import cuegui.Constants
7680
result = importlib.reload(cuegui.Constants)
7781

7882
self.assertNotEqual('98.707.68', result.VERSION)
@@ -161,6 +165,7 @@ def test__should_use_default_values(self):
161165

162166
@mock.patch('platform.system', new=mock.Mock(return_value='Darwin'))
163167
def test__should_use_mac_editor(self):
168+
import cuegui.Constants
164169
result = importlib.reload(cuegui.Constants)
165170

166171
self.assertEqual('open -t', result.DEFAULT_EDITOR)

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ packaging==20.9
1212
pathlib==1.0.1;python_version<"3.4"
1313
protobuf==3.17.3;python_version<"3.0"
1414
psutil==5.6.7
15-
pyfakefs==3.6
15+
pyfakefs==3.6;python_version<"3.7"
16+
pyfakefs==5.2.3;python_version>="3.7"
1617
pylint==2.6.0;python_version>="3.7"
1718
pynput==1.7.6
1819
PyYAML==5.1

rqd/rqd/rqcore.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,8 +1181,10 @@ def pipe_to_file(stdout, stderr, outfile):
11811181
outfile.flush()
11821182
os.fsync(outfile)
11831183

1184+
# pylint: disable=import-outside-toplevel
11841185
import select
11851186
import errno
1187+
# pylint: enable=import-outside-toplevel
11861188

11871189
fd2file = {}
11881190
fd2output = {}
@@ -1213,8 +1215,7 @@ def print_and_flush_ln(fd, last_timestamp):
12131215
# There are no line breaks
12141216
if len(lines) < 2:
12151217
return curr_line_timestamp
1216-
else:
1217-
next_line_timestamp = datetime.datetime.now().strftime("%H:%M:%S")
1218+
next_line_timestamp = datetime.datetime.now().strftime("%H:%M:%S")
12181219

12191220
remainder = lines[-1]
12201221
for line in lines[0:-1]:
@@ -1225,8 +1226,7 @@ def print_and_flush_ln(fd, last_timestamp):
12251226

12261227
if next_line_timestamp is None:
12271228
return curr_line_timestamp
1228-
else:
1229-
return next_line_timestamp
1229+
return next_line_timestamp
12301230

12311231
def translate_newlines(data):
12321232
data = data.decode("utf-8", "ignore")

0 commit comments

Comments
 (0)