test_updated: check the version and consistency of finalized dir (#31808)

* check finalized

* also check consistent
old-commit-hash: bc81daee8b
pull/32199/head
Justin Newberry 2 years ago committed by GitHub
parent 02a16c3eb4
commit f767f65f66
  1. 11
      selfdrive/updated/tests/test_base.py

@ -104,9 +104,12 @@ class BaseUpdateTest(unittest.TestCase):
self.assertEqual(self.params.get_bool("UpdaterFetchAvailable"), fetch_available)
self.assertEqual(self.params.get_bool("UpdateAvailable"), update_available)
def _test_update_params(self, branch, version, agnos_version, release_notes):
def _test_finalized_update(self, branch, version, agnos_version, release_notes):
from openpilot.selfdrive.updated.common import get_version, get_consistent_flag # this needs to be inline because common uses environment variables
self.assertTrue(self.params.get("UpdaterNewDescription", encoding="utf-8").startswith(f"{version} / {branch}"))
self.assertEqual(self.params.get("UpdaterNewReleaseNotes", encoding="utf-8"), f"<p>{release_notes}</p>\n")
self.assertEqual(get_version(str(self.staging_root / "finalized")), version)
self.assertEqual(get_consistent_flag(), True)
def wait_for_condition(self, condition, timeout=12):
start = time.monotonic()
@ -170,7 +173,7 @@ class BaseUpdateTest(unittest.TestCase):
self.wait_for_update_available()
self._test_params("release3", False, True)
self._test_update_params("release3", *self.MOCK_RELEASES["release3"])
self._test_finalized_update("release3", *self.MOCK_RELEASES["release3"])
def test_switch_branches(self):
# Start on release3, request to switch to master manually, ensure we switched
@ -195,7 +198,7 @@ class BaseUpdateTest(unittest.TestCase):
self.wait_for_update_available()
self._test_params("master", False, True)
self._test_update_params("master", *self.MOCK_RELEASES["master"])
self._test_finalized_update("master", *self.MOCK_RELEASES["master"])
def test_agnos_update(self):
# Start on release3, push an update with an agnos change
@ -227,4 +230,4 @@ class BaseUpdateTest(unittest.TestCase):
self.wait_for_update_available()
self._test_params("release3", False, True)
self._test_update_params("release3", *self.MOCK_RELEASES["release3"])
self._test_finalized_update("release3", *self.MOCK_RELEASES["release3"])

Loading…
Cancel
Save