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): introduce toxiproxy to integration tests #39

Closed
wants to merge 4 commits into from
Closed
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
22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,28 @@ services:
POSTGRES_DB: "speckle"
ENABLE_MP: "false"

####
# Testing and development tools
#######

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:
name: speckle-server
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public async Task IsFrontEnd2False()
}

/// <remarks>
/// We get ServerInfo from "http://localhost:3000/graphql",
/// Then we mutate the `frontend2` property of ServerInfo by trying to fetch header from "http://localhost:3000/",
/// We get ServerInfo from "http://localhost:3001/graphql",
/// Then we mutate the `frontend2` property of ServerInfo by trying to fetch header from "http://localhost:3001/",
/// This is not doable in local server because there is no end-point on this to ping.
/// This is a bad sign for mutation.
/// </remarks>
Expand Down
2 changes: 1 addition & 1 deletion tests/Speckle.Core.Tests.Integration/Fixtures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void BeforeAll()

public static class Fixtures
{
public static readonly ServerInfo Server = new() { url = "http://localhost:3000", name = "Docker Server" };
public static readonly ServerInfo Server = new() { url = "http://localhost:3001", name = "Docker Server" };

public static Client Unauthed => new Client(new Account { serverInfo = Server, userInfo = new UserInfo() });

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
}
]