Skip to content

Commit 021e5f9

Browse files
committed
adding format fixes
1 parent 8c37d9a commit 021e5f9

5 files changed

Lines changed: 39 additions & 61 deletions

File tree

feature_integration_tests/test_cases/lifecycle_scenario.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ def read_launch_manager_config(config_path: Path) -> dict[str, Any]:
4343
return json.loads(config_path.read_text())
4444

4545

46-
def create_launch_manager_config(
47-
config_path: Path, components: dict[str, Any], run_targets: dict[str, Any]
48-
) -> Path:
46+
def create_launch_manager_config(config_path: Path, components: dict[str, Any], run_targets: dict[str, Any]) -> Path:
4947
"""
5048
Create a launch manager configuration JSON file.
5149
@@ -68,9 +66,7 @@ def create_launch_manager_config(
6866
"defaults": {
6967
"deployment_config": {
7068
"bin_dir": "/tmp/lifecycle_test/bin/",
71-
"ready_recovery_action": {
72-
"restart": {"number_of_attempts": 1, "delay_before_restart": 0.5}
73-
},
69+
"ready_recovery_action": {"restart": {"number_of_attempts": 1, "delay_before_restart": 0.5}},
7470
"sandbox": {
7571
"uid": 0,
7672
"gid": 0,
@@ -90,9 +86,7 @@ def create_launch_manager_config(
9086
},
9187
"run_target": {
9288
"transition_timeout": 5,
93-
"recovery_action": {
94-
"switch_run_target": {"run_target": "fallback_run_target"}
95-
},
89+
"recovery_action": {"switch_run_target": {"run_target": "fallback_run_target"}},
9690
},
9791
},
9892
"components": components,

feature_integration_tests/test_cases/tests/lifecycle/test_dependency_ordering.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ def test_sequential_checkpoints_reported(
7272
if version == "cpp":
7373
# For C++ scenarios, check stdout directly
7474
for i in range(4):
75-
assert f"Reported checkpoint init_step_{i} in sequence" in results.stdout, f"Checkpoint init_step_{i} was not reported"
75+
assert f"Reported checkpoint init_step_{i} in sequence" in results.stdout, (
76+
f"Checkpoint init_step_{i} was not reported"
77+
)
7678
else:
7779
# Verify each checkpoint was reported in order
7880
for i in range(4):
7981
checkpoint_logs = logs_info_level.get_logs(
8082
field="message", pattern=f"Reported checkpoint init_step_{i} in sequence"
8183
)
82-
assert (
83-
len(checkpoint_logs) > 0
84-
), f"Checkpoint init_step_{i} was not reported"
84+
assert len(checkpoint_logs) > 0, f"Checkpoint init_step_{i} was not reported"
8585

8686
def test_sequential_supervision_completed(
8787
self, results: ScenarioResult, logs_info_level: LogContainer, version: str
@@ -94,7 +94,9 @@ def test_sequential_supervision_completed(
9494
if version == "cpp":
9595
# For C++ scenarios, check stdout directly
9696
assert "Would initialize health monitoring with" in results.stdout, "Health monitoring setup not mentioned"
97-
assert "All checkpoints reported in correct sequential order" in results.stdout, "No confirmation of sequential checkpoint reporting"
97+
assert "All checkpoints reported in correct sequential order" in results.stdout, (
98+
"No confirmation of sequential checkpoint reporting"
99+
)
98100
else:
99101
# Verify health monitor was initialized
100102
init_logs = logs_info_level.get_logs(
@@ -105,6 +107,4 @@ def test_sequential_supervision_completed(
105107
completion_logs = logs_info_level.get_logs(
106108
field="message", value="All checkpoints reported in correct sequential order"
107109
)
108-
assert (
109-
len(completion_logs) > 0
110-
), "No confirmation of sequential checkpoint reporting"
110+
assert len(completion_logs) > 0, "No confirmation of sequential checkpoint reporting"

feature_integration_tests/test_cases/tests/lifecycle/test_parallel_launching.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ def test_parallel_monitors_started(
7878
monitor_logs = logs_info_level.get_logs(
7979
field="message", pattern=f"Parallel monitor {i} started deadline"
8080
)
81-
assert (
82-
len(monitor_logs) > 0
83-
), f"Parallel monitor {i} did not start"
81+
assert len(monitor_logs) > 0, f"Parallel monitor {i} did not start"
8482

8583
def test_parallel_monitors_completed(
8684
self, results: ScenarioResult, logs_info_level: LogContainer, version: str
@@ -94,16 +92,14 @@ def test_parallel_monitors_completed(
9492
# For C++ scenarios, check stdout directly
9593
for i in range(4):
9694
assert f"Parallel monitor {i} completed" in results.stdout, f"Parallel monitor {i} did not complete"
97-
assert "parallel monitors completed successfully" in results.stdout, "Not all parallel monitors completed successfully"
95+
assert "parallel monitors completed successfully" in results.stdout, (
96+
"Not all parallel monitors completed successfully"
97+
)
9898
else:
9999
# Verify that all monitors completed
100100
for i in range(4):
101-
completion_logs = logs_info_level.get_logs(
102-
field="message", pattern=f"Parallel monitor {i} completed"
103-
)
104-
assert (
105-
len(completion_logs) > 0
106-
), f"Parallel monitor {i} did not complete"
101+
completion_logs = logs_info_level.get_logs(field="message", pattern=f"Parallel monitor {i} completed")
102+
assert len(completion_logs) > 0, f"Parallel monitor {i} did not complete"
107103

108104
# Verify final confirmation
109105
final_logs = logs_info_level.get_logs(

feature_integration_tests/test_cases/tests/lifecycle/test_process_launching.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,8 @@ def test_execution_state_reported(
7373
if version == "cpp":
7474
assert "Lifecycle client API called" in results.stdout, "Lifecycle client API was not called"
7575
else:
76-
api_logs = logs_info_level.get_logs(
77-
field="message", pattern="Lifecycle client API called"
78-
)
79-
assert (
80-
len(api_logs) > 0
81-
), "Lifecycle client API was not called"
76+
api_logs = logs_info_level.get_logs(field="message", pattern="Lifecycle client API called")
77+
assert len(api_logs) > 0, "Lifecycle client API was not called"
8278

8379
def test_lifecycle_client_integration(
8480
self, results: ScenarioResult, logs_info_level: LogContainer, version: str
@@ -89,15 +85,15 @@ def test_lifecycle_client_integration(
8985
assert results.return_code == ResultCode.SUCCESS
9086

9187
if version == "cpp":
92-
assert "Testing lifecycle client API integration" in results.stdout, "Lifecycle client integration test not started"
88+
assert "Testing lifecycle client API integration" in results.stdout, (
89+
"Lifecycle client integration test not started"
90+
)
9391
assert "Application completed successfully" in results.stdout, "Application did not complete successfully"
9492
else:
9593
integration_logs = logs_info_level.get_logs(
9694
field="message", value="Testing lifecycle client API integration"
9795
)
9896
assert len(integration_logs) > 0, "Lifecycle client integration test not started"
9997

100-
completion_logs = logs_info_level.get_logs(
101-
field="message", value="Application completed successfully"
102-
)
98+
completion_logs = logs_info_level.get_logs(field="message", value="Application completed successfully")
10399
assert len(completion_logs) > 0, "Application did not complete successfully"

feature_integration_tests/test_scenarios/rust/src/scenarios/lifecycle/launch_manager_support.rs

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ impl Scenario for ProcessLaunchingSupport {
5050
}
5151

5252
fn run(&self, input: &str) -> Result<(), String> {
53-
let test_input =
54-
LifecycleTestInput::from_json(input).map_err(|e| format!("Parse error: {}", e))?;
53+
let test_input = LifecycleTestInput::from_json(input).map_err(|e| format!("Parse error: {}", e))?;
5554

5655
info!("Testing lifecycle client API integration");
5756

@@ -88,8 +87,7 @@ impl Scenario for DependencyOrdering {
8887
}
8988

9089
fn run(&self, input: &str) -> Result<(), String> {
91-
let test_input =
92-
LifecycleTestInput::from_json(input).map_err(|e| format!("Parse error: {}", e))?;
90+
let test_input = LifecycleTestInput::from_json(input).map_err(|e| format!("Parse error: {}", e))?;
9391

9492
info!("Testing sequential deadline reporting for ordered supervision");
9593

@@ -103,23 +101,21 @@ impl Scenario for DependencyOrdering {
103101
let mut deadline_builder = deadline::DeadlineMonitorBuilder::new();
104102
deadline_builder = deadline_builder.add_deadline(
105103
DeadlineTag::from(format!("init_step_{}", i)),
106-
TimeRange::new(
107-
Duration::from_millis(50),
108-
Duration::from_millis(300),
109-
),
110-
);
111-
hm_builder = hm_builder.add_deadline_monitor(
112-
MonitorTag::from(format!("step_monitor_{}", i)),
113-
deadline_builder,
104+
TimeRange::new(Duration::from_millis(50), Duration::from_millis(300)),
114105
);
106+
hm_builder =
107+
hm_builder.add_deadline_monitor(MonitorTag::from(format!("step_monitor_{}", i)), deadline_builder);
115108
}
116109

117110
let _hm = hm_builder
118111
.build()
119112
.map_err(|e| format!("Failed to build health monitor: {:?}", e))?;
120113

121114
// Start monitoring (note: in test env without supervisor daemon, this is demonstration only)
122-
info!("Health monitor initialized with {} sequential deadline monitors", test_input.checkpoint_count);
115+
info!(
116+
"Health monitor initialized with {} sequential deadline monitors",
117+
test_input.checkpoint_count
118+
);
123119

124120
// Demonstrate sequential API usage
125121
for i in 0..test_input.checkpoint_count {
@@ -147,8 +143,7 @@ impl Scenario for ParallelLaunching {
147143
}
148144

149145
fn run(&self, input: &str) -> Result<(), String> {
150-
let test_input =
151-
LifecycleTestInput::from_json(input).map_err(|e| format!("Parse error: {}", e))?;
146+
let test_input = LifecycleTestInput::from_json(input).map_err(|e| format!("Parse error: {}", e))?;
152147

153148
info!("Testing parallel health monitoring with multiple monitors");
154149

@@ -162,15 +157,9 @@ impl Scenario for ParallelLaunching {
162157
let mut deadline_builder = deadline::DeadlineMonitorBuilder::new();
163158
deadline_builder = deadline_builder.add_deadline(
164159
DeadlineTag::from(format!("parallel_task_{}", i)),
165-
TimeRange::new(
166-
Duration::from_millis(50),
167-
Duration::from_millis(200),
168-
),
169-
);
170-
hm_builder = hm_builder.add_deadline_monitor(
171-
MonitorTag::from(format!("monitor_{}", i)),
172-
deadline_builder,
160+
TimeRange::new(Duration::from_millis(50), Duration::from_millis(200)),
173161
);
162+
hm_builder = hm_builder.add_deadline_monitor(MonitorTag::from(format!("monitor_{}", i)), deadline_builder);
174163
}
175164

176165
let _hm = hm_builder
@@ -198,7 +187,10 @@ impl Scenario for ParallelLaunching {
198187
handle.join().map_err(|_| "Thread join failed")?;
199188
}
200189

201-
info!("All {} parallel monitors completed successfully", test_input.checkpoint_count);
190+
info!(
191+
"All {} parallel monitors completed successfully",
192+
test_input.checkpoint_count
193+
);
202194

203195
Ok(())
204196
}

0 commit comments

Comments
 (0)