Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tests): add toxiproxy for integration testing network issues #342

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 20 additions & 39 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,46 +111,27 @@ services:
POSTGRES_DB: "speckle"
ENABLE_MP: "false"

preview-service:
image: speckle/speckle-preview-service:latest
restart: always
depends_on:
speckle-server:
condition: service_healthy
mem_limit: "1000m"
memswap_limit: "1000m"
environment:
DEBUG: "preview-service:*"
PG_CONNECTION_STRING: "postgres://speckle:speckle@postgres/speckle"

webhook-service:
image: speckle/speckle-webhook-service:latest
restart: always
depends_on:
speckle-server:
condition: service_healthy
environment:
DEBUG: "webhook-service:*"
PG_CONNECTION_STRING: "postgres://speckle:speckle@postgres/speckle"
WAIT_HOSTS: postgres:5432

fileimport-service:
image: speckle/speckle-fileimport-service:latest
restart: always
depends_on:
speckle-server:
condition: service_healthy
environment:
DEBUG: "fileimport-service:*"
PG_CONNECTION_STRING: "postgres://speckle:speckle@postgres/speckle"
WAIT_HOSTS: postgres:5432

S3_ENDPOINT: "http://minio:9000"
S3_ACCESS_KEY: "minioadmin"
S3_SECRET_KEY: "minioadmin"
S3_BUCKET: "speckle-server"
####
# Testing and development tools
#######

SPECKLE_SERVER_URL: "http://speckle-server:3000"
toxiproxy:
###
# Toxiproxy is a tool to simulate network conditions https://github.com/Shopify/toxiproxy
# Instead of connecting to speckle-server on port 3000, connect to ToxiProxy on port 3001
# Toxiproxy will forward the connection to speckle-server
# Use the ToxiProxy API to simulate network conditions as necessary
###
image: ghcr.io/shopify/toxiproxy:2.9.0
volumes:
# This mounts the toxiproxy.json file into the container at /config/toxiproxy.json
- ./toxiproxy.json:/config/toxiproxy.json
# This command starts toxiproxy with the configuration file
entrypoint: /toxiproxy -config /config/toxiproxy.json
ports:
# open ports to match the 'listen' ports in the toxiproxy.json file
- 8474:8474 # Toxiproxy API
- 3001:3001 # Speckle server

networks:
default:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

@pytest.fixture(scope="session")
def host():
return "localhost:3000"
return "localhost:3001"


def seed_user(host):
Expand Down
8 changes: 8 additions & 0 deletions toxiproxy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"name": "speckle_test_speckle-server",
"listen": "0.0.0.0:3001",
"upstream": "speckle-server:3000",
"enabled": true
}
]