Skip to content

Commit a43813d

Browse files
committed
build: Simplify xqueue test setup.
Previously we tested inside an outdated xqueue container but that container no longer gets updates and so that strategy is out of date. We update the tests to just test locally using github's capabilities to manage the python version. We could also use it to manage mysql and that's a future improvement we can make but for now this should unblock the tests working again. I'm aiming to do the minimal necessary to fix the tests since this repo is deprecated and will go away within the next year.
1 parent a806a56 commit a43813d

File tree

3 files changed

+14
-30
lines changed

3 files changed

+14
-30
lines changed

.github/docker-compose-ci.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,5 @@ services:
88
environment:
99
MYSQL_ROOT_PASSWORD: ""
1010
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
11-
12-
xqueue:
13-
container_name: xqueue
14-
image: edxops/xqueue-dev:latest
15-
command: tail -f /dev/null
16-
volumes:
17-
- ..:/edx/app/xqueue/xqueue
18-
depends_on:
19-
- mysql80
20-
environment:
21-
RABBIT_HOST: "rabbit"
11+
ports:
12+
- "3306:3306"

.github/workflows/ci.yml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
python-version: ['py311', 'py312']
16+
python-version:
17+
- "3.11"
18+
- "3.12"
1719
env-name: ['django42','django52', 'quality']
1820
db-version: ['mysql80']
1921

@@ -24,23 +26,14 @@ jobs:
2426
run: |
2527
docker compose -f .github/docker-compose-ci.yml up -d
2628
27-
- name: Setup Python ${{ matrix.python-version }} inside container
28-
run: |
29-
PY_VER=$(if [ "${{ matrix.python-version }}" = "py312" ]; then echo "3.12"; else echo "3.11"; fi)
30-
31-
docker exec xqueue bash -c "
32-
apt update &&
33-
apt install -y software-properties-common curl &&
34-
add-apt-repository ppa:deadsnakes/ppa -y &&
35-
apt install -y python$PY_VER python$PY_VER-dev python$PY_VER-venv &&
36-
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python$PY_VER 1 &&
37-
python$PY_VER -m venv /tmp/venv &&
38-
/tmp/venv/bin/pip install --upgrade pip
39-
"
29+
- name: Setup Python
30+
uses: actions/setup-python@v5
31+
with:
32+
python-version: ${{ matrix.python-version }}
4033

4134
- name: Install test dependencies and run tests
4235
env:
43-
TOXENV: ${{ matrix.python-version }}-${{ matrix.env-name }}
36+
TOXENV: ${{ matrix.env-name }}
4437
run: |
45-
docker exec xqueue bash -c "cd /edx/app/xqueue/xqueue/; /tmp/venv/bin/pip install -r requirements/ci.txt"
46-
docker exec xqueue bash -c "cd /edx/app/xqueue/xqueue/ && DB_HOST=${{ matrix.db-version }} tox -e ${TOXENV}"
38+
pip install -r requirements/ci.txt
39+
tox -e ${TOXENV}

xqueue/test_settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
DATABASES = {
1818
'default': {
1919
'ENGINE': 'django.db.backends.mysql',
20-
'USER': os.environ.get('DB_USER', ''),
20+
'USER': os.environ.get('DB_USER', 'root'),
2121
'PASSWORD': os.environ.get('DB_PASSWORD', ''),
2222
# pytest/django TestCase instances auto-prefix test_ onto the NAME
2323
'NAME': 'xqueue',
24-
'HOST': os.environ.get('DB_HOST', 'edx.devstack.mysql80'),
24+
'HOST': '127.0.0.1',
2525
# Wrap all view methods in an atomic transaction automatically.
2626
'ATOMIC_REQUESTS': True
2727
}

0 commit comments

Comments
 (0)