Skip to content
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
15 changes: 1 addition & 14 deletions samcli/local/docker/durable_functions_emulator_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ class DurableFunctionsEmulatorContainer:
"""
ENV_STORE_TYPE = "DURABLE_EXECUTIONS_STORE_TYPE"

"""
Allow overriding the timescale used by the emulator. For example, if you have
a context.wait(3 months), you probably don't want to actually wait 3 months in
a local development loop. This lets you override that!
"""
ENV_TIME_SCALE = "DURABLE_EXECUTIONS_TIME_SCALE"

"""
Capture the logs from the emulator on cleanup - this can be useful for debugging
what happened, since once the container is gone, the logs are too.
Expand Down Expand Up @@ -153,10 +146,6 @@ def _get_emulator_store_type(self):
LOG.debug(f"Creating durable functions emulator container with store type: {store_type}")
return store_type

def _get_emulator_time_scale(self):
"""Get the execution time scale from environment variable or use default timescale of 1."""
return os.environ.get(self.ENV_TIME_SCALE, "1")

def _get_emulator_data_dir(self):
"""Get the path to the emulator data directory."""
return os.path.join(os.getcwd(), self._EMULATOR_DATA_DIR_NAME)
Expand All @@ -181,9 +170,7 @@ def _get_emulator_environment(self):
"""
Get the environment variables for the emulator container.
"""
return {
"DURABLE_EXECUTION_TIME_SCALE": self._get_emulator_time_scale(),
}
return {}

@property
def _docker_client(self) -> docker.DockerClient:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,21 +300,18 @@ def test_binary_selection_by_architecture(self, arch, expected_binary, mock_get_

@parameterized.expand(
[
# (name, env_vars, expected_port, expected_store, expected_scale)
("default_config", {}, 9014, "sqlite", "1"),
("custom_port", {"DURABLE_EXECUTIONS_EMULATOR_PORT": "9999"}, 9999, "sqlite", "1"),
("filesystem_store", {"DURABLE_EXECUTIONS_STORE_TYPE": "filesystem"}, 9014, "filesystem", "1"),
("custom_time_scale", {"DURABLE_EXECUTIONS_TIME_SCALE": "0.5"}, 9014, "sqlite", "0.5"),
# (name, env_vars, expected_port, expected_store)
("default_config", {}, 9014, "sqlite"),
("custom_port", {"DURABLE_EXECUTIONS_EMULATOR_PORT": "9999"}, 9999, "sqlite"),
("filesystem_store", {"DURABLE_EXECUTIONS_STORE_TYPE": "filesystem"}, 9014, "filesystem"),
(
"all_custom",
{
"DURABLE_EXECUTIONS_EMULATOR_PORT": "8888",
"DURABLE_EXECUTIONS_STORE_TYPE": "filesystem",
"DURABLE_EXECUTIONS_TIME_SCALE": "2.0",
},
8888,
"filesystem",
"2.0",
),
]
)
Expand All @@ -329,7 +326,6 @@ def test_create_container(
env_vars,
expected_port,
expected_store,
expected_scale,
mock_path_exists,
mock_getcwd,
mock_makedirs,
Expand Down Expand Up @@ -364,7 +360,7 @@ def test_create_container(

# Verify environment variables
environment = call_args.kwargs["environment"]
self.assertEqual(environment["DURABLE_EXECUTION_TIME_SCALE"], expected_scale)
self.assertEqual(environment, {})

# Verify volumes
volumes = call_args.kwargs["volumes"]
Expand Down
Loading