Skip to content

Commit d09dd75

Browse files
authored
Revert "updated: prep for new updater (commaai#31695)" (commaai#31860)
* Revert "updated: prep for new updater (commaai#31695)" This reverts commit b93f6ce. * fix the test
1 parent 0efb62c commit d09dd75

File tree

4 files changed

+274
-390
lines changed

4 files changed

+274
-390
lines changed

selfdrive/updated/common.py

-115
This file was deleted.

selfdrive/updated/git.py

-236
This file was deleted.

selfdrive/updated/tests/test_base.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ def update_release(directory, name, version, agnos_version, release_notes):
3737
os.symlink("common/version.h", test_symlink)
3838

3939

40+
def get_version(path: str) -> str:
41+
with open(os.path.join(path, "common", "version.h")) as f:
42+
return f.read().split('"')[1]
43+
44+
45+
def get_consistent_flag(path: str) -> bool:
46+
consistent_file = pathlib.Path(os.path.join(path, ".overlay_consistent"))
47+
return consistent_file.is_file()
48+
49+
4050
@pytest.mark.slow # TODO: can we test overlayfs in GHA?
4151
class BaseUpdateTest(unittest.TestCase):
4252
@classmethod
@@ -109,11 +119,10 @@ def _test_params(self, branch, fetch_available, update_available):
109119
self.assertEqual(self.params.get_bool("UpdateAvailable"), update_available)
110120

111121
def _test_finalized_update(self, branch, version, agnos_version, release_notes):
112-
from openpilot.selfdrive.updated.common import get_version, get_consistent_flag # this needs to be inline because common uses environment variables
113122
self.assertTrue(self.params.get("UpdaterNewDescription", encoding="utf-8").startswith(f"{version} / {branch}"))
114123
self.assertEqual(self.params.get("UpdaterNewReleaseNotes", encoding="utf-8"), f"<p>{release_notes}</p>\n")
115124
self.assertEqual(get_version(str(self.staging_root / "finalized")), version)
116-
self.assertEqual(get_consistent_flag(), True)
125+
self.assertEqual(get_consistent_flag(str(self.staging_root / "finalized")), True)
117126

118127
with open(self.staging_root / "finalized" / "test_symlink") as f:
119128
self.assertIn(version, f.read())

0 commit comments

Comments
 (0)