Skip to content

Commit fe26e1b

Browse files
committed
sql_server: enable restart action in zippy tests
1 parent 1c8064c commit fe26e1b

File tree

3 files changed

+42
-7
lines changed

3 files changed

+42
-7
lines changed

misc/python/materialize/mzcompose/service.py

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,39 @@ class ServiceDependency(TypedDict, total=False):
5353
"""Condition under which a dependency is considered satisfied."""
5454

5555

56+
class ServiceDeployResourceLimits(TypedDict, total=False):
57+
"""Resource limits for a service deployment."""
58+
59+
memory: str
60+
"""Memory limit (e.g., '6G', '512M')."""
61+
62+
cpus: str
63+
"""CPU limit (e.g., '0.5', '2')."""
64+
65+
66+
class ServiceDeployResources(TypedDict, total=False):
67+
"""Resource configuration for a service deployment."""
68+
69+
limits: ServiceDeployResourceLimits
70+
"""Resource limits."""
71+
72+
reservations: ServiceDeployResourceLimits
73+
"""Resource reservations."""
74+
75+
76+
class ServiceDeploy(TypedDict, total=False):
77+
"""Deployment configuration for a service."""
78+
79+
resources: ServiceDeployResources
80+
"""Resource configuration."""
81+
82+
replicas: int
83+
"""Number of container replicas to deploy."""
84+
85+
restart_policy: dict[str, Any]
86+
"""Restart policy configuration."""
87+
88+
5689
class ServiceConfig(TypedDict, total=False):
5790
"""The definition of a service in Docker Compose.
5891
@@ -141,11 +174,8 @@ class ServiceConfig(TypedDict, total=False):
141174
TODO(benesch): this should use a nested TypedDict.
142175
"""
143176

144-
deploy: dict[str, dict[str, dict[str, str]]]
145-
"""Additional deployment configuration, like resource limits.
146-
147-
TODO(benesch): this should use a nested TypedDict.
148-
"""
177+
deploy: ServiceDeploy
178+
"""Deployment configuration, including resource limits."""
149179

150180
ulimits: dict[str, Any]
151181
"""Override the default ulimits for a container."""
@@ -178,6 +208,9 @@ class ServiceConfig(TypedDict, total=False):
178208
user: str | None
179209
"""The user for the container."""
180210

211+
cap_add: list[str] | None
212+
"""cap_add specifies additional container capabilities as strings."""
213+
181214

182215
class Service:
183216
"""A Docker Compose service in a `Composition`.

misc/python/materialize/mzcompose/services/sql_server.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ def __init__(
4444
"interval": "1s",
4545
"start_period": "30s",
4646
},
47+
"deploy": {"resources": {"limits": {"memory": "3G"}}},
48+
"cap_add": ["SYS_PTRACE"],
4749
},
4850
)
4951
self.sa_password = sa_password

misc/python/materialize/zippy/scenarios.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
CreateSqlServerTable,
3838
SqlServerDML,
3939
SqlServerStart,
40+
SqlServerRestart,
4041
)
4142
from materialize.zippy.sql_server_cdc_actions import CreateSqlServerCdcTable
4243
from materialize.zippy.mz_actions import (
@@ -252,8 +253,7 @@ def actions_with_weight(self) -> dict[ActionOrFactory, float]:
252253
KillClusterd: 5,
253254
StoragedKill: 5,
254255
StoragedStart: 5,
255-
# TODO: Reenable when database-issues#9624 is fixed
256-
# SqlServerRestart: 10,
256+
SqlServerRestart: 10,
257257
CreateViewParameterized(): 10,
258258
ValidateView: 20,
259259
SqlServerDML: 100,

0 commit comments

Comments
 (0)