mirror of
https://github.com/codex-storage/bittorrent-benchmarks.git
synced 2025-02-13 11:36:28 +00:00
make it possible to run the test runner containerized; add integration tests to CI
This commit is contained in:
parent
c334c12cd3
commit
1261dd08de
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -56,6 +56,10 @@ jobs:
|
||||
run: |
|
||||
docker run --rm --entrypoint pytest bittorrent-benchmarks:test -m "not integration"
|
||||
|
||||
- name: Run Integration Tests
|
||||
run: |
|
||||
docker compose -f docker-compose.yaml -f docker-compose.ci.yaml up --abort-on-container-exit --exit-code-from test-runner
|
||||
|
||||
- name: Build and Push Prod. Image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
|
@ -1,8 +1,9 @@
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Generator
|
||||
|
||||
import pytest
|
||||
from urllib3.util import Url, parse_url
|
||||
from urllib3.util import parse_url
|
||||
|
||||
from benchmarks.core import utils
|
||||
from benchmarks.core.utils import megabytes, await_predicate
|
||||
@ -11,9 +12,9 @@ from benchmarks.deluge.tracker import Tracker
|
||||
from benchmarks.tests.utils import shared_volume
|
||||
|
||||
|
||||
def deluge_node(name: str, port: int) -> Generator[DelugeNode, None, None]:
|
||||
node = DelugeNode(name, volume=shared_volume(), daemon_port=port)
|
||||
await_predicate(node.is_ready, timeout=10, polling_interval=0.5)
|
||||
def deluge_node(name: str, address: str, port: int) -> Generator[DelugeNode, None, None]:
|
||||
node = DelugeNode(name, volume=shared_volume(), daemon_address=address, daemon_port=port)
|
||||
assert await_predicate(node.is_ready, timeout=10, polling_interval=0.5)
|
||||
node.wipe_all_torrents()
|
||||
try:
|
||||
yield node
|
||||
@ -23,17 +24,17 @@ def deluge_node(name: str, port: int) -> Generator[DelugeNode, None, None]:
|
||||
|
||||
@pytest.fixture
|
||||
def deluge_node1() -> Generator[DelugeNode, None, None]:
|
||||
yield from deluge_node('deluge-1', 6890)
|
||||
yield from deluge_node('deluge-1', os.environ.get('DELUGE_NODE_1', 'localhost'), 6890)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def deluge_node2() -> Generator[DelugeNode, None, None]:
|
||||
yield from deluge_node('deluge-2', 6893)
|
||||
yield from deluge_node('deluge-2', os.environ.get('DELUGE_NODE_2', 'localhost'), 6893)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def deluge_node3() -> Generator[DelugeNode, None, None]:
|
||||
yield from deluge_node('deluge-3', 6896)
|
||||
yield from deluge_node('deluge-3', os.environ.get('DELUGE_NODE_3', 'localhost'), 6896)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@ -44,4 +45,4 @@ def temp_random_file() -> Generator[Path, None, None]:
|
||||
|
||||
@pytest.fixture
|
||||
def tracker() -> Tracker:
|
||||
return Tracker(parse_url('http://127.0.0.1:8000/announce'))
|
||||
return Tracker(parse_url(os.environ.get('TRACKER_ANNOUNCE_URL', 'http://127.0.0.1:8000/announce')))
|
||||
|
12
docker-compose.ci.yaml
Normal file
12
docker-compose.ci.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
services:
|
||||
test-runner:
|
||||
image: bittorrent-benchmarks:test
|
||||
container_name: test-runner
|
||||
volumes:
|
||||
- ./volume:/opt/bittorrent-benchmarks/volume
|
||||
entrypoint: [ "pytest", "--exitfirst" ]
|
||||
environment:
|
||||
- DELUGE_NODE_1=deluge-1
|
||||
- DELUGE_NODE_2=deluge-2
|
||||
- DELUGE_NODE_3=deluge-3
|
||||
- TRACKER_ANNOUNCE_URL=http://tracker:8000/announce
|
@ -2,18 +2,18 @@
|
||||
# Docker compose environment.
|
||||
deluge_experiment:
|
||||
seeders: 1
|
||||
tracker_announce_url: http://127.0.0.1:8000/announce
|
||||
tracker_announce_url: ${TRACKER_ANNOUNCE_URL:-http://127.0.0.1:8000/announce}
|
||||
file_size: 52428800
|
||||
repetitions: 3
|
||||
shared_volume_path: ${PWD}/volume
|
||||
|
||||
nodes:
|
||||
- address: localhost
|
||||
- address: ${DELUGE_NODE_1:-localhost}
|
||||
daemon_port: 6890
|
||||
listen_ports: [ 6891, 6892 ]
|
||||
- address: localhost
|
||||
- address: ${DELUGE_NODE_2:-localhost}
|
||||
daemon_port: 6893
|
||||
listen_ports: [ 6894, 6895 ]
|
||||
- address: localhost
|
||||
- address: ${DELUGE_NODE_3:-localhost}
|
||||
daemon_port: 6896
|
||||
listen_ports: [ 6897, 6898 ]
|
||||
|
Loading…
x
Reference in New Issue
Block a user