wip
This commit is contained in:
parent
d3a1756f7f
commit
23bda0cc46
1116
.github/workflows/osrm-backend.yml
vendored
1116
.github/workflows/osrm-backend.yml
vendored
File diff suppressed because it is too large
Load Diff
@ -30,43 +30,43 @@ class OSRMTasks(TaskSet):
|
|||||||
|
|
||||||
self.client.get(f"/route/v1/driving/{start_coord};{end_coord}?overview=full&steps=true", name="route")
|
self.client.get(f"/route/v1/driving/{start_coord};{end_coord}?overview=full&steps=true", name="route")
|
||||||
|
|
||||||
@task
|
# @task
|
||||||
def get_table(self):
|
# def get_table(self):
|
||||||
num_coords = random.randint(3, 100)
|
# num_coords = random.randint(3, 100)
|
||||||
selected_coords = random.sample(self.coordinates, num_coords)
|
# selected_coords = random.sample(self.coordinates, num_coords)
|
||||||
coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in selected_coords])
|
# coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in selected_coords])
|
||||||
|
|
||||||
self.client.get(f"/table/v1/driving/{coords_str}", name="table")
|
# self.client.get(f"/table/v1/driving/{coords_str}", name="table")
|
||||||
|
|
||||||
@task
|
# @task
|
||||||
def get_match(self):
|
# def get_match(self):
|
||||||
num_coords = random.randint(50, 100)
|
# num_coords = random.randint(50, 100)
|
||||||
track_id = random.choice(self.track_ids)
|
# track_id = random.choice(self.track_ids)
|
||||||
track_coords = self.tracks[track_id][:num_coords]
|
# track_coords = self.tracks[track_id][:num_coords]
|
||||||
coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in track_coords])
|
# coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in track_coords])
|
||||||
radiues_str = ";".join([f"{random.randint(5, 20)}" for _ in range(len(track_coords))])
|
# radiues_str = ";".join([f"{random.randint(5, 20)}" for _ in range(len(track_coords))])
|
||||||
|
|
||||||
with self.client.get(f"/match/v1/driving/{coords_str}?steps=true&radiuses={radiues_str}", name="match", catch_response=True) as response:
|
# with self.client.get(f"/match/v1/driving/{coords_str}?steps=true&radiuses={radiues_str}", name="match", catch_response=True) as response:
|
||||||
if response.status_code == 400:
|
# if response.status_code == 400:
|
||||||
j = response.json()
|
# j = response.json()
|
||||||
# it is expected that some of requests will fail with such error: map matching fails sometimes
|
# # it is expected that some of requests will fail with such error: map matching fails sometimes
|
||||||
if j['code'] == 'NoSegment' or j['code'] == 'NoMatch':
|
# if j['code'] == 'NoSegment' or j['code'] == 'NoMatch':
|
||||||
response.success()
|
# response.success()
|
||||||
|
|
||||||
@task
|
# @task
|
||||||
def get_nearest(self):
|
# def get_nearest(self):
|
||||||
coord = random.choice(self.coordinates)
|
# coord = random.choice(self.coordinates)
|
||||||
coord_str = f"{coord[1]:.6f},{coord[0]:.6f}"
|
# coord_str = f"{coord[1]:.6f},{coord[0]:.6f}"
|
||||||
|
|
||||||
self.client.get(f"/nearest/v1/driving/{coord_str}", name="nearest")
|
# self.client.get(f"/nearest/v1/driving/{coord_str}", name="nearest")
|
||||||
|
|
||||||
@task
|
# @task
|
||||||
def get_trip(self):
|
# def get_trip(self):
|
||||||
num_coords = random.randint(2, 10)
|
# num_coords = random.randint(2, 10)
|
||||||
selected_coords = random.sample(self.coordinates, num_coords)
|
# selected_coords = random.sample(self.coordinates, num_coords)
|
||||||
coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in selected_coords])
|
# coords_str = ";".join([f"{coord[1]:.6f},{coord[0]:.6f}" for coord in selected_coords])
|
||||||
|
|
||||||
self.client.get(f"/trip/v1/driving/{coords_str}?steps=true", name="trip")
|
# self.client.get(f"/trip/v1/driving/{coords_str}?steps=true", name="trip")
|
||||||
|
|
||||||
class OSRMUser(HttpUser):
|
class OSRMUser(HttpUser):
|
||||||
tasks = [OSRMTasks]
|
tasks = [OSRMTasks]
|
||||||
|
Loading…
Reference in New Issue
Block a user