diff --git a/fmatch/matcher.py b/fmatch/matcher.py index 7928242..543ba40 100644 --- a/fmatch/matcher.py +++ b/fmatch/matcher.py @@ -92,8 +92,9 @@ def get_uuid_by_metadata(self, meta, index=None): s = Search(using=self.es, index=index).query(query).extra(size=self.search_size) result = self.query_index(index, s) hits = result.hits.hits - uuids = [hit.to_dict()["_source"]["uuid"] for hit in hits] - return uuids + uuids_docs = [{ "uuid":hit.to_dict()["_source"]["uuid"], + "buildUrl":hit.to_dict()["_source"]["buildUrl"]} for hit in hits] + return uuids_docs def match_kube_burner(self, uuids): """match kube burner runs diff --git a/fmatch/tests/test_matcher.py b/fmatch/tests/test_matcher.py index ba1f4cc..6b7d51b 100644 --- a/fmatch/tests/test_matcher.py +++ b/fmatch/tests/test_matcher.py @@ -59,7 +59,10 @@ def test_query_index(matcher_instance): def test_get_uuid_by_metadata(matcher_instance): matcher_instance.es.search = lambda *args, **kwargs: { "hits": { - "hits": [{"_source": {"uuid": "uuid1"}}, {"_source": {"uuid": "uuid2"}}] + "hits": [{"_source": {"uuid": "uuid1", + "buildUrl":"buildUrl1"}}, + {"_source": {"uuid": "uuid2", + "buildUrl":"buildUrl1"}}] } } meta = { @@ -67,7 +70,10 @@ def test_get_uuid_by_metadata(matcher_instance): "ocpVersion": "4.15", } result = matcher_instance.get_uuid_by_metadata(meta) - expected = ["uuid1", "uuid2"] + expected = [{"uuid": "uuid1", + "buildUrl":"buildUrl1"}, + {"uuid": "uuid2", + "buildUrl":"buildUrl1"}] assert result == expected