Compare commits
8 Commits
2.19.3
...
iain/toxiproxy
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a2651bec1 | |||
| a85e3baaec | |||
| 9dd801a20b | |||
| 62c5114cb3 | |||
| 43a5302a90 | |||
| addaa996ea | |||
| 3b5421a5bc | |||
| 88e8c86fa6 |
+20
-39
@@ -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"
|
||||
####
|
||||
# Testing and development tools
|
||||
#######
|
||||
|
||||
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"
|
||||
|
||||
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:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""This module contains an SDK for working with Speckle Automate."""
|
||||
from speckle_automate import fixtures
|
||||
|
||||
from speckle_automate.automation_context import AutomationContext
|
||||
from speckle_automate.runner import execute_automate_function, run_function
|
||||
from speckle_automate.schema import (
|
||||
@@ -21,5 +21,4 @@ __all__ = [
|
||||
"ObjectResultLevel",
|
||||
"run_function",
|
||||
"execute_automate_function",
|
||||
"fixtures",
|
||||
]
|
||||
|
||||
@@ -290,6 +290,10 @@ class AutomationContext:
|
||||
"""Mark the current run a failure."""
|
||||
self._mark_run(AutomationStatus.FAILED, status_message)
|
||||
|
||||
def mark_run_exception(self, status_message: str) -> None:
|
||||
"""Mark the current run a failure."""
|
||||
self._mark_run(AutomationStatus.EXCEPTION, status_message)
|
||||
|
||||
def mark_run_success(self, status_message: Optional[str]) -> None:
|
||||
"""Mark the current run a success with an optional message."""
|
||||
self._mark_run(AutomationStatus.SUCCEEDED, status_message)
|
||||
|
||||
@@ -132,7 +132,10 @@ def execute_automate_function(
|
||||
|
||||
# if we've gotten this far, the execution should technically be completed as expected
|
||||
# thus exiting with 0 is the schemantically correct thing to do
|
||||
exit(0)
|
||||
exit_code = (
|
||||
1 if automation_context.run_status == AutomationStatus.EXCEPTION else 0
|
||||
)
|
||||
exit(exit_code)
|
||||
|
||||
else:
|
||||
raise NotImplementedError(f"Command: '{command}' is not supported.")
|
||||
@@ -175,6 +178,7 @@ def run_function(
|
||||
if automation_context.run_status not in [
|
||||
AutomationStatus.FAILED,
|
||||
AutomationStatus.SUCCEEDED,
|
||||
AutomationStatus.EXCEPTION,
|
||||
]:
|
||||
automation_context.mark_run_success(
|
||||
"WARNING: Automate assumed a success status,"
|
||||
@@ -183,7 +187,7 @@ def run_function(
|
||||
except Exception:
|
||||
trace = traceback.format_exc()
|
||||
print(trace)
|
||||
automation_context.mark_run_failed(
|
||||
automation_context.mark_run_exception(
|
||||
"Function error. Check the automation run logs for details."
|
||||
)
|
||||
finally:
|
||||
|
||||
@@ -63,6 +63,7 @@ class AutomationStatus(str, Enum):
|
||||
RUNNING = "RUNNING"
|
||||
FAILED = "FAILED"
|
||||
SUCCEEDED = "SUCCEEDED"
|
||||
EXCEPTION = "EXCEPTION"
|
||||
|
||||
|
||||
class ObjectResultLevel(str, Enum):
|
||||
|
||||
@@ -17,7 +17,7 @@ metrics.disable()
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def host():
|
||||
return "localhost:3000"
|
||||
return "localhost:3001"
|
||||
|
||||
|
||||
def seed_user(host):
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"name": "speckle_test_speckle-server",
|
||||
"listen": "0.0.0.0:3001",
|
||||
"upstream": "speckle-server:3000",
|
||||
"enabled": true
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user