Skip to content

Commit

Permalink
reset port and extract workflow tests into separate yaml file
Browse files Browse the repository at this point in the history
  • Loading branch information
dtrai2 committed Jun 20, 2024
1 parent 5edd2c2 commit 45de873
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 47 deletions.
22 changes: 1 addition & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,7 @@ on:

jobs:
test:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
test-type: ["unit", "acceptance"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies
run: |
pip install --upgrade pip wheel
pip install .[dev]
- name: Perform unit ${{ matrix.test-type }}
env:
PYTEST_ADDOPTS: "--color=yes"
run: |
pytest -vv tests/${{ matrix.test-type }}
uses: .github/workflows/testing.yml

build-docs:
runs-on: ubuntu-22.04
Expand Down
22 changes: 1 addition & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,7 @@ on:

jobs:
test:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
test-type: ["unit", "acceptance"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies
run: |
pip install --upgrade pip wheel
pip install .[dev]
- name: Perform unit ${{ matrix.test-type }}
env:
PYTEST_ADDOPTS: "--color=yes"
run: |
pytest -vv tests/${{ matrix.test-type }}
uses: .github/workflows/testing.yml

code-quality:
runs-on: ubuntu-22.04
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Testing

on:
workflow_call:

jobs:
test:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
test-type: ["unit", "acceptance"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
- name: Install dependencies
run: |
pip install --upgrade pip wheel
pip install .[dev]
- name: Perform ${{ matrix.test-type }} test
env:
PYTEST_ADDOPTS: "--color=yes"
run: |
pytest -vv -s tests/${{ matrix.test-type }}
10 changes: 5 additions & 5 deletions tests/acceptance/test_http_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def config_fixture():
"type": "http_input",
"uvicorn_config": {
"host": "127.0.0.1",
"port": 12681,
"port": 9000,
"ssl_certfile": "tests/testdata/acceptance/http_input/cert.crt",
"ssl_keyfile": "tests/testdata/acceptance/http_input/cert.key",
},
Expand All @@ -62,9 +62,9 @@ def test_http_input_accepts_message_for_single_pipeline(tmp_path: Path, config:
config_path = tmp_path / "generated_config.yml"
config_path.write_text(config.as_yaml())
proc = start_logprep(config_path)
wait_for_output(proc, "Uvicorn running on https://127.0.0.1:12681", test_timeout=15)
wait_for_output(proc, "Uvicorn running on https://127.0.0.1:9000", test_timeout=15)

requests.post("https://127.0.0.1:12681/plaintext", data="my message", verify=False, timeout=5)
requests.post("https://127.0.0.1:9000/plaintext", data="my message", verify=False, timeout=5)
time.sleep(0.5)
assert "my message" in output_path.read_text()

Expand All @@ -77,8 +77,8 @@ def test_http_input_accepts_message_for_multiple_pipelines(tmp_path: Path, confi
config_path = tmp_path / "generated_config.yml"
config_path.write_text(config.as_yaml())
proc = start_logprep(config_path)
wait_for_output(proc, "Uvicorn running on https://127.0.0.1:12681", test_timeout=15)
wait_for_output(proc, "Uvicorn running on https://127.0.0.1:9000", test_timeout=15)

requests.post("https://127.0.0.1:12681/plaintext", data="my message", verify=False, timeout=5)
requests.post("https://127.0.0.1:9000/plaintext", data="my message", verify=False, timeout=5)
time.sleep(0.5)
assert "my message" in output_path.read_text()

0 comments on commit 45de873

Please sign in to comment.