Skip to content

Commit 7a6aa28

Browse files
committed
Rename onFailure to on_failure to match casing convention
Change-Id: Ifbd98ceb330ceed47a01cc560bf40885bc16b443
1 parent fa76f83 commit 7a6aa28

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ Below details the health check modules available as part of the solution, with s
9393
| CheckDataVolumes | Checks that the expected # of Data Volumes are 100% imported and ready | **namespace**: namespace to run check against <br > **count**: (Optional) expected # of DVs |
9494
| CheckHttpEndpoints | Checks that a list of HTTP endpoints are reachable and return a successful status code | **endpoints**: A list of HTTP endpoints to check. Each endpoint has the following parameters: <ul><li> **name**: The name of the endpoint </li><li> **url**: The URL of the endpoint </li><li> **timeout**: (Optional) The timeout in seconds for the request </li><li> **method**: (Optional) The HTTP method to use (e.g. 'GET', 'POST') </li></ul> |
9595

96-
### onFailure property
96+
### on_failure property
9797

98-
Each health check module supports an `onFailure` property that allows you to control the behavior of the health check when it fails. The `onFailure` property can be set to one of two values:
98+
Each health check module supports an `on_failure` property that allows you to control the behavior of the health check when it fails. The `on_failure` property can be set to one of two values:
9999

100100
- `fail` (default): If the health check fails, the entire group of checks (platform or workload) will be considered failed.
101101
- `ignore`: If the health check fails, the failure will be logged and tracked in metrics, but it will not affect the overall health status of the group.
@@ -110,17 +110,17 @@ platform_checks:
110110
module: CheckNodes
111111
- name: Robin Cluster Health
112112
module: CheckRobinCluster
113-
onFailure: ignore
113+
on_failure: ignore
114114

115115
workload_checks:
116116
- name: VM Workloads Health
117117
module: CheckVirtualMachines
118118
parameters:
119119
namespace: vm-workloads
120-
onFailure: fail
120+
on_failure: fail
121121
- name: VM Disk Health
122122
module: CheckVirtualMachineDisks
123-
onFailure: ignore
123+
on_failure: ignore
124124
```
125125
126126
## Building the image

app/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def wait_on_futures(futures):
121121
for future in concurrent.futures.as_completed(futures):
122122
config = futures[future]
123123
name = config["name"]
124-
on_failure = config.get("onFailure", "fail")
124+
on_failure = config.get("on_failure", "fail")
125125
try:
126126
if not future.result():
127127
if on_failure == "fail":

app/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class HealthCheck(TypedDict):
2626
name: str
2727
module: str
2828
parameters: NotRequired[dict] = {}
29-
onFailure: NotRequired[str] = "fail"
29+
on_failure: NotRequired[str] = "fail"
3030

3131

3232
class Config(BaseModel):

app/test_app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ def test_run_checks_onfailure_ignore(self, mock_health_check_map, mock_health_ch
4444
{
4545
"name": "CheckNodes",
4646
"module": "CheckNodes",
47-
"onFailure": "ignore"
47+
"on_failure": "ignore"
4848
},
4949
{
5050
"name": "CheckRobinCluster",
5151
"module": "CheckRobinCluster",
52-
"onFailure": "fail"
52+
"on_failure": "fail"
5353
}
5454
],
5555
workload_checks=[]
@@ -89,7 +89,7 @@ def test_run_checks_onfailure_fail(self, mock_health_check_map, mock_health_chec
8989
{
9090
"name": "CheckNodes",
9191
"module": "CheckNodes",
92-
"onFailure": "fail"
92+
"on_failure": "fail"
9393
}
9494
],
9595
workload_checks=[]

app/test_config.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ def test_optional_module_parameters(self):
3333
self.assertEqual(len(result.platform_checks), 4)
3434
self.assertEqual(len(result.workload_checks), 2)
3535

36-
def test_onfailure_property(self):
36+
def test_on_failure_property(self):
3737
os.environ["APP_CONFIG_PATH"] = "testdata/onfailure_config.yaml"
3838
result = read_config()
39-
self.assertEqual(result.platform_checks[1]["onFailure"], "ignore")
40-
self.assertEqual(result.workload_checks[0]["onFailure"], "fail")
41-
self.assertEqual(result.workload_checks[1]["onFailure"], "ignore")
39+
self.assertEqual(result.platform_checks[1]["on_failure"], "ignore")
40+
self.assertEqual(result.workload_checks[0]["on_failure"], "fail")
41+
self.assertEqual(result.workload_checks[1]["on_failure"], "ignore")
4242
# Check default value
43-
self.assertNotIn("onFailure", result.platform_checks[0])
43+
self.assertNotIn("on_failure", result.platform_checks[0])
4444

app/testdata/onfailure_config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ platform_checks:
33
module: CheckNodes
44
- name: Robin Cluster Health
55
module: CheckRobinCluster
6-
onFailure: ignore
6+
on_failure: ignore
77

88
workload_checks:
99
- name: VM Workloads Health
1010
module: CheckVirtualMachines
1111
parameters:
1212
namespace: vm-workloads
13-
onFailure: fail
13+
on_failure: fail
1414
- name: VM Disk Health
1515
module: CheckVirtualMachineDisks
16-
onFailure: ignore
16+
on_failure: ignore

0 commit comments

Comments
 (0)