Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 9ed712b

Browse files
hiento09vansangpfievjan-service-accountVan-QA
authored
Fix openai collection test (#874)
Co-authored-by: vansangpfiev <vansangpfiev@gmail.com> Co-authored-by: Service Account <service@jan.ai> Co-authored-by: Van Pham <64197333+Van-QA@users.noreply.github.com>
1 parent f8537d8 commit 9ed712b

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

.github/workflows/cortex-js-openai-coverage.yml

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ env:
2222

2323
jobs:
2424
openai-python-tests:
25-
runs-on: [self-hosted, Linux, ubuntu-desktop]
25+
runs-on: ubuntu-20-04-openai-api-collection-test
2626
steps:
2727
- name: Getting the repo
2828
uses: actions/checkout@v4
@@ -35,35 +35,38 @@ jobs:
3535
with:
3636
node-version: 20
3737

38-
- uses: actions/setup-python@v4
39-
with:
40-
python-version: "3.10"
41-
42-
- run: yarn install && yarn build
38+
- run: npm install -g yarn && yarn install && yarn build
4339
working-directory: ./cortex-js
4440

41+
- name: install python venv
42+
run: |
43+
sudo apt-get update
44+
sudo apt-get install python3-venv -y
45+
python3 -m venv /tmp/jan
46+
4547
- name: Run test
4648
run: |
4749
node cortex-js/dist/src/command.js serve --address 127.0.0.1 --port 4010 > cortex.log & cortex_pid=$!
4850
sleep 3
4951
wget --no-verbose -O api.json http://127.0.0.1:4010/api-json
5052
cat api.json
51-
53+
source /tmp/jan/bin/activate
5254
# Clone openai-api-python repo
5355
git clone https://github.com/openai/openai-python.git -b $OPENAI_API_PYTHON_TAG
5456
cd openai-python
5557
56-
pip install -r requirements-dev.lock
57-
pip install pytest-reportportal pytest-html
58+
pip3 install -r requirements-dev.lock
59+
pip3 install pytest-reportportal pytest-html
5860
59-
mv ../coverage/conftest.py tests/conftest.py
60-
mv ../coverage/endpoint_mapping.json tests/endpoints_mapping.json
61-
mv ../coverage/pytest.ini pytest.ini
61+
cat ../coverage/conftest.py >> tests/conftest.py
62+
cat ../coverage/endpoint_mapping.json >> tests/endpoints_mapping.json
63+
cat ../coverage/pytest.ini >> pytest.ini
6264
echo "rp_api_key = ${{ secrets.RP_API_KEY }}" >> pytest.ini
6365
echo "rp_endpoint = ${{ secrets.RP_ENDPOINT }}" >> pytest.ini
6466
65-
pytest --continue-on-collection-errors --endpoint "$ENDPOINTS" --reportportal --html=report.html -v || true
67+
pytest --endpoint "$ENDPOINTS" --reportportal --html=report.html -v || true
6668
kill $cortex_pid
69+
deactivate
6770
env:
6871
ENDPOINTS: ${{ github.event.inputs.endpoints }}
6972

coverage/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import json
2-
import pytest
32

43
def pytest_addoption(parser):
54
parser.addoption(
@@ -37,4 +36,4 @@ def pytest_collection_modifyitems(items):
3736
# map the name of the file to endpoint, else use default value
3837
filename = item.fspath.basename
3938
marker = filename_to_endpoint.get(filename, filename)
40-
item.add_marker(pytest.mark.endpoint(marker, filename=filename))
39+
item.add_marker(pytest.mark.endpoint(marker, filename=filename))

0 commit comments

Comments
 (0)