Skip to content

Commit

Permalink
toxiproxy: Fixed seed for better reproducibility
Browse files Browse the repository at this point in the history
  • Loading branch information
def- committed Jan 2, 2024
1 parent ad31e21 commit dfb4e18
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions misc/python/materialize/mzcompose/services/toxiproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# by the Apache License, Version 2.0.


import random

from materialize.mzcompose.service import (
Service,
)
Expand All @@ -19,11 +21,13 @@ def __init__(
name: str = "toxiproxy",
image: str = "shopify/toxiproxy:2.1.4",
port: int = 8474,
seed: int = random.randrange(2**63),
) -> None:
super().__init__(
name=name,
config={
"image": image,
"command": ["-host=0.0.0.0", f"-seed={seed}"],
"ports": [port],
"healthcheck": {
"test": ["CMD", "nc", "-z", "localhost", "8474"],
Expand Down
3 changes: 2 additions & 1 deletion test/parallel-workload/mzcompose.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:
ports=["6975:6875", "6976:6876", "6977:6877"],
catalog_store=catalog_store,
sanity_restart=sanity_restart,
)
),
Toxiproxy(seed=random.randrange(2**63)),
):
toxiproxy_start(c)
c.up(*service_names)
Expand Down
2 changes: 2 additions & 0 deletions test/zippy/mzcompose.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ def workflow_default(c: Composition, parser: WorkflowArgumentParser) -> None:
external_cockroach="toxiproxy",
sanity_restart=False,
),
# Override so seed gets respected
Toxiproxy(seed=random.randrange(2**63)),
):
toxiproxy_start(c)

Expand Down

0 comments on commit dfb4e18

Please sign in to comment.