feat(packaging): implement packaging (.tar.gz, .deb, .rpm), FHS logging, and container integration test matrix
This commit is contained in:
1 parent
6e18bdf7b7
commit
e1a99d7e6f
20 files changed
+789
-21
No files matched your search
@@ -122,6 +122,7 @@ class TestCLIIntegration(unittest.TestCase):
|
||||
self.assertEqual(code, 0)
|
||||
mock_manager.release_upgrade.assert_called_once_with(
|
||||
target_release="41",
|
||||
dry_run=False,
|
||||
non_interactive=True,
|
||||
)
|
||||
|
||||
@@ -143,6 +144,43 @@ class TestCLIIntegration(unittest.TestCase):
|
||||
if t_path.exists():
|
||||
t_path.unlink()
|
||||
|
||||
@patch("linux_updater.cli.DistroDetector.detect")
|
||||
@patch("linux_updater.cli.get_manager")
|
||||
def test_logging_creates_timestamped_log_and_symlink(self, mock_get_manager, mock_detect):
|
||||
mock_detect.return_value = DistroInfo(DistroFamily.DEBIAN, "ubuntu", "24.04", "Ubuntu 24.04")
|
||||
mock_manager = MagicMock()
|
||||
mock_manager.get_lock_files.return_value = []
|
||||
mock_get_manager.return_value = mock_manager
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||
config_data = {
|
||||
"logging": {"log_dir": tmp_dir, "verbose": True}
|
||||
}
|
||||
cfg_file = Path(tmp_dir) / "config.json"
|
||||
cfg_file.write_text(json.dumps(config_data))
|
||||
|
||||
with patch("os.statvfs") as mock_statvfs:
|
||||
mock_stat = MagicMock()
|
||||
mock_stat.f_bavail = 10 * 1024 * 1024
|
||||
mock_stat.f_frsize = 1024
|
||||
mock_statvfs.return_value = mock_stat
|
||||
|
||||
code = main(["-c", str(cfg_file), "health"])
|
||||
self.assertEqual(code, 0)
|
||||
|
||||
# Check that log file was created
|
||||
log_files = list(Path(tmp_dir).glob("linux-updater-*.log"))
|
||||
self.assertEqual(len(log_files), 1)
|
||||
# Check latest.log symlink
|
||||
latest_link = Path(tmp_dir) / "latest.log"
|
||||
self.assertTrue(latest_link.is_symlink())
|
||||
self.assertEqual(latest_link.resolve(), log_files[0].resolve())
|
||||
|
||||
# Check content of log file
|
||||
content = log_files[0].read_text()
|
||||
self.assertIn("Linux System Updater", content)
|
||||
self.assertIn("started", content)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user