diff mbox series

[yocto-autobuilder-helper,2/4] scripts: send_qa_email: allow testing against non fixed tags

Message ID 20231217133032.27231-3-alexis.lothore@bootlin.com
State New
Headers show
Series Fix send_qa_email for releases with new major number | expand

Commit Message

Alexis Lothoré Dec. 17, 2023, 1:30 p.m. UTC
From: Alexis Lothoré <alexis.lothore@bootlin.com>

send_qa_email currently deals with tags in a "reproducible" way: despite
new versions being released on different branches, the computation of the
"reference" version for a specific input version always remain the same.

This behavior does not match perfectly real expectations: if at the some
point we get version 4.3.1 as a comparison reference for a regression
report, and 4.3.2 is released some time later, we want the next comparision
to be done against 4.3.2.

Start introducing this new behavior by allowing the tests to check returned
version against regex patterns instead of static strings, so we can for
example use wildcards on the "micro" version

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
 scripts/test_send_qa_email.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/scripts/test_send_qa_email.py b/scripts/test_send_qa_email.py
index 8ab91538748a..2dd946f32bf1 100755
--- a/scripts/test_send_qa_email.py
+++ b/scripts/test_send_qa_email.py
@@ -12,6 +12,7 @@  import sys
 import unittest
 import send_qa_email
 import logging
+import re
 
 logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
 log = logging.getLogger('send-qa-email')
@@ -60,7 +61,8 @@  class TestVersion(unittest.TestCase):
             input_version = data["input"]["version"]
             expected = data["expected"]
             with self.subTest(f"Test {input_version} previous tag (expecting {expected})"):
-                self.assertEqual(send_qa_email.get_previous_tag(os.environ.get("POKY_PATH"), input_version), expected)
+               result = send_qa_email.get_previous_tag(os.environ.get("POKY_PATH"), input_version)
+               self.assertIsNotNone(re.match(data["expected"], result), msg=f"get_previous_tag returned {result}")
 
     def test_is_release_version(self):
         for data in self.test_data_is_release_version: