Skip to content

Commit

Permalink
Revert "updated: prep for new updater (commaai#31695)" (commaai#31860)
Browse files Browse the repository at this point in the history
* Revert "updated: prep for new updater (commaai#31695)"

This reverts commit b93f6ce.

* fix the test
  • Loading branch information
jnewb1 authored Mar 13, 2024
1 parent 0efb62c commit d09dd75
Show file tree
Hide file tree
Showing 4 changed files with 274 additions and 390 deletions.
115 changes: 0 additions & 115 deletions selfdrive/updated/common.py

This file was deleted.

236 changes: 0 additions & 236 deletions selfdrive/updated/git.py

This file was deleted.

13 changes: 11 additions & 2 deletions selfdrive/updated/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ def update_release(directory, name, version, agnos_version, release_notes):
os.symlink("common/version.h", test_symlink)


def get_version(path: str) -> str:
with open(os.path.join(path, "common", "version.h")) as f:
return f.read().split('"')[1]


def get_consistent_flag(path: str) -> bool:
consistent_file = pathlib.Path(os.path.join(path, ".overlay_consistent"))
return consistent_file.is_file()


@pytest.mark.slow # TODO: can we test overlayfs in GHA?
class BaseUpdateTest(unittest.TestCase):
@classmethod
Expand Down Expand Up @@ -109,11 +119,10 @@ def _test_params(self, branch, fetch_available, update_available):
self.assertEqual(self.params.get_bool("UpdateAvailable"), update_available)

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)
self.assertEqual(get_consistent_flag(str(self.staging_root / "finalized")), True)

with open(self.staging_root / "finalized" / "test_symlink") as f:
self.assertIn(version, f.read())
Expand Down
Loading

0 comments on commit d09dd75

Please sign in to comment.