Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Dec 1, 2023
1 parent 00c05c9 commit fe4cd8c
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 30 deletions.
10 changes: 5 additions & 5 deletions app/service/analyzer_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,23 @@ def add_constraints_for_launches_into_query(self, query: dict, launch) -> dict:
# Previous launches with the same name
must = self.create_path(query, ('query', 'bool', 'must'), [])
must_not = self.create_path(query, ('query', 'bool', 'must_not'), [])
must.append({'term': {'launch_name': {'value': launch_name}}})
must_not.append({'term': {'launch_id': {'value': launch_id}}})
must.append({'term': {'launch_name': launch_name}})
must_not.append({'term': {'launch_id': launch_id}})
elif analyzer_mode == 'CURRENT_AND_THE_SAME_NAME':
# All launches with the same name
must = self.create_path(query, ('query', 'bool', 'must'), [])
should = self.create_path(query, ('query', 'bool', 'should'), [])
must.append({'term': {'launch_name': {'value': launch_name}}})
must.append({'term': {'launch_name': launch_name}})
should.append({'term': {'launch_id': {'value': launch_id, 'boost': launch_boost}}})
elif analyzer_mode == 'CURRENT_LAUNCH':
# Just current launch
must = self.create_path(query, ('query', 'bool', 'must'), [])
must.append({'term': {'launch_id': {'value': launch_id}}})
must.append({'term': {'launch_id': launch_id}})
elif analyzer_mode == 'PREVIOUS_LAUNCH':
# Just previous launch
if previous_launch_id:
must = self.create_path(query, ('query', 'bool', 'must'), [])
must.append({'term': {'launch_id': {'value': previous_launch_id}}})
must.append({'term': {'launch_id': previous_launch_id}})
else:
# Just all launches
# Boost launches with the same name, but do not ignore any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
{"wildcard": {"issue_type": "ti*"}},
{"wildcard": {"issue_type": "nd*"}},
{"term": {"test_item": "123"}},
{"term": {"launch_id": {"value": 12}}}
{"term": {"launch_id": 12}}
],
"must": [
{"term": {
"launch_name": {
"value": "Launch name"
}
"launch_name": "Launch name"
}},
{"more_like_this": {
"fields": ["detected_message"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@
],
"must_not": [
{"term": {"issue_type": "ti001"}},
{"term": {"test_item": "123"}}
{"term": {"test_item": "123"}},
{"term": {"launch_id": 12}}
],
"must": [
{"term": {
"test_case_hash": 1
}},
{"term": {
"launch_name": {
"value": "Launch name"
}
"launch_name": "Launch name"
}},
{"more_like_this": {
"fields": ["message"],
Expand Down Expand Up @@ -52,7 +51,7 @@
"boost": 8.0
}}
],
"should": [{"term": {"launch_id": {"boost": 5, "value": 12}}}]
"should": []
}
},
"functions": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
"must_not": [
{"term": {"issue_type": "ti001"}},
{"term": {"test_item": "123"}},
{"term": {"launch_id": 12}},
{"wildcard": {"message": "*"}}
],
"must": [
{"term": {
"test_case_hash": 1
}},
{"term": {
"launch_name": {
"value": "Launch name"
}
"launch_name": "Launch name"
}},
{"more_like_this": {
"fields": ["merged_small_logs"],
Expand All @@ -44,7 +43,7 @@
"boost": 8.0
}}
],
"should": [{"term": {"launch_id": {"boost": 5, "value": 12}}}]
"should": []
}
},
"functions": [
Expand Down
6 changes: 6 additions & 0 deletions test_res/fixtures/query_merged_small_logs_search.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
"boost": 10
}
}},
{"term": {
"launch_id": {
"value": 12,
"boost": 5
}
}},
{"term": {
"launch_name": {
"value": "Launch name",
Expand Down
6 changes: 6 additions & 0 deletions test_res/fixtures/query_two_log_lines.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
"boost": 10
}
}},
{"term": {
"launch_id": {
"value": 12,
"boost": 5
}
}},
{"term": {
"launch_name": {
"value": "Launch name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
],
"must": [
{"term": {
"launch_id": {
"value": 12
}
"launch_id": 12
}},
{"more_like_this": {
"fields": ["message"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
],
"must": [
{"term": {
"launch_id": {
"value": 12
}
"launch_id": 12
}},
{"more_like_this": {
"fields": ["message"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"boost": 10
}
}},
{"term": {"launch_id": {"boost": 5, "value": 12}}},
{"term": {
"launch_name": {
"value": "Launch name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"boost": 10
}
}},
{"term": {"launch_id": {"boost": 5, "value": 12}}},
{"term": {
"launch_name": {
"value": "Launch name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
{"term": {"test_item": "123"}}
],
"must": [
{"term": {
"launch_name": {
"value": "Launch name"
}
}},
{"more_like_this": {
"fields": ["detected_message_without_params_extended"],
"like": "hello world",
Expand Down Expand Up @@ -62,7 +57,8 @@
"boost": 10
}
}},
{"term": {"launch_id": {"boost": 5, "value": 12}}},
{"term": {"launch_name": {"boost": 5, "value": "Launch name"}}},
{"term": {"launch_id": {"boost": 0.2, "value": 12}}},
{"more_like_this": {
"fields": ["merged_small_logs"],
"like": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"boost": 10
}
}},
{"term": {"launch_id": {"boost": 5, "value": 12}}},
{"term": {
"launch_name": {
"value": "Launch name",
Expand Down
1 change: 1 addition & 0 deletions test_res/fixtures/suggest_query_two_log_lines.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"boost": 10
}
}},
{"term": {"launch_id": {"boost": 5, "value": 12}}},
{"term": {
"launch_name": {
"value": "Launch name",
Expand Down

0 comments on commit fe4cd8c

Please sign in to comment.