@@ -129,7 +129,7 @@ class RestateContainer(DockerContainer):
129129
130130 log_thread : typing .Optional [threading .Thread ] = None
131131
132- def __init__ (self , image , always_replay ):
132+ def __init__ (self , image , always_replay , disable_retries ):
133133 super ().__init__ (image )
134134 self .with_exposed_ports (8080 , 9070 )
135135 self .with_env ('RESTATE_LOG_FILTER' , 'restate=info' )
@@ -143,6 +143,8 @@ def __init__(self, image, always_replay):
143143 else :
144144 self .with_env ('RESTATE_WORKER__INVOKER__INACTIVITY_TIMEOUT' , '10m' )
145145 self .with_env ('RESTATE_WORKER__INVOKER__ABORT_TIMEOUT' , '10m' )
146+ if disable_retries :
147+ self .with_env ('RESTATE_WORKER__INVOKER__RETRY_POLICY__TYPE' , 'none' )
146148
147149 self .with_kwargs (extra_hosts = {"host.docker.internal" : "host-gateway" })
148150
@@ -192,6 +194,7 @@ class TestConfiguration:
192194 restate_image : str = "restatedev/restate:latest"
193195 stream_logs : bool = False
194196 always_replay : bool = False
197+ disable_retries : bool = False
195198
196199
197200class RestateTestHarness :
@@ -213,7 +216,8 @@ def start(self):
213216 self .server = AsgiServer (self .asgi_app , self .bind_address ).start ()
214217 self .restate = RestateContainer (
215218 image = self .config .restate_image ,
216- always_replay = self .config .always_replay ) \
219+ always_replay = self .config .always_replay ,
220+ disable_retries = self .config .disable_retries ) \
217221 .start (self .config .stream_logs )
218222 try :
219223 self ._register_sdk ()
@@ -263,7 +267,8 @@ def __exit__(self, exc_type, exc_value, traceback):
263267def test_harness (app ,
264268 follow_logs : bool = False ,
265269 restate_image : str = "restatedev/restate:latest" ,
266- always_replay : bool = False ) -> RestateTestHarness :
270+ always_replay : bool = False ,
271+ disable_retries : bool = False ) -> RestateTestHarness :
267272 """
268273 Creates a test harness for running Restate services together with restate-server.
269274
@@ -274,12 +279,14 @@ def test_harness(app,
274279 :param always_replay: When True, this forces restate-server to always replay
275280 on a suspension point. This is useful to hunt non deterministic bugs
276281 that might prevent your code to replay correctly (default is False).
282+ :param disable_retries: When True, retries are disabled (default is False).
277283 :return: An instance of RestateTestHarness initialized with the provided app and configuration.
278284 :rtype: RestateTestHarness
279285 """
280286 config = TestConfiguration (
281287 restate_image = restate_image ,
282288 stream_logs = follow_logs ,
283- always_replay = always_replay
289+ always_replay = always_replay ,
290+ disable_retries = disable_retries
284291 )
285292 return RestateTestHarness (app , config )
0 commit comments