feat(deploy): reliability API routes, atomic releases, version single-source

This commit is contained in:
2026-08-22 15:20:39 -06:00
parent aba08e36c7
commit 1bb15de258
10 changed files with 586 additions and 40 deletions
+23
View File
@@ -57,5 +57,28 @@ class ProfilesTest(unittest.TestCase):
self.state = {}
self.assertFalse(mk8_profiles.snapshot('empty'))
def test_path_rejects_traversal_and_bad_names(self):
for bad in ('../x', '..', 'a/b', '', 'a' * 65, './x', 'x/..',
'a b', 'a;b', None):
with self.assertRaises(ValueError):
mk8_profiles._path(bad)
def test_path_accepts_safe_names(self):
for good in ('p', 'pre-client_connect-123', 'lastknown-good',
'A.b-c_d', 'x' * 64, '0'):
path = mk8_profiles._path(good)
self.assertEqual(path, os.path.join(mk8_profiles.PROFILES_DIR,
good))
def test_snapshot_rejects_bad_name_without_side_effects(self):
with self.assertRaises(ValueError):
mk8_profiles.snapshot('../evil')
self.assertEqual(mk8_profiles.list_profiles(), [])
def test_list_profiles_skips_invalid_dirnames(self):
mk8_profiles.snapshot('good')
os.mkdir(os.path.join(mk8_profiles.PROFILES_DIR, 'bad name'))
self.assertEqual(mk8_profiles.list_profiles(), ['good'])
if __name__ == '__main__':
unittest.main()