From ddbdbb869f84a401563437d558d3235807ba3e82 Mon Sep 17 00:00:00 2001 From: Dan Bungert Date: Tue, 28 Sep 2021 18:27:59 -0600 Subject: [PATCH] storage/v2: reuse existing partitions Add test for flow of reusing existing partitions. Certain operations are allowed, such as formatting and using an existing partition, or mounting a partition without formatting it. Creating new in free space is off limits, as is deleting a partition (even if it is just about to be added again). --- subiquity/tests/api/test_api.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/subiquity/tests/api/test_api.py b/subiquity/tests/api/test_api.py index d77c60e6..030fa4f1 100755 --- a/subiquity/tests/api/test_api.py +++ b/subiquity/tests/api/test_api.py @@ -297,6 +297,26 @@ class TestWin10Start(TestAPI): with self.assertRaises(Exception): await self.post('/storage/v2/delete_partition', data) + @timeout(5) + async def test_v2_reuse(self): + disk_id = 'disk-sda' + data = { + 'disk_id': disk_id, + 'partition': { + 'size': 0, + 'number': 3, + 'format': 'ext4', + 'mount': '/', + 'grub_device': False, + # 'preserve': False, + } + } + resp = await self.post('/storage/v2/edit_partition', data) + json_print(resp) + await self.post('/storage/v2') + # resp = await self.get('/storage') + # json_print(resp) + # class TestDebug(TestAPI): # machine_config = 'examples/win10.json' # need_spawn_server = False