From 7e82ddeb226d3f683332d74750f99a3294fb6659 Mon Sep 17 00:00:00 2001 From: Aneesh Karve Date: Tue, 12 Jan 2021 15:45:59 -0700 Subject: [PATCH] repair unit tests with new _source fields --- lambdas/search/tests/test_search.py | 37 +++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/lambdas/search/tests/test_search.py b/lambdas/search/tests/test_search.py index bf83b309be0..07430f51207 100644 --- a/lambdas/search/tests/test_search.py +++ b/lambdas/search/tests/test_search.py @@ -302,8 +302,19 @@ def test_search(self): 'size': 1000, 'from': 0, '_source': ','.join([ - 'key', 'version_id', 'updated', 'last_modified', 'size', 'user_meta', - 'comment', 'handle', 'hash', 'tags', 'metadata', 'pointer_file' + 'key', + 'version_id', + 'updated', + 'last_modified', + 'size', + 'user_meta', + 'comment', + 'handle', + 'hash', + 'tags', + 'metadata', + 'pointer_file', + 'delete_marker', ]), 'terminate_after': 538, }) @@ -342,8 +353,19 @@ def test_search_retry(self): 'size': 1000, 'from': 0, '_source': ','.join([ - 'key', 'version_id', 'updated', 'last_modified', 'size', 'user_meta', - 'comment', 'handle', 'hash', 'tags', 'metadata', 'pointer_file' + 'key', + 'version_id', + 'updated', + 'last_modified', + 'size', + 'user_meta', + 'comment', + 'handle', + 'hash', + 'tags', + 'metadata', + 'pointer_file', + 'delete_marker', ]), 'terminate_after': 10000, }) @@ -393,13 +415,14 @@ def test_stats(self): def _callback(request): payload = json.loads(request.body) assert payload == { - "query": {"match_all": {}}, + "query": {"term": {"delete_marker": False}}, "aggs": { - "totalBytes": {"sum": {"field": "size"}}, + "totalBytes": {"sum": {"field": 'size'}}, "exts": { "terms": {"field": 'ext'}, - "aggs": {"size": {"sum": {"field": "size"}}}, + "aggs": {"size": {"sum": {"field": 'size'}}}, }, + # TODO: move this to a separate action (pkg_stats) "totalPackageHandles": {"value_count": {"field": "handle"}}, } }