Skip to content

Commit

Permalink
Re-allow "unknown" value for staleness filter (#1574)
Browse files Browse the repository at this point in the history
  • Loading branch information
kruai authored Dec 6, 2023
1 parent 13f6f34 commit 586e0d7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/culling.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,5 @@ def _culled_timestamp(self):

def staleness_to_conditions(staleness, staleness_states, host_type, timestamp_filter_func):
condition = Conditions(staleness, host_type)
filtered_states = (state for state in staleness_states)
filtered_states = (state for state in staleness_states if state != "unknown")
return (timestamp_filter_func(*getattr(condition, state)(), host_type=host_type) for state in filtered_states)
2 changes: 2 additions & 0 deletions swagger/api.spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1156,6 +1156,7 @@ components:
- fresh
- stale
- stale_warning
- unknown
default:
- fresh
- stale
Expand All @@ -1173,6 +1174,7 @@ components:
- fresh
- stale
- stale_warning
- unknown
description: "Culling states of the hosts."
tagsParam:
name: tags
Expand Down
6 changes: 4 additions & 2 deletions swagger/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,8 @@
"enum": [
"fresh",
"stale",
"stale_warning"
"stale_warning",
"unknown"
]
},
"default": [
Expand All @@ -1892,7 +1893,8 @@
"enum": [
"fresh",
"stale",
"stale_warning"
"stale_warning",
"unknown"
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion tests/test_xjoin.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def test_query_variables_staleness(


def test_query_multiple_staleness(mocker, culling_datetime_mock, graphql_query_empty_response, api_get):
url = build_hosts_url(query="?staleness=fresh&staleness=stale_warning")
url = build_hosts_url(query="?staleness=fresh&staleness=stale_warning&staleness=unknown")
response_status, response_data = api_get(url)

assert response_status == 200
Expand Down

0 comments on commit 586e0d7

Please sign in to comment.