From 37ba407e4e67fa0c599ca3b4df10515e4779d799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Santiago=20Due=C3=B1as?= Date: Mon, 7 Oct 2024 18:48:32 +0200 Subject: [PATCH] [bugzillarest] Add keywords field to enriched indices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit adds the 'keywords' field to the enriched indices of bugzillarest. Signed-off-by: Santiago Dueñas --- grimoire_elk/enriched/bugzillarest.py | 3 +++ .../unreleased/keywords-data-on-enriched-items.yml | 8 ++++++++ tests/test_bugzillarest.py | 14 ++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 releases/unreleased/keywords-data-on-enriched-items.yml diff --git a/grimoire_elk/enriched/bugzillarest.py b/grimoire_elk/enriched/bugzillarest.py index 1d03df8ea..c929df21d 100644 --- a/grimoire_elk/enriched/bugzillarest.py +++ b/grimoire_elk/enriched/bugzillarest.py @@ -124,6 +124,9 @@ def get_rich_item(self, item): eitem["component"] = issue['component'] eitem["product"] = issue['product'] + # Keywords + eitem["keywords"] = issue['keywords'] + # Fix dates date_ts = str_to_datetime(issue['creation_time']) eitem['creation_ts'] = date_ts.strftime('%Y-%m-%dT%H:%M:%S') diff --git a/releases/unreleased/keywords-data-on-enriched-items.yml b/releases/unreleased/keywords-data-on-enriched-items.yml new file mode 100644 index 000000000..2e940fe3b --- /dev/null +++ b/releases/unreleased/keywords-data-on-enriched-items.yml @@ -0,0 +1,8 @@ +--- +title: Keywords data on enriched items +category: added +author: Santiago Dueñas +issue: null +notes: > + Keywords field is included now on the enriched + items of bugzilla and bugzillarest indices. diff --git a/tests/test_bugzillarest.py b/tests/test_bugzillarest.py index 3fef0db4a..d996575da 100644 --- a/tests/test_bugzillarest.py +++ b/tests/test_bugzillarest.py @@ -77,6 +77,20 @@ def test_enrich_repo_labels(self): eitem = enrich_backend.get_rich_item(item) self.assertIn(REPO_LABELS, eitem) + def test_enrich_keywords(self): + """Test whether keywords are included on the enriched items""" + + self._test_raw_to_enrich() + enrich_backend = self.connectors[self.connector][2]() + + for item in self.items[0:5]: + eitem = enrich_backend.get_rich_item(item) + self.assertEqual(eitem['keywords'], []) + + item = self.items[6] + eitem = enrich_backend.get_rich_item(item) + self.assertEqual(eitem['keywords'], ['crash', 'regression']) + def test_raw_to_enrich_sorting_hat(self): """Test enrich with SortingHat"""