diff --git a/benchmark/config/benchmark_training_config.yaml b/benchmark/config/benchmark_training_config.yaml index 17811586..02b6377c 100644 --- a/benchmark/config/benchmark_training_config.yaml +++ b/benchmark/config/benchmark_training_config.yaml @@ -158,7 +158,7 @@ green_ier_blocked: -0.001 # Patching / Reset durations os_patching_duration: 5 # The time taken to patch the OS node_reset_duration: 5 # The time taken to reset a node (hardware) -service_fixing_duration: 5 # The time taken to patch a service +service_patching_duration: 5 # The time taken to patch a service file_system_repairing_limit: 5 # The time take to repair the file system file_system_restoring_limit: 5 # The time take to restore the file system file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/benchmark/results/v2.0.0/v2.0.0_benchmark_metadata.json b/benchmark/results/v2.0.0/v2.0.0_benchmark_metadata.json index 3ed57745..b2745967 100644 --- a/benchmark/results/v2.0.0/v2.0.0_benchmark_metadata.json +++ b/benchmark/results/v2.0.0/v2.0.0_benchmark_metadata.json @@ -5634,7 +5634,7 @@ "green_ier_blocked": -0.001, "os_patching_duration": 5, "node_reset_duration": 5, - "service_fixing_duration": 5, + "service_patching_duration": 5, "file_system_repairing_limit": 5, "file_system_restoring_limit": 5, "file_system_scanning_limit": 5 diff --git a/src/primaite/simulator/system/applications/application.py b/src/primaite/simulator/system/applications/application.py index 4ea893e0..617fdc23 100644 --- a/src/primaite/simulator/system/applications/application.py +++ b/src/primaite/simulator/system/applications/application.py @@ -117,7 +117,7 @@ class Application(IOSoftware): """The main application loop.""" pass - def close(self) -> None: + def close(self) -> bool: """Close the Application.""" if self.operating_state == ApplicationOperatingState.RUNNING: self.sys_log.info(f"Closed Application{self.name}") diff --git a/tests/unit_tests/_primaite/_simulator/_system/_applications/test_database_client.py b/tests/unit_tests/_primaite/_simulator/_system/_applications/test_database_client.py index b9b43b25..5098fcde 100644 --- a/tests/unit_tests/_primaite/_simulator/_system/_applications/test_database_client.py +++ b/tests/unit_tests/_primaite/_simulator/_system/_applications/test_database_client.py @@ -111,6 +111,19 @@ def test_query_when_client_is_closed(database_client_on_computer): assert database_client.query(sql="test") is False +def test_query_fail_to_connect(database_client_on_computer): + """Database client query should return False if the connect attempt fails.""" + database_client, computer = database_client_on_computer + + def return_false(): + return False + + database_client.connect = return_false + database_client.connected = False + + assert database_client.query(sql="test") is False + + def test_client_receives_response_when_closed(database_client_on_computer): """Database client receive should return False when it is closed.""" database_client, computer = database_client_on_computer