forked from jamesward/easyracer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_all.py
48 lines (35 loc) · 1.41 KB
/
test_all.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import pytest
import aiohttp
import main
from testcontainers.core.generic import DockerContainer
#from testcontainers.core.waiting_utils import wait_container_is_ready
@pytest.mark.asyncio
async def test_all():
# todo: no way to set pull policy yet
docker_container = DockerContainer("ghcr.io/jamesward/easyracer").with_exposed_ports(8080)
with docker_container as easyracer:
port = easyracer.get_exposed_port(8080)
# todo: can't find the right way to wait on the container being ready
import time
time.sleep(2)
#@wait_container_is_ready()
async def connected():
result1 = await main.scenario1(port)
assert result1 == "right"
result2 = await main.scenario2(port)
assert result2 == "right"
result3 = await main.scenario3(port)
assert result3 == "right"
result4 = await main.scenario4(port)
assert result4 == "right"
result5 = await main.scenario5(port)
assert result5 == "right"
result6 = await main.scenario6(port)
assert result6 == "right"
result7 = await main.scenario7(port)
assert result7 == "right"
result8 = await main.scenario8(port)
assert result8 == "right"
result9 = await main.scenario9(port)
assert result9 == "right"
await connected()