From c27c3dad44a2983629968a3d901e9e2db6c7d0d9 Mon Sep 17 00:00:00 2001 From: shegazyy Date: Tue, 15 Sep 2026 16:44:28 +0300 Subject: [PATCH] Use milliseconds directly in launch manager config schema Rename the 8 user-facing timing fields in launch_manager.schema.json from seconds (number) to their _ms equivalents (integer), matching the flatbuffer schema migration done in #388: - reporting_cycle -> reporting_cycle_ms - polling_interval -> polling_interval_ms - delay_before_restart -> delay_before_restart_ms - ready_timeout -> ready_timeout_ms - shutdown_timeout -> shutdown_timeout_ms - transition_timeout -> transition_timeout_ms - evaluation_cycle -> evaluation_cycle_ms - max_timeout -> max_timeout_ms Remove the now-redundant sec_to_ms() conversion (and its validation) from lifecycle_config.py, since the JSON schema's type/minimum/maximum constraints already reject negative, non-integer and overflowing values. Update all example configs, integration test fixtures, the gen_lifecycle_config.py test helper, and documentation to use the new field names and millisecond values. This was previously postponed pending removal of legacy config support, which has since happened in #388. Closes #635 --- .../lifecycle_demo_test.json | 12 +- .../known_limitations.rst | 6 +- .../docs/user_guide/configuration.rst | 44 ++-- .../alive_supervision_defaults.json | 4 +- .../component_properties_defaults.json | 2 +- .../deployment_config_defaults.json | 6 +- .../default_values/run_target_defaults.json | 2 +- .../user_guide/examples/example_conf.json | 61 +++--- .../docs/user_guide/implementation.rst | 4 +- .../config_schema/launch_manager.schema.json | 73 ++++--- .../src/configuration/details/lm_flatcfg.fbs | 4 +- .../details/process_info_node.hpp | 2 +- .../process_group_manager.hpp | 2 +- scripts/config_mapping/lifecycle_config.py | 82 +++----- .../input/lm_config.json | 2 +- .../expected_output/lm_config_gen.json | 8 +- .../full_config_test/input/lm_config.json | 40 ++-- .../tests/smoke_test/input/lm_config.json | 20 +- scripts/config_mapping/unit_tests.py | 193 ++++++++++-------- .../complex_monitoring.json | 8 +- .../crash_ignores_dependents.json | 16 +- .../crash_on_startup/crash_on_startup.json | 6 +- .../fallback_to_same_target_restarts.json | 12 +- .../non_reporting_config.json | 9 +- .../lm_shutdown_during_rt_switch.json | 14 +- .../lm_shutdown_during_switch_to_off.json | 14 +- .../lm_shutdown_during_switch_to_off.py | 6 +- .../parallel_launch/parallel_launch.json | 4 +- .../process_complex_rep_failure.json | 20 +- .../process_crash_monitoring.json | 12 +- .../process_fd_leak/process_fd_leak.json | 8 +- .../process_launch_args.json | 8 +- .../process_simple_rep_failure.json | 20 +- .../process_wrong_binary_failure.json | 16 +- .../exists/ready_condition_file.json | 29 ++- .../ready_condition_file_not_existing.json | 27 ++- .../rt_running_when_process_exits.json | 18 +- .../sandbox_options/sandbox_options.json | 20 +- .../shutdown_signal/shutdown_signal.json | 10 +- .../smoke/lifecycle_smoketest.json | 13 +- .../switch_run_target/switch_run_target.json | 8 +- tests/scripts/gen_lifecycle_config.py | 12 +- .../process_hanging_on_sigterm.cpp | 2 +- 43 files changed, 461 insertions(+), 418 deletions(-) diff --git a/examples/demo_verification/lifecycle_demo_test.json b/examples/demo_verification/lifecycle_demo_test.json index 0ad84cdb46..69972cd567 100644 --- a/examples/demo_verification/lifecycle_demo_test.json +++ b/examples/demo_verification/lifecycle_demo_test.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/examples", - "ready_timeout": 2.0, - "shutdown_timeout": 2.0, + "ready_timeout_ms": 2000, + "shutdown_timeout_ms": 2000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -30,7 +30,7 @@ "application_type": "Reporting", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 3, "failed_cycles_tolerance": 1 @@ -53,8 +53,8 @@ } }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "control_daemon" } @@ -147,7 +147,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [ diff --git a/score/launch_manager/docs/product_documentation/known_limitations.rst b/score/launch_manager/docs/product_documentation/known_limitations.rst index 2f57701f86..f1f7b8ec7f 100644 --- a/score/launch_manager/docs/product_documentation/known_limitations.rst +++ b/score/launch_manager/docs/product_documentation/known_limitations.rst @@ -26,19 +26,19 @@ Component * For ReadyCondition ``process_state:Terminated``, the mapping is only supported for Components that have at least one Component depending on it. * The ``ready_recovery_action`` only supports the RecoveryAction of type - ``restart``. The parameter ``delay_before_restart`` is currently not + ``restart``. The parameter ``delay_before_restart_ms`` is currently not supported and is ignored. Setting it to a non-zero value will have no effect and the component will be restarted immediately. * The ``recovery_action`` only supports ``switch_run_target`` with the ``run_target`` set to ``fallback_run_target``. -* The ``ready_timeout`` is used as the timeout until process state Running is +* The ``ready_timeout_ms`` is used as the timeout until process state Running is reached, even in case the ReadyCondition is ``process_state:Terminated``. Run target ---------- -* The parameter ``run_targets//transition_timeout`` is currently not +* The parameter ``run_targets//transition_timeout_ms`` is currently not supported and is ignored. * The ``recovery_action`` only supports ``switch_run_target`` with the ``run_target`` set to ``fallback_run_target``. diff --git a/score/launch_manager/docs/user_guide/configuration.rst b/score/launch_manager/docs/user_guide/configuration.rst index 82026d069e..a57d23088a 100644 --- a/score/launch_manager/docs/user_guide/configuration.rst +++ b/score/launch_manager/docs/user_guide/configuration.rst @@ -83,8 +83,8 @@ alive_supervision (object) **Properties:** -* **evaluation_cycle** (number, optional) - * **Description:** Specifies the length, in seconds (e.g., ``0.5`` for 500 milliseconds), of the time window used by the **Launch Manager** to assess incoming alive supervision reports from components. +* **evaluation_cycle_ms** (integer, optional) + * **Description:** Specifies the length, in milliseconds, of the time window used by the **Launch Manager** to assess incoming alive supervision reports from components. * **Constraint:** Must be greater than 0. .. _lm_conf_watchdog_object_: @@ -99,8 +99,8 @@ watchdog (object) * **device_file_path** (string, optional) * **Description:** Specifies the absolute path to the external watchdog device file (e.g., ``/dev/watchdog``). -* **max_timeout** (number, optional) - * **Description:** Specifies the maximum timeout value, in seconds (e.g., ``0.5`` for 500 milliseconds), that the **Launch Manager** configures on the external watchdog during startup. The external watchdog uses this timeout as the deadline for receiving periodic alive reports from the **Launch Manager**. +* **max_timeout_ms** (integer, optional) + * **Description:** Specifies the maximum timeout value, in milliseconds, that the **Launch Manager** configures on the external watchdog during startup. The external watchdog uses this timeout as the deadline for receiving periodic alive reports from the **Launch Manager**. * **Constraint:** Must be 0 or greater. * **deactivate_on_shutdown** (boolean, optional) * **Description:** Specifies whether the **Launch Manager** disables the external watchdog during shutdown. When set to ``true``, the watchdog is deactivated; when ``false``, it remains active, potentially triggering a reset if the shutdown is prolonged. @@ -123,8 +123,8 @@ recovery_action (object) * **number_of_attempts** (integer, optional) * **Description:** Specifies the maximum number of restart attempts before the **Launch Manager** concludes that recovery cannot succeed for the component. * **Constraint:** Must be 0 or greater. - * **delay_before_restart** (number, optional) - * **Description:** Specifies the delay duration, in seconds (e.g., ``0.25`` for 250 milliseconds), that the **Launch Manager** waits before initiating a restart attempt. + * **delay_before_restart_ms** (integer, optional) + * **Description:** Specifies the delay duration, in milliseconds, that the **Launch Manager** waits before initiating a restart attempt. * **Constraint:** Must be 0 or greater. * **switch_run_target** (object, optional) * **Description:** Defines a recovery action that switches to a different **Run Target**. This can be a new **Run Target** or the current one to retry its activation. @@ -147,8 +147,8 @@ run_target (object) * **depends_on** (array of strings, optional) * **Description:** Specifies the names of components and other **Run Targets** that must be successfully activated when this **Run Target** is activated. This defines the dependencies for a given operational mode. * **Items:** Each item is a string specifying the name of a component or **Run Target** on which this **Run Target** depends. -* **transition_timeout** (number, optional) - * **Description:** Specifies the time limit, in seconds (e.g., ``1.5`` for 1500 milliseconds), for the **Run Target** transition to complete. If this limit is exceeded, the transition is considered failed. +* **transition_timeout_ms** (integer, optional) + * **Description:** Specifies the time limit, in milliseconds, for the **Run Target** transition to complete. If this limit is exceeded, the transition is considered failed. * **Constraint:** Must be greater than 0. * **recovery_action** (object, optional) * **Description:** Specifies the recovery action to execute when a component assigned to this **Run Target** fails. This action is limited to ``switch_run_target`` operations. @@ -182,17 +182,17 @@ component_properties (object) * **Description:** Defines the configuration parameters used for monitoring the "aliveness" of the component. * **Reference:** This property refers to the ``alive_supervision`` reusable type defined in this schema. * **Properties:** (These properties are also inherited from ``alive_supervision`` but are listed here for quick reference and clarity on the local context.) - * **reporting_cycle** (number, optional) - * **Description:** Specifies the duration, in seconds (e.g., ``0.5`` for 500 milliseconds), of the time interval used to verify that the component sends alive notifications within the expected time frame. + * **reporting_cycle_ms** (integer, optional) + * **Description:** Specifies the duration, in milliseconds, of the time interval used to verify that the component sends alive notifications within the expected time frame. * **Constraint:** Must be greater than 0. * **failed_cycles_tolerance** (integer, optional) * **Description:** Specifies the maximum number of consecutive reporting cycle failures. Once the number of failed cycles exceeds this maximum, the **Launch Manager** will trigger the configured recovery action. * **Constraint:** Must be 0 or greater. * **min_indications** (integer, optional) - * **Description:** Specifies the minimum number of checkpoints that must be reported within each configured ``reporting_cycle``. + * **Description:** Specifies the minimum number of checkpoints that must be reported within each configured ``reporting_cycle_ms``. * **Constraint:** Must be 0 or greater. * **max_indications** (integer, optional) - * **Description:** Specifies the maximum number of checkpoints that may be reported within each configured ``reporting_cycle``. + * **Description:** Specifies the maximum number of checkpoints that may be reported within each configured ``reporting_cycle_ms``. * **Constraint:** Must be 0 or greater. * **depends_on** (array of strings, optional) * **Description:** Specifies the names of components that this component depends on. Each specified dependency must be initialized and reach its **Ready State** before the **Launch Manager** will start this component. This ensures proper startup order. @@ -219,10 +219,10 @@ component_properties (object) * ``"Exists"``: The component is ready when the file at ``file_path`` exists. * ``"NotExisting"``: The component is ready when the file at ``file_path`` does not exist. * **Default:** ``"Exists"`` - * **polling_interval** (number, optional) - * **Description:** Specifies the time interval, in seconds (e.g., ``0.3`` for 300 milliseconds), at which the **Launch Manager** checks the file existence state. + * **polling_interval_ms** (integer, optional) + * **Description:** Specifies the time interval, in milliseconds, at which the **Launch Manager** checks the file existence state. * **Constraint:** Must be greater than 0. - * **Default:** ``0.01`` + * **Default:** ``10`` .. _lm_conf_deployment_config_object_: @@ -235,11 +235,11 @@ deployment_config (object) **Properties:** -* **ready_timeout** (number, optional) - * **Description:** Specifies the maximum time, in seconds (e.g., ``0.25`` for 250 milliseconds), allowed for the component to reach its **Ready State**. The timeout is measured from when the component's process is created until the ready conditions specified in ``component_properties.ready_condition`` are met. +* **ready_timeout_ms** (integer, optional) + * **Description:** Specifies the maximum time, in milliseconds, allowed for the component to reach its **Ready State**. The timeout is measured from when the component's process is created until the ready conditions specified in ``component_properties.ready_condition`` are met. * **Constraint:** Must be greater than 0. -* **shutdown_timeout** (number, optional) - * **Description:** Specifies the maximum time, in seconds (e.g., ``0.75`` for 750 milliseconds), allowed for the component to terminate after it receives a SIGTERM signal from the **Launch Manager**. The timeout is measured from when the **Launch Manager** sends the SIGTERM signal until the operating system notifies the **Launch Manager** that the child process has terminated. +* **shutdown_timeout_ms** (integer, optional) + * **Description:** Specifies the maximum time, in milliseconds, allowed for the component to terminate after it receives a SIGTERM signal from the **Launch Manager**. The timeout is measured from when the **Launch Manager** sends the SIGTERM signal until the operating system notifies the **Launch Manager** that the child process has terminated. * **Constraint:** Must be greater than 0. * **environmental_variables** (object, optional) * **Description:** Defines the set of environment variables passed to the component at startup. @@ -249,7 +249,7 @@ deployment_config (object) * **working_dir** (string, optional) * **Description:** Specifies the directory to be used as the working directory for the component during execution. If not defined, the binary's directory (``bin_dir``) is used as the working directory by default. * **ready_recovery_action** (object, optional) - * **Description:** Specifies the recovery action to execute when the component fails to reach its **Ready State** within the configured ``ready_timeout``. This action is limited to ``restart`` operations. + * **Description:** Specifies the recovery action to execute when the component fails to reach its **Ready State** within the configured ``ready_timeout_ms``. This action is limited to ``restart`` operations. * **Reference:** This property refers to the ``recovery_action`` reusable type defined in this schema, specifically enforcing the ``restart`` option. * **recovery_action** (object, optional) * **Description:** Specifies the recovery action to execute when the component malfunctions after successfully reaching its **Ready State**. This action is limited to ``switch_run_target`` operations. @@ -400,8 +400,8 @@ fallback_run_target (object, optional) * **depends_on** (array of strings, required) * **Description:** Specifies the names of components and **Run Targets** that must be activated when this fallback **Run Target** is activated. * **Items:** Each item is a string specifying the name of a component or **Run Target** upon which this **Run Target** depends. -* **transition_timeout** (number, optional) - * **Description:** Specifies the time limit, in seconds (e.g., ``1.5`` for 1500 milliseconds), for the **Run Target** transition. If this limit is exceeded, the transition is considered failed. +* **transition_timeout_ms** (integer, optional) + * **Description:** Specifies the time limit, in milliseconds, for the **Run Target** transition. If this limit is exceeded, the transition is considered failed. * **Constraint:** Must be greater than 0. .. _lm_conf_alive_supervision_object_optional_: diff --git a/score/launch_manager/docs/user_guide/default_values/alive_supervision_defaults.json b/score/launch_manager/docs/user_guide/default_values/alive_supervision_defaults.json index b04c8d658b..899dcbcdb7 100755 --- a/score/launch_manager/docs/user_guide/default_values/alive_supervision_defaults.json +++ b/score/launch_manager/docs/user_guide/default_values/alive_supervision_defaults.json @@ -1,5 +1,5 @@ { - "alive_supervision" : { - "evaluation_cycle": 0.5 + "alive_supervision": { + "evaluation_cycle_ms": 500 } } diff --git a/score/launch_manager/docs/user_guide/default_values/component_properties_defaults.json b/score/launch_manager/docs/user_guide/default_values/component_properties_defaults.json index a828c5e16a..769c6a969a 100755 --- a/score/launch_manager/docs/user_guide/default_values/component_properties_defaults.json +++ b/score/launch_manager/docs/user_guide/default_values/component_properties_defaults.json @@ -5,7 +5,7 @@ "application_type": "Reporting_And_Supervised", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.5, + "reporting_cycle_ms": 500, "failed_cycles_tolerance": 2, "min_indications": 1, "max_indications": 3 diff --git a/score/launch_manager/docs/user_guide/default_values/deployment_config_defaults.json b/score/launch_manager/docs/user_guide/default_values/deployment_config_defaults.json index f67f977e3a..fd1cae1d74 100755 --- a/score/launch_manager/docs/user_guide/default_values/deployment_config_defaults.json +++ b/score/launch_manager/docs/user_guide/default_values/deployment_config_defaults.json @@ -1,14 +1,14 @@ { "deployment_config": { - "ready_timeout": 0.5, - "shutdown_timeout": 0.5, + "ready_timeout_ms": 500, + "shutdown_timeout_ms": 500, "environmental_variables": {}, "bin_dir": "/opt", "working_dir": "/tmp", "ready_recovery_action": { "restart": { "number_of_attempts": 0, - "delay_before_restart": 0 + "delay_before_restart_ms": 0 } }, "recovery_action": { diff --git a/score/launch_manager/docs/user_guide/default_values/run_target_defaults.json b/score/launch_manager/docs/user_guide/default_values/run_target_defaults.json index dcf13dac04..35f83db834 100755 --- a/score/launch_manager/docs/user_guide/default_values/run_target_defaults.json +++ b/score/launch_manager/docs/user_guide/default_values/run_target_defaults.json @@ -2,7 +2,7 @@ "run_target": { "description": "", "depends_on": [], - "transition_timeout": 3, + "transition_timeout_ms": 3000, "recovery_action": { "switch_run_target": { "run_target": "fallback_run_target" diff --git a/score/launch_manager/docs/user_guide/examples/example_conf.json b/score/launch_manager/docs/user_guide/examples/example_conf.json index ddb3bc7a96..bbd8f5ee33 100755 --- a/score/launch_manager/docs/user_guide/examples/example_conf.json +++ b/score/launch_manager/docs/user_guide/examples/example_conf.json @@ -2,8 +2,8 @@ "schema_version": 1, "defaults": { "deployment_config": { - "ready_timeout": 0.5, - "shutdown_timeout": 0.5, + "ready_timeout_ms": 500, + "shutdown_timeout_ms": 500, "environmental_variables": { "LD_LIBRARY_PATH": "/opt/lib" }, @@ -12,7 +12,7 @@ "ready_recovery_action": { "restart": { "number_of_attempts": 0, - "delay_before_restart": 0 + "delay_before_restart_ms": 0 } }, "recovery_action": { @@ -33,7 +33,7 @@ "application_type": "Reporting_And_Supervised", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.5, + "reporting_cycle_ms": 500, "failed_cycles_tolerance": 2, "min_indications": 1, "max_indications": 3 @@ -47,14 +47,14 @@ }, "run_target": { "depends_on": [], - "transition_timeout": 5 + "transition_timeout_ms": 5000 }, - "alive_supervision" : { - "evaluation_cycle": 0.5 + "alive_supervision": { + "evaluation_cycle_ms": 500 }, "watchdog": { "device_file_path": "/dev/watchdog", - "max_timeout": 2.0, + "max_timeout_ms": 2000, "deactivate_on_shutdown": true, "require_magic_close": false } @@ -68,7 +68,10 @@ "application_type": "Native", "is_self_terminating": true }, - "process_arguments": ["-a", "-b"], + "process_arguments": [ + "-a", + "-b" + ], "ready_condition": { "process_state": "Terminated" } @@ -84,10 +87,12 @@ "application_profile": { "application_type": "Native" }, - "depends_on": ["setup_filesystem_sh"] + "depends_on": [ + "setup_filesystem_sh" + ] }, "deployment_config": { - "bin_dir" : "/opt/apps/dlt-daemon" + "bin_dir": "/opt/apps/dlt-daemon" } }, "someip-daemon": { @@ -96,17 +101,20 @@ "binary_name": "someipd" }, "deployment_config": { - "bin_dir" : "/opt/apps/someip" + "bin_dir": "/opt/apps/someip" } }, "test_app1": { "description": "Simple test application", "component_properties": { "binary_name": "test_app1", - "depends_on": ["dlt-daemon", "someip-daemon"] + "depends_on": [ + "dlt-daemon", + "someip-daemon" + ] }, "deployment_config": { - "bin_dir" : "/opt/apps/test_app1" + "bin_dir": "/opt/apps/test_app1" } }, "state_manager": { @@ -116,17 +124,21 @@ "application_profile": { "application_type": "State_Manager" }, - "depends_on": ["setup_filesystem_sh"] + "depends_on": [ + "setup_filesystem_sh" + ] }, "deployment_config": { - "bin_dir" : "/opt/apps/state_manager" + "bin_dir": "/opt/apps/state_manager" } } }, "run_targets": { "Minimal": { "description": "Minimal functionality of the system", - "depends_on": ["state_manager"], + "depends_on": [ + "state_manager" + ], "recovery_action": { "switch_run_target": { "run_target": "Off" @@ -135,8 +147,11 @@ }, "Full": { "description": "Everything running", - "depends_on": ["test_app1", "Minimal"], - "transition_timeout": 5, + "depends_on": [ + "test_app1", + "Minimal" + ], + "transition_timeout_ms": 5000, "recovery_action": { "switch_run_target": { "run_target": "Minimal" @@ -152,18 +167,18 @@ } } }, - "alive_supervision" : { - "evaluation_cycle": 0.5 + "alive_supervision": { + "evaluation_cycle_ms": 500 }, "fallback_run_target": { "description": "Switching off everything", "depends_on": [], - "transition_timeout": 1.5 + "transition_timeout_ms": 1500 }, "initial_run_target": "Minimal", "watchdog": { "device_file_path": "/dev/watchdog", - "max_timeout": 2, + "max_timeout_ms": 2000, "deactivate_on_shutdown": true, "require_magic_close": false } diff --git a/score/launch_manager/docs/user_guide/implementation.rst b/score/launch_manager/docs/user_guide/implementation.rst index b376ea9b1f..3a1c0c3f3d 100644 --- a/score/launch_manager/docs/user_guide/implementation.rst +++ b/score/launch_manager/docs/user_guide/implementation.rst @@ -23,7 +23,7 @@ started successfully by calling the lifecycle API for the language it is implemented in. This is done by reporting the ``kRunning`` execution state. -A ``ready_timeout`` can be configured for each component. If the +A ``ready_timeout_ms`` can be configured for each component. If the process does not report ``kRunning`` within that timeout, the Launch Manager terminates the process and registers an error. @@ -40,7 +40,7 @@ a ``SIGTERM`` signal by ending ongoing tasks, freeing resources and exiting. If a process does not terminate after receiving a ``SIGTERM``, and a -``shutdown_timeout`` is configured, then after the timeout is fired a +``shutdown_timeout_ms`` is configured, then after the timeout is fired a ``SIGKILL`` is sent and the process is forcefully terminated. State Management diff --git a/score/launch_manager/src/daemon/src/configuration/config_schema/launch_manager.schema.json b/score/launch_manager/src/daemon/src/configuration/config_schema/launch_manager.schema.json index 98b598d8fe..858d6ab447 100644 --- a/score/launch_manager/src/daemon/src/configuration/config_schema/launch_manager.schema.json +++ b/score/launch_manager/src/daemon/src/configuration/config_schema/launch_manager.schema.json @@ -34,25 +34,26 @@ "type": "object", "description": "Defines the configuration parameters used for alive monitoring of the component.", "properties": { - "reporting_cycle": { - "type": "number", + "reporting_cycle_ms": { + "type": "integer", "exclusiveMinimum": 0, - "description": "Specifies the duration, in seconds (e.g., '0.5' for 500 milliseconds), of the time interval used to verify that the component sends alive notifications within the expected time frame." + "maximum": 4294967295, + "description": "Specifies the duration, in milliseconds, of the time interval used to verify that the component sends alive notifications within the expected time frame." }, "failed_cycles_tolerance": { "type": "integer", "minimum": 0, - "description": "Specifies the maximum number of consecutive reporting cycle failures (see 'reporting_cycle'). Once the number of failed cycles exceeds this maximum, the Launch Manager will trigger the configured recovery action." + "description": "Specifies the maximum number of consecutive reporting cycle failures (see 'reporting_cycle_ms'). Once the number of failed cycles exceeds this maximum, the Launch Manager will trigger the configured recovery action." }, "min_indications": { "type": "integer", "minimum": 0, - "description": "Specifies the minimum number of checkpoints that must be reported within each configured 'reporting_cycle'." + "description": "Specifies the minimum number of checkpoints that must be reported within each configured 'reporting_cycle_ms'." }, "max_indications": { "type": "integer", "minimum": 0, - "description": "Specifies the maximum number of checkpoints that may be reported within each configured 'reporting_cycle'." + "description": "Specifies the maximum number of checkpoints that may be reported within each configured 'reporting_cycle_ms'." } }, "required": [], @@ -107,10 +108,11 @@ ], "description": "Specifies the required existence of the file. 'Exists': the file must be present at 'file_path'. 'NotExisting': the file must be absent from 'file_path'. Defaults to 'Exists' if not specified." }, - "polling_interval": { - "type": "number", + "polling_interval_ms": { + "type": "integer", "exclusiveMinimum": 0, - "description": "Specifies the time interval, in seconds (e.g., '0.3' for 300 milliseconds), at which the Launch Manager checks the file existence. Defaults to 10 milliseconds." + "maximum": 4294967295, + "description": "Specifies the time interval, in milliseconds, at which the Launch Manager checks the file existence. Defaults to 10 milliseconds." } }, "required": [ @@ -150,10 +152,11 @@ "minimum": 0, "description": "Specifies the maximum number of restart attempts before the Launch Manager concludes that recovery cannot succeed." }, - "delay_before_restart": { - "type": "number", + "delay_before_restart_ms": { + "type": "integer", "minimum": 0, - "description": "Specifies the delay duration, in seconds (e.g., '0.25' for 250 milliseconds), that the Launch Manager waits before initiating a restart attempt." + "maximum": 4294967295, + "description": "Specifies the delay duration, in milliseconds, that the Launch Manager waits before initiating a restart attempt." } }, "required": [], @@ -190,15 +193,17 @@ "type": "object", "description": "Defines a reusable type that contains configuration parameters that are specific to a particular deployment environment or system setup.", "properties": { - "ready_timeout": { - "type": "number", + "ready_timeout_ms": { + "type": "integer", "exclusiveMinimum": 0, - "description": "Specifies the maximum time, in seconds (e.g., '0.25' for 250 milliseconds), allowed for the component to reach its ready state. The timeout is measured from when the component process is created until the ready conditions specified in 'component_properties.ready_condition' are met." + "maximum": 4294967295, + "description": "Specifies the maximum time, in milliseconds, allowed for the component to reach its ready state. The timeout is measured from when the component process is created until the ready conditions specified in 'component_properties.ready_condition' are met." }, - "shutdown_timeout": { - "type": "number", + "shutdown_timeout_ms": { + "type": "integer", "exclusiveMinimum": 0, - "description": "Specifies the maximum time, in seconds (e.g., '0.75' for 750 milliseconds), allowed for the component to terminate after it receives a SIGTERM signal from the Launch Manager. The timeout is measured from when the Launch Manager sends the SIGTERM signal until the Operating System notifies the Launch Manager that the child process has terminated." + "maximum": 4294967295, + "description": "Specifies the maximum time, in milliseconds, allowed for the component to terminate after it receives a SIGTERM signal from the Launch Manager. The timeout is measured from when the Launch Manager sends the SIGTERM signal until the Operating System notifies the Launch Manager that the child process has terminated." }, "environmental_variables": { "type": "object", @@ -338,10 +343,11 @@ "description": "Specifies the name of a component or Run Target that this Run Target depends on." } }, - "transition_timeout": { - "type": "number", - "description": "Specifies the time limit, in seconds (e.g., '1.5' for 1500 milliseconds), for the Run Target transition. If this limit is exceeded, the transition is considered failed.", - "exclusiveMinimum": 0 + "transition_timeout_ms": { + "type": "integer", + "description": "Specifies the time limit, in milliseconds, for the Run Target transition. If this limit is exceeded, the transition is considered failed.", + "exclusiveMinimum": 0, + "maximum": 4294967295 }, "recovery_action": { "allOf": [ @@ -372,10 +378,11 @@ "type": "object", "description": "Defines a reusable type that contains configuration parameters for alive supervision.", "properties": { - "evaluation_cycle": { - "type": "number", + "evaluation_cycle_ms": { + "type": "integer", "exclusiveMinimum": 0, - "description": "Specifies the length, in seconds (e.g., '0.5' for 500 milliseconds), of the time window used to assess incoming alive supervision reports." + "maximum": 4294967295, + "description": "Specifies the length, in milliseconds, of the time window used to assess incoming alive supervision reports." } }, "required": [], @@ -389,10 +396,11 @@ "type": "string", "description": "Specifies the path to the external watchdog device file (e.g., /dev/watchdog)." }, - "max_timeout": { - "type": "number", + "max_timeout_ms": { + "type": "integer", "minimum": 0, - "description": "Specifies the maximum timeout value, in seconds (e.g., '0.5' for 500 milliseconds), that the Launch Manager configures on the external watchdog during startup. The external watchdog uses this timeout as the deadline for receiving periodic alive reports from the Launch Manager." + "maximum": 4294967295, + "description": "Specifies the maximum timeout value, in milliseconds, that the Launch Manager configures on the external watchdog during startup. The external watchdog uses this timeout as the deadline for receiving periodic alive reports from the Launch Manager." }, "deactivate_on_shutdown": { "type": "boolean", @@ -502,10 +510,11 @@ "description": "Specifies the name of a component or Run Target that this Run Target depends on." } }, - "transition_timeout": { - "type": "number", - "description": "Specifies the time limit, in seconds (e.g., '1.5' for 1500 milliseconds), for the Run Target transition. If this limit is exceeded, the transition is considered failed.", - "exclusiveMinimum": 0 + "transition_timeout_ms": { + "type": "integer", + "description": "Specifies the time limit, in milliseconds, for the Run Target transition. If this limit is exceeded, the transition is considered failed.", + "exclusiveMinimum": 0, + "maximum": 4294967295 } }, "required": [ diff --git a/score/launch_manager/src/daemon/src/configuration/details/lm_flatcfg.fbs b/score/launch_manager/src/daemon/src/configuration/details/lm_flatcfg.fbs index a9cfbc3ab3..9e0a1e0ef8 100644 --- a/score/launch_manager/src/daemon/src/configuration/details/lm_flatcfg.fbs +++ b/score/launch_manager/src/daemon/src/configuration/details/lm_flatcfg.fbs @@ -45,9 +45,9 @@ table ComponentAliveSupervision { reporting_cycle_ms:uint32 = null; // required // Maximum number of consecutive reporting cycle failures before recovery is triggered. failed_cycles_tolerance:uint32 = null; // required - // Minimum number of checkpoints that must be reported within each reporting_cycle. + // Minimum number of checkpoints that must be reported within each reporting_cycle_ms. min_indications:uint32 = null; // optional - // Maximum number of checkpoints that may be reported within each reporting_cycle. + // Maximum number of checkpoints that may be reported within each reporting_cycle_ms. max_indications:uint32 = null; // optional } diff --git a/score/launch_manager/src/daemon/src/process_group_manager/details/process_info_node.hpp b/score/launch_manager/src/daemon/src/process_group_manager/details/process_info_node.hpp index b134076505..981193d73b 100644 --- a/score/launch_manager/src/daemon/src/process_group_manager/details/process_info_node.hpp +++ b/score/launch_manager/src/daemon/src/process_group_manager/details/process_info_node.hpp @@ -95,7 +95,7 @@ class ProcessInfoNode final : public IComponent /// @return The current state of this process. [[nodiscard]] score::mw::lifecycle::ProcessState getState() const; - /// @return The configured shutdown_timeout for this process, or zero + /// @return The configured shutdown_timeout_ms for this process, or zero std::chrono::milliseconds getTerminationTimeout() const; /// @return The ControlClientChannel for this process, or nullptr if none exists. diff --git a/score/launch_manager/src/daemon/src/process_group_manager/process_group_manager.hpp b/score/launch_manager/src/daemon/src/process_group_manager/process_group_manager.hpp index 6ff11364db..3e024100b3 100644 --- a/score/launch_manager/src/daemon/src/process_group_manager/process_group_manager.hpp +++ b/score/launch_manager/src/daemon/src/process_group_manager/process_group_manager.hpp @@ -243,7 +243,7 @@ class ProcessGroupManager final : public ITransitionResultPublisher /// @details cancel any Graph for a process group not in the "Off" state, wait for up to 2 seconds for all graphs /// to be no longer in the `kCancelled` state, start a transition of remaining process groups to "Off" state, /// and finally wait for all graphs to complete. The final wait is bounded by the largest configured per-process - /// shutdown_timeout (plus the SIGKILL grace) so each component's individual shutdown_timeout is respected. + /// shutdown_timeout_ms (plus the SIGKILL grace) so each component's individual shutdown_timeout_ms is respected. /// @warning Side effect: Depending if it is needed to forcefully terminate processes, worker jobs might be stopped /// after this call void allProcessGroupsOff(); diff --git a/scripts/config_mapping/lifecycle_config.py b/scripts/config_mapping/lifecycle_config.py index eaa39177e0..4be32df4a3 100644 --- a/scripts/config_mapping/lifecycle_config.py +++ b/scripts/config_mapping/lifecycle_config.py @@ -23,14 +23,14 @@ score_defaults = json.loads(""" { "deployment_config": { - "ready_timeout": 0.5, - "shutdown_timeout": 0.5, + "ready_timeout_ms": 500, + "shutdown_timeout_ms": 500, "environmental_variables": {}, "bin_dir": "/opt", "ready_recovery_action": { "restart": { "number_of_attempts": 0, - "delay_before_restart": 0 + "delay_before_restart_ms": 0 } }, "recovery_action": { @@ -53,7 +53,7 @@ "application_type": "Reporting_And_Supervised", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.5, + "reporting_cycle_ms": 500, "failed_cycles_tolerance": 2, "min_indications": 1, "max_indications": 3 @@ -68,7 +68,7 @@ "run_target": { "description": "", "depends_on": [], - "transition_timeout": 3, + "transition_timeout_ms": 3000, "recovery_action": { "switch_run_target": { "run_target": "fallback_run_target" @@ -77,7 +77,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.5 + "evaluation_cycle_ms": 500 }, "watchdog": {} } @@ -98,7 +98,7 @@ def report_error(message): # the main default config. file_state_defaults: Dict[str, Any] = { "state": "Exists", - "polling_interval": 0.01, + "polling_interval_ms": 10, } @@ -130,28 +130,6 @@ def apply_file_state_defaults(ready_condition): ready_condition["file_state"] = {**merged} -UINT32_MAX = 0xFFFFFFFF - - -def sec_to_ms(sec: float) -> int: - """Convert a duration in seconds (float) to integer milliseconds. - - Raises ValueError if the value is negative, overflows a uint32, or is a - sub-millisecond value that would silently round down to 0ms. - """ - if sec < 0: - raise ValueError(f"Negative time value {sec} seconds is not supported") - ms = sec * 1000 - if ms > UINT32_MAX: - raise ValueError( - f"Time value {sec} seconds exceeds maximum representable milliseconds" - ) - result = int(ms) - if sec > 0 and result == 0: - raise ValueError(f"Sub-millisecond time value {sec} seconds rounds to 0ms") - return result - - def preprocess_defaults(global_defaults, config): """ This function takes the input configuration and fills in any missing fields with default values. @@ -255,8 +233,8 @@ def dict_merge_recursive(dict_a, dict_b): fallback_defaults = { "description": "", "depends_on": [], - "transition_timeout": merged_defaults["run_target"].get( - "transition_timeout", 3 + "transition_timeout_ms": merged_defaults["run_target"].get( + "transition_timeout_ms", 3000 ), } new_config["fallback_run_target"] = dict_merge( @@ -324,32 +302,20 @@ def gen_config(output_dir, config, input_filename): if is_supervised(comp_props["application_profile"]["application_type"]): alive_sup = comp_props["application_profile"].get("alive_supervision", {}) app_profile["alive_supervision"] = { - "reporting_cycle_ms": sec_to_ms(alive_sup["reporting_cycle"]), + "reporting_cycle_ms": alive_sup["reporting_cycle_ms"], "failed_cycles_tolerance": alive_sup["failed_cycles_tolerance"], "min_indications": alive_sup["min_indications"], "max_indications": alive_sup["max_indications"], } - ready_condition = comp_props.get( - "ready_condition", {"process_state": "Running"} - ) - if "file_state" in ready_condition: - file_state = ready_condition["file_state"] - ready_condition = { - **ready_condition, - "file_state": { - "file_path": file_state["file_path"], - "state": file_state["state"], - "polling_interval_ms": sec_to_ms(file_state["polling_interval"]), - }, - } - props = { "binary_name": comp_props.get("binary_name", ""), "application_profile": app_profile, "depends_on": comp_props.get("depends_on", []), "process_arguments": comp_props.get("process_arguments", []), - "ready_condition": ready_condition, + "ready_condition": comp_props.get( + "ready_condition", {"process_state": "Running"} + ), } component["component_properties"] = props @@ -372,8 +338,8 @@ def gen_config(output_dir, config, input_filename): sandbox_out["max_cpu_usage"] = sandbox["max_cpu_usage"] deployment = { - "ready_timeout_ms": sec_to_ms(depl_cfg["ready_timeout"]), - "shutdown_timeout_ms": sec_to_ms(depl_cfg["shutdown_timeout"]), + "ready_timeout_ms": depl_cfg["ready_timeout_ms"], + "shutdown_timeout_ms": depl_cfg["shutdown_timeout_ms"], "bin_dir": depl_cfg["bin_dir"], # Default the working directory to bin_dir (the directory the # executable lives in) when not set explicitly. @@ -392,9 +358,7 @@ def gen_config(output_dir, config, input_filename): restart = rra.get("restart", rra) deployment["ready_recovery_action"] = { "number_of_attempts": restart.get("number_of_attempts", 0), - "delay_before_restart_ms": sec_to_ms( - restart.get("delay_before_restart", 0) - ), + "delay_before_restart_ms": restart.get("delay_before_restart_ms", 0), } if "recovery_action" in depl_cfg: @@ -413,7 +377,7 @@ def gen_config(output_dir, config, input_filename): for rt_name, rt_config in config["run_targets"].items(): rt = { "name": rt_name, - "transition_timeout_ms": sec_to_ms(rt_config.get("transition_timeout", 3)), + "transition_timeout_ms": rt_config.get("transition_timeout_ms", 3000), "recovery_action": { "run_target": rt_config.get("recovery_action", {}) .get("switch_run_target", {}) @@ -430,8 +394,8 @@ def gen_config(output_dir, config, input_filename): fallback = config.get("fallback_run_target", {}) fb_out = {} - if "transition_timeout" in fallback: - fb_out["transition_timeout_ms"] = sec_to_ms(fallback["transition_timeout"]) + if "transition_timeout_ms" in fallback: + fb_out["transition_timeout_ms"] = fallback["transition_timeout_ms"] if fallback.get("description"): fb_out["description"] = fallback["description"] if "depends_on" in fallback and fallback["depends_on"]: @@ -439,22 +403,22 @@ def gen_config(output_dir, config, input_filename): out["fallback_run_target"] = fb_out out["alive_supervision"] = { - "evaluation_cycle_ms": sec_to_ms( - config.get("alive_supervision", {}).get("evaluation_cycle", 0.5) + "evaluation_cycle_ms": config.get("alive_supervision", {}).get( + "evaluation_cycle_ms", 500 ), } watchdog_config = config.get("watchdog", {}) required_watchdog_fields = { "device_file_path", - "max_timeout", + "max_timeout_ms", "deactivate_on_shutdown", "require_magic_close", } if watchdog_config and required_watchdog_fields.issubset(watchdog_config.keys()): out["watchdog"] = { "device_file_path": watchdog_config["device_file_path"], - "max_timeout_ms": sec_to_ms(watchdog_config["max_timeout"]), + "max_timeout_ms": watchdog_config["max_timeout_ms"], "deactivate_on_shutdown": watchdog_config["deactivate_on_shutdown"], "require_magic_close": watchdog_config["require_magic_close"], } diff --git a/scripts/config_mapping/tests/custom_validation_failures_test/input/lm_config.json b/scripts/config_mapping/tests/custom_validation_failures_test/input/lm_config.json index 66a5115214..eea99d69b5 100644 --- a/scripts/config_mapping/tests/custom_validation_failures_test/input/lm_config.json +++ b/scripts/config_mapping/tests/custom_validation_failures_test/input/lm_config.json @@ -25,7 +25,7 @@ "Fallback": { "description": "Nothing running", "depends_on": [], - "transition_timeout": 5, + "transition_timeout_ms": 5000, "recovery_action": { "switch_run_target": { "run_target": "fallback_run_target" diff --git a/scripts/config_mapping/tests/full_config_test/expected_output/lm_config_gen.json b/scripts/config_mapping/tests/full_config_test/expected_output/lm_config_gen.json index 112e6c5f3b..3a2d0efb04 100644 --- a/scripts/config_mapping/tests/full_config_test/expected_output/lm_config_gen.json +++ b/scripts/config_mapping/tests/full_config_test/expected_output/lm_config_gen.json @@ -87,9 +87,9 @@ ], "ready_condition": { "file_state": { - "file_path": "/var/run/b/ready", "state": "Exists", - "polling_interval_ms": 10 + "polling_interval_ms": 10, + "file_path": "/var/run/b/ready" } } }, @@ -148,9 +148,9 @@ "process_arguments": [], "ready_condition": { "file_state": { - "file_path": "/var/run/c/startup.lock", "state": "NotExisting", - "polling_interval_ms": 500 + "polling_interval_ms": 500, + "file_path": "/var/run/c/startup.lock" } } }, diff --git a/scripts/config_mapping/tests/full_config_test/input/lm_config.json b/scripts/config_mapping/tests/full_config_test/input/lm_config.json index 33f2c2e701..af41f5f58e 100644 --- a/scripts/config_mapping/tests/full_config_test/input/lm_config.json +++ b/scripts/config_mapping/tests/full_config_test/input/lm_config.json @@ -2,8 +2,8 @@ "schema_version": 1, "defaults": { "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 2.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 2000, "environmental_variables": { "APP_ENV": "production", "LOG_LEVEL": "info", @@ -14,7 +14,7 @@ "ready_recovery_action": { "restart": { "number_of_attempts": 3, - "delay_before_restart": 1.0 + "delay_before_restart_ms": 1000 } }, "recovery_action": { @@ -39,7 +39,7 @@ "application_type": "Reporting_And_Supervised", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.5, + "reporting_cycle_ms": 500, "failed_cycles_tolerance": 3, "min_indications": 1, "max_indications": 5 @@ -54,7 +54,7 @@ "run_target": { "description": "Default run target", "depends_on": [], - "transition_timeout": 5, + "transition_timeout_ms": 5000, "recovery_action": { "switch_run_target": { "run_target": "fallback_run_target" @@ -62,11 +62,11 @@ } }, "alive_supervision": { - "evaluation_cycle": 0.5 + "evaluation_cycle_ms": 500 }, "watchdog": { "device_file_path": "/dev/watchdog0", - "max_timeout": 10, + "max_timeout_ms": 10000, "deactivate_on_shutdown": false, "require_magic_close": true } @@ -79,7 +79,7 @@ "application_type": "Reporting_And_Supervised", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.5, + "reporting_cycle_ms": 500, "failed_cycles_tolerance": 2, "min_indications": 1, "max_indications": 3 @@ -89,8 +89,8 @@ "process_arguments": ["--config", "/etc/a.conf", "--verbose"] }, "deployment_config": { - "ready_timeout": 2.0, - "shutdown_timeout": 3.0, + "ready_timeout_ms": 2000, + "shutdown_timeout_ms": 3000, "environmental_variables": { "COMP_A_VAR": "a_value" }, @@ -99,7 +99,7 @@ "ready_recovery_action": { "restart": { "number_of_attempts": 5, - "delay_before_restart": 0.5 + "delay_before_restart_ms": 500 } }, "recovery_action": { @@ -156,7 +156,7 @@ "file_state": { "file_path": "/var/run/c/startup.lock", "state": "NotExisting", - "polling_interval": 0.5 + "polling_interval_ms": 500 } } }, @@ -175,7 +175,7 @@ "application_profile": { "application_type": "State_Manager", "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "failed_cycles_tolerance": 0, "min_indications": 0, "max_indications": 10 @@ -195,7 +195,7 @@ "Startup": { "description": "Initial startup mode with minimal services", "depends_on": ["state_manager"], - "transition_timeout": 3.0, + "transition_timeout_ms": 3000, "recovery_action": { "switch_run_target": { "run_target": "fallback_run_target" @@ -205,7 +205,7 @@ "Full": { "description": "Full operational mode with all services", "depends_on": ["component_a", "component_b", "component_c", "Startup"], - "transition_timeout": 10.0, + "transition_timeout_ms": 10000, "recovery_action": { "switch_run_target": { "run_target": "fallback_run_target" @@ -215,7 +215,7 @@ "Diagnostic": { "description": "Diagnostic mode for troubleshooting", "depends_on": ["component_a", "component_b"], - "transition_timeout": 7.5, + "transition_timeout_ms": 7500, "recovery_action": { "switch_run_target": { "run_target": "fallback_run_target" @@ -227,15 +227,15 @@ "fallback_run_target": { "description": "Fallback mode - all non-essential services stopped", "depends_on": ["state_manager"], - "transition_timeout": 1.5 + "transition_timeout_ms": 1500 }, "alive_supervision": { - "evaluation_cycle": 0.25 + "evaluation_cycle_ms": 250 }, "watchdog": { "device_file_path": "/dev/watchdog", - "max_timeout": 2, + "max_timeout_ms": 2000, "deactivate_on_shutdown": true, "require_magic_close": false } -} \ No newline at end of file +} diff --git a/scripts/config_mapping/tests/smoke_test/input/lm_config.json b/scripts/config_mapping/tests/smoke_test/input/lm_config.json index ab8402597a..63e25e3b51 100644 --- a/scripts/config_mapping/tests/smoke_test/input/lm_config.json +++ b/scripts/config_mapping/tests/smoke_test/input/lm_config.json @@ -2,8 +2,8 @@ "schema_version": 1, "defaults": { "deployment_config": { - "ready_timeout": 0.5, - "shutdown_timeout": 0.5, + "ready_timeout_ms": 500, + "shutdown_timeout_ms": 500, "environmental_variables": { "LD_LIBRARY_PATH": "/opt/lib", "GLOBAL_ENV_VAR": "abc", @@ -13,7 +13,7 @@ "ready_recovery_action": { "restart": { "number_of_attempts": 1, - "delay_before_restart": 0.5 + "delay_before_restart_ms": 500 } }, "recovery_action": { @@ -38,7 +38,7 @@ "application_type": "Reporting_And_Supervised", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.5, + "reporting_cycle_ms": 500, "failed_cycles_tolerance": 2, "min_indications": 1, "max_indications": 3 @@ -51,7 +51,7 @@ } }, "run_target": { - "transition_timeout": 5, + "transition_timeout_ms": 5000, "recovery_action": { "switch_run_target": { "run_target": "Off" @@ -59,7 +59,7 @@ } }, "alive_supervision" : { - "evaluation_cycle": 0.5 + "evaluation_cycle_ms": 500 } }, "components": { @@ -141,7 +141,7 @@ "Full": { "description": "Everything running", "depends_on": ["test_app1", "Startup"], - "transition_timeout": 5, + "transition_timeout_ms": 5000, "recovery_action": { "switch_run_target": { "run_target": "fallback_run_target" @@ -153,14 +153,14 @@ "fallback_run_target": { "description": "Switching off everything", "depends_on": [], - "transition_timeout": 1.5 + "transition_timeout_ms": 1500 }, "alive_supervision" : { - "evaluation_cycle": 0.5 + "evaluation_cycle_ms": 500 }, "watchdog": { "device_file_path": "/dev/watchdog", - "max_timeout": 2, + "max_timeout_ms": 2000, "deactivate_on_shutdown": true, "require_magic_close": false } diff --git a/scripts/config_mapping/unit_tests.py b/scripts/config_mapping/unit_tests.py index 224e2aff77..b717ecf442 100644 --- a/scripts/config_mapping/unit_tests.py +++ b/scripts/config_mapping/unit_tests.py @@ -34,38 +34,9 @@ preprocess_defaults, schema_validation, score_defaults, - sec_to_ms, SCHED_POLICY_MAP, ) -# --------------------------------------------------------------------------- -# sec_to_ms -# --------------------------------------------------------------------------- - - -def test_sec_to_ms_converts_positive_value(): - assert sec_to_ms(1.5) == 1500 - - -def test_sec_to_ms_converts_zero(): - assert sec_to_ms(0.0) == 0 - - -def test_sec_to_ms_rejects_negative_value(): - with pytest.raises(ValueError, match="Negative time value"): - sec_to_ms(-1.0) - - -def test_sec_to_ms_rejects_overflow(): - with pytest.raises(ValueError, match="exceeds maximum representable milliseconds"): - sec_to_ms(5000000.0) - - -def test_sec_to_ms_rejects_sub_millisecond(): - with pytest.raises(ValueError, match="rounds to 0ms"): - sec_to_ms(0.0001) - - # --------------------------------------------------------------------------- # preprocess_defaults # --------------------------------------------------------------------------- @@ -79,8 +50,8 @@ def test_preprocessing_basic(): global_defaults = json.loads(""" { "deployment_config": { - "ready_timeout": 0.5, - "shutdown_timeout": 0.5, + "ready_timeout_ms": 500, + "shutdown_timeout_ms": 500, "environmental_variables" : { "global_default1": "global_default_value1", "global_default2": "global_default_value2" @@ -97,7 +68,7 @@ def test_preprocessing_basic(): } }, "alive_supervision": { - "evaluation_cycle": 0.5 + "evaluation_cycle_ms": 500 }, "watchdog": {} }""") @@ -106,7 +77,7 @@ def test_preprocessing_basic(): "schema_version": 1, "defaults": { "deployment_config": { - "shutdown_timeout": 1.0, + "shutdown_timeout_ms": 1000, "environmental_variables" : { "global_default2": "config_default_overwritten_value2", "config_default3": "config_default_value3", @@ -115,7 +86,7 @@ def test_preprocessing_basic(): "recovery_action": { "restart": { "number_of_attempts": 1, - "delay_before_restart": 0.5 + "delay_before_restart_ms": 500 } } }, @@ -148,11 +119,11 @@ def test_preprocessing_basic(): }, "run_targets": {}, "alive_supervision": { - "evaluation_cycle": 0.1 + "evaluation_cycle_ms": 100 }, "watchdog": { "device_file_path": "/dev/watchdog", - "max_timeout": 2, + "max_timeout_ms": 2000, "deactivate_on_shutdown": true, "require_magic_close": false } @@ -172,8 +143,8 @@ def test_preprocessing_basic(): } }, "deployment_config": { - "ready_timeout": 0.5, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 500, + "shutdown_timeout_ms": 1000, "environmental_variables" : { "global_default1": "global_default_value1", "global_default2": "config_default_overwritten_value2", @@ -195,11 +166,11 @@ def test_preprocessing_basic(): }, "run_targets": {}, "alive_supervision": { - "evaluation_cycle": 0.1 + "evaluation_cycle_ms": 100 }, "watchdog": { "device_file_path": "/dev/watchdog", - "max_timeout": 2, + "max_timeout_ms": 2000, "deactivate_on_shutdown": true, "require_magic_close": false } @@ -220,10 +191,16 @@ def test_preprocessing_non_merging_dicts(): "defaults": { "deployment_config": { "ready_recovery_action": { - "restart": {"number_of_attempts": 100, "delay_before_restart": 999} + "restart": { + "number_of_attempts": 100, + "delay_before_restart_ms": 999, + } }, "recovery_action": { - "restart": {"number_of_attempts": 200, "delay_before_restart": 888} + "restart": { + "number_of_attempts": 200, + "delay_before_restart_ms": 888, + } }, } }, @@ -297,17 +274,17 @@ def test_preprocessing_minimal_config(): } } }, - "run_targets": {"Startup": {"transition_timeout": 1}}, + "run_targets": {"Startup": {"transition_timeout_ms": 1}}, "initial_run_target": "Startup", - "fallback_run_target": {"transition_timeout": 2}, + "fallback_run_target": {"transition_timeout_ms": 2}, } result = preprocess_defaults(score_defaults, config) assert ( - result["components"]["c1"]["deployment_config"]["ready_timeout"] == 0.5 + result["components"]["c1"]["deployment_config"]["ready_timeout_ms"] == 500 ) # from global defaults - assert result["run_targets"]["Startup"]["transition_timeout"] == 1 # user value + assert result["run_targets"]["Startup"]["transition_timeout_ms"] == 1 # user value assert "fallback_run_target" in result - assert result["fallback_run_target"]["transition_timeout"] == 2 + assert result["fallback_run_target"]["transition_timeout_ms"] == 2 def test_preprocessing_empty_components(): @@ -318,7 +295,7 @@ def test_preprocessing_empty_components(): "schema_version": 1, "run_targets": {"Startup": {}}, "initial_run_target": "Startup", - "fallback_run_target": {"transition_timeout": 1}, + "fallback_run_target": {"transition_timeout_ms": 1}, } result = preprocess_defaults(score_defaults, config) assert result["components"] == {} @@ -327,7 +304,7 @@ def test_preprocessing_empty_components(): def test_preprocessing_fallback_with_custom_defaults(): """ - fallback_run_target should use transition_timeout from merged defaults (config-level) + fallback_run_target should use transition_timeout_ms from merged defaults (config-level) rather than from score_defaults. """ config = { @@ -335,10 +312,10 @@ def test_preprocessing_fallback_with_custom_defaults(): "run_targets": {"Startup": {}}, "initial_run_target": "Startup", "fallback_run_target": {}, - "defaults": {"run_target": {"transition_timeout": 99}}, + "defaults": {"run_target": {"transition_timeout_ms": 99}}, } result = preprocess_defaults(score_defaults, config) - assert result["fallback_run_target"]["transition_timeout"] == 99 + assert result["fallback_run_target"]["transition_timeout_ms"] == 99 def test_preprocessing_alive_supervision_presence_based_on_app_type(): @@ -469,11 +446,11 @@ def test_preprocessing_no_defaults_section(): }, "run_targets": {"Startup": {}}, "initial_run_target": "Startup", - "fallback_run_target": {"transition_timeout": 1}, + "fallback_run_target": {"transition_timeout_ms": 1}, } result = preprocess_defaults(score_defaults, config) - # ready_timeout comes from score_defaults - assert result["components"]["c1"]["deployment_config"]["ready_timeout"] == 0.5 + # ready_timeout_ms comes from score_defaults + assert result["components"]["c1"]["deployment_config"]["ready_timeout_ms"] == 500 # bin_dir comes from score_defaults assert result["components"]["c1"]["deployment_config"]["bin_dir"] == "/opt" @@ -491,14 +468,14 @@ def _config_with_file_state(file_state): }, "run_targets": {"Startup": {}}, "initial_run_target": "Startup", - "fallback_run_target": {"transition_timeout": 1}, + "fallback_run_target": {"transition_timeout_ms": 1}, } def test_preprocessing_file_state_defaults(): """ A file_state ready condition only requires a file_path, state and - polling_interval are filled in with their defaults. + polling_interval_ms are filled in with their defaults. """ config = _config_with_file_state({"file_path": "/tmp/ready"}) result = preprocess_defaults(score_defaults, config) @@ -509,7 +486,7 @@ def test_preprocessing_file_state_defaults(): "file_state": { "file_path": "/tmp/ready", "state": "Exists", - "polling_interval": 0.01, + "polling_interval_ms": 10, } } @@ -519,14 +496,14 @@ def test_preprocessing_file_state_defaults_overridden(): User specified file_state values take precedence over the defaults. """ config = _config_with_file_state( - {"file_path": "/tmp/ready", "state": "NotExisting", "polling_interval": 0.5} + {"file_path": "/tmp/ready", "state": "NotExisting", "polling_interval_ms": 500} ) result = preprocess_defaults(score_defaults, config) file_state = result["components"]["c1"]["component_properties"]["ready_condition"][ "file_state" ] assert file_state["state"] == "NotExisting" - assert file_state["polling_interval"] == 0.5 + assert file_state["polling_interval_ms"] == 500 def test_preprocessing_file_state_defaults_not_applied_for_process_state(): @@ -545,7 +522,7 @@ def test_preprocessing_file_state_defaults_not_applied_for_process_state(): }, "run_targets": {"Startup": {}}, "initial_run_target": "Startup", - "fallback_run_target": {"transition_timeout": 1}, + "fallback_run_target": {"transition_timeout_ms": 1}, } result = preprocess_defaults(score_defaults, config) assert result["components"]["c1"]["component_properties"]["ready_condition"] == { @@ -808,8 +785,8 @@ def test_gen_config_minimal(tmp_path): "application_profile": {"application_type": "REPORTING"} }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 2.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 2000, "bin_dir": "/opt/app", "sandbox": {"uid": 1000, "gid": 1000}, }, @@ -847,7 +824,7 @@ def test_gen_config_with_alive_supervision(tmp_path): "application_profile": { "application_type": "Reporting_And_Supervised", "alive_supervision": { - "reporting_cycle": 1.0, + "reporting_cycle_ms": 1000, "failed_cycles_tolerance": 3, "min_indications": 1, "max_indications": 5, @@ -855,8 +832,8 @@ def test_gen_config_with_alive_supervision(tmp_path): } }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 2.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 2000, "bin_dir": "/opt", "sandbox": {"uid": 1000, "gid": 1000}, }, @@ -895,8 +872,8 @@ def test_gen_config_without_alive_supervision(tmp_path): "application_profile": {"application_type": "REPORTING"} }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 2.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 2000, "bin_dir": "/opt", "sandbox": {"uid": 1000, "gid": 1000}, }, @@ -930,7 +907,7 @@ def test_gen_config_with_watchdog(tmp_path): "alive_supervision": {}, "watchdog": { "device_file_path": "/dev/watchdog0", - "max_timeout": 5, + "max_timeout_ms": 5000, "deactivate_on_shutdown": True, "require_magic_close": True, }, @@ -962,7 +939,7 @@ def test_gen_config_watchdog_partial_fields_omitted(tmp_path): "alive_supervision": {}, "watchdog": { "device_file_path": "/dev/watchdog0" - }, # missing max_timeout, deactivate_on_shutdown, require_magic_close + }, # missing max_timeout_ms, deactivate_on_shutdown, require_magic_close } gen_config(str(tmp_path), config, "test_input.json") @@ -984,8 +961,8 @@ def test_gen_config_with_sandbox_limits(tmp_path): "application_profile": {"application_type": "REPORTING"} }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 2.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 2000, "bin_dir": "/opt", "sandbox": { "uid": 1000, @@ -1042,8 +1019,8 @@ def test_gen_config_env_variables_list_format(tmp_path): "application_profile": {"application_type": "REPORTING"} }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 2.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 2000, "bin_dir": "/opt", "sandbox": {"uid": 1000, "gid": 1000}, "environmental_variables": {"FOO": "bar", "BAZ": "qux"}, @@ -1081,8 +1058,8 @@ def test_gen_config_run_target_with_dependencies(tmp_path): "application_profile": {"application_type": "REPORTING"} }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 2.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 2000, "bin_dir": "/opt", "sandbox": {"uid": 1000, "gid": 1000}, }, @@ -1092,8 +1069,8 @@ def test_gen_config_run_target_with_dependencies(tmp_path): "application_profile": {"application_type": "NOT_REPORTING"} }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 2.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 2000, "bin_dir": "/opt", "sandbox": {"uid": 1000, "gid": 1000}, }, @@ -1105,7 +1082,7 @@ def test_gen_config_run_target_with_dependencies(tmp_path): }, "initial_run_target": "Startup", "fallback_run_target": {}, - "alive_supervision": {"evaluation_cycle": 0.5}, + "alive_supervision": {"evaluation_cycle_ms": 500}, "watchdog": {}, } gen_config(str(tmp_path), config, "test_input.json") @@ -1159,8 +1136,8 @@ def test_gen_config_scheduling_policy_mapping(tmp_path): "application_profile": {"application_type": "REPORTING"} }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 2.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 2000, "bin_dir": "/opt", "sandbox": {"uid": 1000, "gid": 1000, "scheduling_policy": src}, }, @@ -1168,7 +1145,7 @@ def test_gen_config_scheduling_policy_mapping(tmp_path): }, "run_targets": {"Startup": {}}, "initial_run_target": "Startup", - "fallback_run_target": {"transition_timeout": 1}, + "fallback_run_target": {"transition_timeout_ms": 1}, "alive_supervision": {}, "watchdog": {}, } @@ -1184,7 +1161,7 @@ def test_gen_config_scheduling_policy_mapping(tmp_path): def test_gen_config_ready_recovery_action(tmp_path): - """ready_recovery_action with restart sub-keys should output number_of_attempts and delay_before_restart.""" + """ready_recovery_action with restart sub-keys should output number_of_attempts and delay_before_restart_ms.""" config = { "schema_version": 1, "components": { @@ -1193,19 +1170,22 @@ def test_gen_config_ready_recovery_action(tmp_path): "application_profile": {"application_type": "REPORTING"} }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 2.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 2000, "bin_dir": "/opt", "sandbox": {"uid": 1000, "gid": 1000}, "ready_recovery_action": { - "restart": {"number_of_attempts": 3, "delay_before_restart": 5} + "restart": { + "number_of_attempts": 3, + "delay_before_restart_ms": 5000, + } }, }, } }, "run_targets": {"Startup": {}}, "initial_run_target": "Startup", - "fallback_run_target": {"transition_timeout": 1}, + "fallback_run_target": {"transition_timeout_ms": 1}, "alive_supervision": {}, "watchdog": {}, } @@ -1232,8 +1212,8 @@ def test_gen_config_unmapped_scheduling_policy(tmp_path): "application_profile": {"application_type": "REPORTING"} }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 2.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 2000, "bin_dir": "/opt", "sandbox": { "uid": 1000, @@ -1245,7 +1225,7 @@ def test_gen_config_unmapped_scheduling_policy(tmp_path): }, "run_targets": {"Startup": {}}, "initial_run_target": "Startup", - "fallback_run_target": {"transition_timeout": 1}, + "fallback_run_target": {"transition_timeout_ms": 1}, "alive_supervision": {}, "watchdog": {}, } @@ -1391,3 +1371,38 @@ def test_schema_validation_smoke(): assert schema_validation({"name": "test", "count": 42}, schema) is True # Invalid config (missing required field) assert schema_validation({"count": 42}, schema) is False + + +def _minimal_config_with_ready_timeout_ms(ready_timeout_ms): + return { + "schema_version": 1, + "components": {}, + "run_targets": {}, + "initial_run_target": "Startup", + "fallback_run_target": {"depends_on": []}, + "defaults": { + "deployment_config": { + "ready_timeout_ms": ready_timeout_ms, + "shutdown_timeout_ms": 500, + } + }, + } + + +def test_schema_validation_rejects_out_of_range_ms_field(schema_file): + """ + Timing fields are now integer milliseconds directly in the schema (see #635); the schema + itself, not lifecycle_config.py, is responsible for rejecting negative, non-integer and + overflowing values. + """ + schema = load_json_file(schema_file) + + assert schema_validation(_minimal_config_with_ready_timeout_ms(500), schema) is True + assert schema_validation(_minimal_config_with_ready_timeout_ms(-1), schema) is False + assert ( + schema_validation(_minimal_config_with_ready_timeout_ms(1.5), schema) is False + ) + assert ( + schema_validation(_minimal_config_with_ready_timeout_ms(4294967296), schema) + is False + ) diff --git a/tests/integration/complex_monitoring/complex_monitoring.json b/tests/integration/complex_monitoring/complex_monitoring.json index b8e3ed2cf4..8aae0f0c9f 100644 --- a/tests/integration/complex_monitoring/complex_monitoring.json +++ b/tests/integration/complex_monitoring/complex_monitoring.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/complex_monitoring", - "ready_timeout": 2.0, - "shutdown_timeout": 0.2, + "ready_timeout_ms": 2000, + "shutdown_timeout_ms": 200, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -58,7 +58,7 @@ "application_profile": { "application_type": "Reporting_And_Supervised", "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 2, "failed_cycles_tolerance": 0 @@ -111,7 +111,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [ diff --git a/tests/integration/crash_ignores_dependents/crash_ignores_dependents.json b/tests/integration/crash_ignores_dependents/crash_ignores_dependents.json index 1cbf6f019c..0ce2ea2403 100644 --- a/tests/integration/crash_ignores_dependents/crash_ignores_dependents.json +++ b/tests/integration/crash_ignores_dependents/crash_ignores_dependents.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/crash_ignores_dependents", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -30,7 +30,7 @@ "application_type": "Reporting", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 3, "failed_cycles_tolerance": 1 @@ -52,11 +52,13 @@ "min_indications": 0 } }, - "depends_on": ["component_crashing_once"] + "depends_on": [ + "component_crashing_once" + ] }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "test_process" } @@ -86,7 +88,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [ diff --git a/tests/integration/crash_on_startup/crash_on_startup.json b/tests/integration/crash_on_startup/crash_on_startup.json index 96685ae08a..95df185573 100644 --- a/tests/integration/crash_on_startup/crash_on_startup.json +++ b/tests/integration/crash_on_startup/crash_on_startup.json @@ -36,8 +36,8 @@ } }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "control_client_test_driver" } @@ -141,7 +141,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [ diff --git a/tests/integration/fallback_to_same_target_restarts/fallback_to_same_target_restarts.json b/tests/integration/fallback_to_same_target_restarts/fallback_to_same_target_restarts.json index f09aa5af15..d9e20cbf22 100644 --- a/tests/integration/fallback_to_same_target_restarts/fallback_to_same_target_restarts.json +++ b/tests/integration/fallback_to_same_target_restarts/fallback_to_same_target_restarts.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/fallback_to_same_target_restarts", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -30,7 +30,7 @@ "application_type": "Reporting", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 3, "failed_cycles_tolerance": 1 @@ -53,8 +53,8 @@ } }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "control_client_test_driver" } @@ -98,7 +98,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [ diff --git a/tests/integration/incorrect_config_non_reporting/non_reporting_config.json b/tests/integration/incorrect_config_non_reporting/non_reporting_config.json index 4b5fa75143..d42678fdfe 100644 --- a/tests/integration/incorrect_config_non_reporting/non_reporting_config.json +++ b/tests/integration/incorrect_config_non_reporting/non_reporting_config.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/incorrect_config_non_reporting", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -30,7 +30,7 @@ "application_type": "Reporting", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 3, "failed_cycles_tolerance": 1 @@ -73,14 +73,13 @@ "recovery_action": { "switch_run_target": { "run_target": "fallback_run_target" - } } } }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [] diff --git a/tests/integration/lm_shutdown_during_rt_switch/lm_shutdown_during_rt_switch.json b/tests/integration/lm_shutdown_during_rt_switch/lm_shutdown_during_rt_switch.json index 9376cba98b..ca9a9320d4 100644 --- a/tests/integration/lm_shutdown_during_rt_switch/lm_shutdown_during_rt_switch.json +++ b/tests/integration/lm_shutdown_during_rt_switch/lm_shutdown_during_rt_switch.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/lm_shutdown_during_rt_switch", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -30,7 +30,7 @@ "application_type": "Reporting", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 3, "failed_cycles_tolerance": 1 @@ -53,8 +53,8 @@ } }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "control_client_test_driver" } @@ -65,7 +65,7 @@ "binary_name": "process_hanging_on_sigterm" }, "deployment_config": { - "shutdown_timeout": 5.0, + "shutdown_timeout_ms": 5000, "environmental_variables": { "PROCESSIDENTIFIER": "component_a" } @@ -106,7 +106,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [] diff --git a/tests/integration/lm_shutdown_during_switch_to_off/lm_shutdown_during_switch_to_off.json b/tests/integration/lm_shutdown_during_switch_to_off/lm_shutdown_during_switch_to_off.json index ac67c6af7a..20d8ef9e84 100644 --- a/tests/integration/lm_shutdown_during_switch_to_off/lm_shutdown_during_switch_to_off.json +++ b/tests/integration/lm_shutdown_during_switch_to_off/lm_shutdown_during_switch_to_off.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/lm_shutdown_during_switch_to_off", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -30,7 +30,7 @@ "application_type": "Reporting", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 3, "failed_cycles_tolerance": 1 @@ -53,8 +53,8 @@ } }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 5.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 5000, "environmental_variables": { "PROCESSIDENTIFIER": "control_client_test_driver" } @@ -65,7 +65,7 @@ "binary_name": "process_hanging_on_sigterm" }, "deployment_config": { - "shutdown_timeout": 5.0, + "shutdown_timeout_ms": 5000, "environmental_variables": { "PROCESSIDENTIFIER": "component_a" } @@ -90,7 +90,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [] diff --git a/tests/integration/lm_shutdown_during_switch_to_off/lm_shutdown_during_switch_to_off.py b/tests/integration/lm_shutdown_during_switch_to_off/lm_shutdown_during_switch_to_off.py index a81eff0bf7..125dcbeacc 100644 --- a/tests/integration/lm_shutdown_during_switch_to_off/lm_shutdown_during_switch_to_off.py +++ b/tests/integration/lm_shutdown_during_switch_to_off/lm_shutdown_during_switch_to_off.py @@ -38,8 +38,8 @@ def test_lm_shutdown(target, setup_test, assert_test_results, remote_test_dir): Expected Behaviour: The launch manager lets the in-progress switch to Off continue, stops all the processes it owns, and exits cleanly. It honours each - component's shutdown_timeout, so component_a - which stalls for less than its - shutdown_timeout - exits gracefully (producing its XML result) rather than being + component's shutdown_timeout_ms, so component_a - which stalls for less than its + shutdown_timeout_ms - exits gracefully (producing its XML result) rather than being force-terminated. """ @@ -52,6 +52,6 @@ def test_lm_shutdown(target, setup_test, assert_test_results, remote_test_dir): # Both processes are stopped gracefully as part of the switch to Off and produce # their XML results: the control client is terminated when the switch to Off - # begins, and component_a exits within its shutdown_timeout (which the launch + # begins, and component_a exits within its shutdown_timeout_ms (which the launch # manager honours) instead of being force-terminated. assert_test_results({"control_client_test_driver.xml", "component_a.xml"}) diff --git a/tests/integration/parallel_launch/parallel_launch.json b/tests/integration/parallel_launch/parallel_launch.json index 76b651457d..8540c2b981 100644 --- a/tests/integration/parallel_launch/parallel_launch.json +++ b/tests/integration/parallel_launch/parallel_launch.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/parallel_launch", - "ready_timeout": 5.0, - "shutdown_timeout": 0.2, + "ready_timeout_ms": 5000, + "shutdown_timeout_ms": 200, "environmental_variables": { "LD_LIBRARY_PATH": "/opt/lib" }, diff --git a/tests/integration/process_complex_rep_failure/process_complex_rep_failure.json b/tests/integration/process_complex_rep_failure/process_complex_rep_failure.json index cf53f9be84..9d1f2e0122 100644 --- a/tests/integration/process_complex_rep_failure/process_complex_rep_failure.json +++ b/tests/integration/process_complex_rep_failure/process_complex_rep_failure.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/process_complex_rep_failure", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -30,7 +30,7 @@ "application_type": "Reporting", "is_self_terminating": true, "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 3, "failed_cycles_tolerance": 1 @@ -53,8 +53,8 @@ } }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "control_client_test_driver" } @@ -68,8 +68,8 @@ ] }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "component_does_report_krunning_in_time" } @@ -83,8 +83,8 @@ ] }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "component_does_not_report_krunning_in_time" } @@ -145,7 +145,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [ diff --git a/tests/integration/process_crash_monitoring/process_crash_monitoring.json b/tests/integration/process_crash_monitoring/process_crash_monitoring.json index 70afc4f850..8afab51e73 100644 --- a/tests/integration/process_crash_monitoring/process_crash_monitoring.json +++ b/tests/integration/process_crash_monitoring/process_crash_monitoring.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/process_crash_monitoring", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -30,7 +30,7 @@ "application_type": "Reporting", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 3, "failed_cycles_tolerance": 1 @@ -53,8 +53,8 @@ } }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "control_client_test_driver" } @@ -112,7 +112,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [ diff --git a/tests/integration/process_fd_leak/process_fd_leak.json b/tests/integration/process_fd_leak/process_fd_leak.json index d16703e296..ec9864cea9 100644 --- a/tests/integration/process_fd_leak/process_fd_leak.json +++ b/tests/integration/process_fd_leak/process_fd_leak.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/process_fd_leak", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -31,7 +31,7 @@ "is_self_terminating": true, "alive_supervision": { "min_indications": 0 - } + } }, "ready_condition": { "process_state": "Running" @@ -73,7 +73,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [] diff --git a/tests/integration/process_launch_args/process_launch_args.json b/tests/integration/process_launch_args/process_launch_args.json index 1d417bc3a1..98416af2b8 100644 --- a/tests/integration/process_launch_args/process_launch_args.json +++ b/tests/integration/process_launch_args/process_launch_args.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/process_launch_args", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -30,7 +30,7 @@ "application_type": "Reporting", "is_self_terminating": true, "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 3, "failed_cycles_tolerance": 1 @@ -65,7 +65,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [] diff --git a/tests/integration/process_simple_rep_failure/process_simple_rep_failure.json b/tests/integration/process_simple_rep_failure/process_simple_rep_failure.json index dd443d306c..569bab438e 100644 --- a/tests/integration/process_simple_rep_failure/process_simple_rep_failure.json +++ b/tests/integration/process_simple_rep_failure/process_simple_rep_failure.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/process_simple_rep_failure", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -30,7 +30,7 @@ "application_type": "Reporting", "is_self_terminating": true, "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 3, "failed_cycles_tolerance": 1 @@ -53,8 +53,8 @@ } }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "control_client_test_driver" } @@ -68,8 +68,8 @@ ] }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "component_does_report_krunning_in_time" } @@ -83,8 +83,8 @@ ] }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "component_does_not_report_krunning_in_time" } @@ -145,7 +145,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [ diff --git a/tests/integration/process_wrong_binary_failure/process_wrong_binary_failure.json b/tests/integration/process_wrong_binary_failure/process_wrong_binary_failure.json index a5e832b313..67102cb575 100644 --- a/tests/integration/process_wrong_binary_failure/process_wrong_binary_failure.json +++ b/tests/integration/process_wrong_binary_failure/process_wrong_binary_failure.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/process_wrong_binary_failure", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -30,7 +30,7 @@ "application_type": "Reporting", "is_self_terminating": true, "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 3, "failed_cycles_tolerance": 1 @@ -53,8 +53,8 @@ } }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "control_client_test_driver" } @@ -68,8 +68,8 @@ ] }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "component_with_missing_binary" } @@ -119,7 +119,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [ diff --git a/tests/integration/ready_conditions/file_state/exists/ready_condition_file.json b/tests/integration/ready_conditions/file_state/exists/ready_condition_file.json index 06dc491453..51c7dd2b61 100644 --- a/tests/integration/ready_conditions/file_state/exists/ready_condition_file.json +++ b/tests/integration/ready_conditions/file_state/exists/ready_condition_file.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/ready_condition_file", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "recovery_action": { "switch_run_target": { "run_target": "fallback_run_target" @@ -47,13 +47,16 @@ "component_properties": { "binary_name": "file_modifier", "process_arguments": [ - "create", "/tmp/tests/ready_condition_file/ready_file", "0", "native" + "create", + "/tmp/tests/ready_condition_file/ready_file", + "0", + "native" ], "ready_condition": { "file_state": { "file_path": "/tmp/tests/ready_condition_file/ready_file", "state": "Exists", - "polling_interval": 0.05 + "polling_interval_ms": 50 } } } @@ -62,7 +65,10 @@ "component_properties": { "binary_name": "file_modifier", "process_arguments": [ - "create", "/tmp/tests/ready_condition_file/ready_file_reporting", "0", "report" + "create", + "/tmp/tests/ready_condition_file/ready_file_reporting", + "0", + "report" ], "application_profile": { "application_type": "Reporting" @@ -71,7 +77,7 @@ "file_state": { "file_path": "/tmp/tests/ready_condition_file/ready_file_reporting", "state": "Exists", - "polling_interval": 0.05 + "polling_interval_ms": 50 } } } @@ -80,13 +86,16 @@ "component_properties": { "binary_name": "file_modifier", "process_arguments": [ - "create", "/tmp/tests/ready_condition_file/ready_file_2", "1500", "native" + "create", + "/tmp/tests/ready_condition_file/ready_file_2", + "1500", + "native" ], "ready_condition": { "file_state": { "file_path": "/tmp/tests/ready_condition_file/ready_file_2", "state": "Exists", - "polling_interval": 0.1 + "polling_interval_ms": 100 } } } @@ -129,6 +138,8 @@ }, "initial_run_target": "Startup", "fallback_run_target": { - "depends_on": ["control_client_test_driver"] + "depends_on": [ + "control_client_test_driver" + ] } } diff --git a/tests/integration/ready_conditions/file_state/not_existing/ready_condition_file_not_existing.json b/tests/integration/ready_conditions/file_state/not_existing/ready_condition_file_not_existing.json index d3ac091859..c97149e374 100644 --- a/tests/integration/ready_conditions/file_state/not_existing/ready_condition_file_not_existing.json +++ b/tests/integration/ready_conditions/file_state/not_existing/ready_condition_file_not_existing.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/ready_condition_file_not_exists", - "ready_timeout": 0.1, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 100, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -45,7 +45,10 @@ "component_properties": { "binary_name": "file_modifier", "process_arguments": [ - "delete", "/tmp/tests/ready_condition_file_not_exists/vanishing_file", "0", "native" + "delete", + "/tmp/tests/ready_condition_file_not_exists/vanishing_file", + "0", + "native" ], "application_profile": { "application_type": "Native" @@ -54,7 +57,7 @@ "file_state": { "file_path": "/tmp/tests/ready_condition_file_not_exists/vanishing_file", "state": "NotExisting", - "polling_interval": 0.1 + "polling_interval_ms": 100 } } } @@ -63,7 +66,10 @@ "component_properties": { "binary_name": "file_modifier", "process_arguments": [ - "delete", "/tmp/tests/ready_condition_file_not_exists/vanishing_file_report", "0", "report" + "delete", + "/tmp/tests/ready_condition_file_not_exists/vanishing_file_report", + "0", + "report" ], "application_profile": { "application_type": "Reporting" @@ -72,7 +78,7 @@ "file_state": { "file_path": "/tmp/tests/ready_condition_file_not_exists/vanishing_file_report", "state": "NotExisting", - "polling_interval": 0.1 + "polling_interval_ms": 100 } } } @@ -81,13 +87,16 @@ "component_properties": { "binary_name": "file_modifier", "process_arguments": [ - "delete", "/tmp/tests/ready_condition_file_not_exists/vanishing_file_2", "500", "native" + "delete", + "/tmp/tests/ready_condition_file_not_exists/vanishing_file_2", + "500", + "native" ], "ready_condition": { "file_state": { "file_path": "/tmp/tests/ready_condition_file_not_exists/vanishing_file_2", "state": "NotExisting", - "polling_interval": 0.1 + "polling_interval_ms": 100 } } } @@ -129,7 +138,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [] diff --git a/tests/integration/rt_running_when_process_exits/rt_running_when_process_exits.json b/tests/integration/rt_running_when_process_exits/rt_running_when_process_exits.json index 8fc9c76548..a652d78b88 100644 --- a/tests/integration/rt_running_when_process_exits/rt_running_when_process_exits.json +++ b/tests/integration/rt_running_when_process_exits/rt_running_when_process_exits.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/rt_running_when_process_exits", - "ready_timeout": 2.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 2000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -42,7 +42,11 @@ "setup_filesystem_sh": { "component_properties": { "binary_name": "touch_file.sh", - "process_arguments": ["--text", "filesystem is ready", "setup_filesystem_output.txt"], + "process_arguments": [ + "--text", + "filesystem is ready", + "setup_filesystem_output.txt" + ], "application_profile": { "application_type": "Native", "is_self_terminating": true @@ -71,7 +75,13 @@ "slow_setup_sh": { "component_properties": { "binary_name": "touch_file.sh", - "process_arguments": ["--sleep", "1", "--text", "slow setup done", "slow_setup_output.txt"], + "process_arguments": [ + "--sleep", + "1", + "--text", + "slow setup done", + "slow_setup_output.txt" + ], "application_profile": { "application_type": "Native", "is_self_terminating": true diff --git a/tests/integration/sandbox_options/sandbox_options.json b/tests/integration/sandbox_options/sandbox_options.json index 5005139d84..46d22b0b8b 100644 --- a/tests/integration/sandbox_options/sandbox_options.json +++ b/tests/integration/sandbox_options/sandbox_options.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/sandbox_options", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -30,7 +30,7 @@ "application_type": "Reporting", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 3, "failed_cycles_tolerance": 1 @@ -68,7 +68,11 @@ "sandbox": { "uid": 666, "gid": 666, - "supplementary_group_ids": [123, 321, 456], + "supplementary_group_ids": [ + 123, + 321, + 456 + ], "scheduling_policy": "SCHED_FIFO", "scheduling_priority": 10 }, @@ -130,7 +134,11 @@ "verification_component": { "component_properties": { "binary_name": "verification_process", - "depends_on": ["sandbox_options_process_a", "sandbox_options_process_b", "sandbox_options_process_c"], + "depends_on": [ + "sandbox_options_process_a", + "sandbox_options_process_b", + "sandbox_options_process_c" + ], "process_arguments": [ "test_end" ], @@ -158,7 +166,7 @@ }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [] diff --git a/tests/integration/shutdown_signal/shutdown_signal.json b/tests/integration/shutdown_signal/shutdown_signal.json index 0e1f8ace11..2b9d9d28a0 100644 --- a/tests/integration/shutdown_signal/shutdown_signal.json +++ b/tests/integration/shutdown_signal/shutdown_signal.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/shutdown_signal", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -30,8 +30,8 @@ } }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "control_daemon" } @@ -45,7 +45,7 @@ } }, "deployment_config": { - "shutdown_timeout": 0.5, + "shutdown_timeout_ms": 500, "environmental_variables": { "PROCESSIDENTIFIER": "DefaultPG_app0" } diff --git a/tests/integration/smoke/lifecycle_smoketest.json b/tests/integration/smoke/lifecycle_smoketest.json index 4d5e830106..c0c0f91881 100644 --- a/tests/integration/smoke/lifecycle_smoketest.json +++ b/tests/integration/smoke/lifecycle_smoketest.json @@ -3,8 +3,8 @@ "defaults": { "deployment_config": { "bin_dir": "/tmp/tests/smoke", - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "ready_recovery_action": { "restart": { "number_of_attempts": 0 @@ -30,7 +30,7 @@ "application_type": "Reporting", "is_self_terminating": false, "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 3, "failed_cycles_tolerance": 1 @@ -53,8 +53,8 @@ } }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "control_daemon" } @@ -101,14 +101,13 @@ "recovery_action": { "switch_run_target": { "run_target": "fallback_run_target" - } } } }, "initial_run_target": "Startup", "alive_supervision": { - "evaluation_cycle": 0.05 + "evaluation_cycle_ms": 50 }, "fallback_run_target": { "depends_on": [] diff --git a/tests/integration/switch_run_target/switch_run_target.json b/tests/integration/switch_run_target/switch_run_target.json index 1dd1ce0bd7..7d464bfa97 100644 --- a/tests/integration/switch_run_target/switch_run_target.json +++ b/tests/integration/switch_run_target/switch_run_target.json @@ -31,8 +31,8 @@ } }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": { "PROCESSIDENTIFIER": "control_client_test_driver" } @@ -41,7 +41,9 @@ "component_a": { "component_properties": { "binary_name": "component_a", - "depends_on": ["component_b"] + "depends_on": [ + "component_b" + ] }, "deployment_config": { "environmental_variables": { diff --git a/tests/scripts/gen_lifecycle_config.py b/tests/scripts/gen_lifecycle_config.py index bd0c83b57d..a31a803345 100644 --- a/tests/scripts/gen_lifecycle_config.py +++ b/tests/scripts/gen_lifecycle_config.py @@ -38,8 +38,8 @@ def gen_lifecycle_config( "defaults": { "deployment_config": { "bin_dir": "/opt", - "ready_timeout": 2.0, - "shutdown_timeout": 2.0, + "ready_timeout_ms": 2000, + "shutdown_timeout_ms": 2000, "ready_recovery_action": {"restart": {"number_of_attempts": 0}}, "recovery_action": {"switch_run_target": {"run_target": "Startup"}}, "environmental_variables": {"LD_LIBRARY_PATH": "/opt/lib"}, @@ -55,7 +55,7 @@ def gen_lifecycle_config( "application_type": "Reporting", "is_self_terminating": False, "alive_supervision": { - "reporting_cycle": 0.1, + "reporting_cycle_ms": 100, "min_indications": 1, "max_indications": 3, "failed_cycles_tolerance": 1, @@ -67,7 +67,7 @@ def gen_lifecycle_config( "components": {}, "run_targets": {}, "initial_run_target": "Startup", - "alive_supervision": {"evaluation_cycle": 0.05}, + "alive_supervision": {"evaluation_cycle_ms": 50}, } running_deps = [] @@ -84,8 +84,8 @@ def gen_lifecycle_config( }, }, "deployment_config": { - "ready_timeout": 1.0, - "shutdown_timeout": 1.0, + "ready_timeout_ms": 1000, + "shutdown_timeout_ms": 1000, "environmental_variables": {"PROCESSIDENTIFIER": "control_daemon"}, }, } diff --git a/tests/utils/test_helper/process_hanging_on_sigterm.cpp b/tests/utils/test_helper/process_hanging_on_sigterm.cpp index c63392c8c4..9c085270a8 100644 --- a/tests/utils/test_helper/process_hanging_on_sigterm.cpp +++ b/tests/utils/test_helper/process_hanging_on_sigterm.cpp @@ -23,7 +23,7 @@ namespace { /// @brief How long the process stalls while being terminated. -/// Must be smaller than the configured shutdown_timeout so the +/// Must be smaller than the configured shutdown_timeout_ms so the /// process still exits gracefully. constexpr unsigned int kTerminationDelaySeconds = 2U;