| 1 |
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv) |
| 2 |
|
| 3 |
# |
| 4 |
# Copyright (C) 2015 Red Hat, Inc. |
| 5 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 6 |
|
| 7 |
|
| 8 |
import storagelib |
| 9 |
import testlib |
| 10 |
|
| 11 |
|
| 12 |
@testlib.nondestructive |
| 13 |
class TestStorageMsDOS(storagelib.StorageCase): |
| 14 |
|
| 15 |
def testDosParts(self): |
| 16 |
b = self.browser |
| 17 |
|
| 18 |
self.login_and_go("/storage") |
| 19 |
|
| 20 |
# Add a disk |
| 21 |
disk = self.add_ram_disk() |
| 22 |
self.click_card_row("Storage", name=disk) |
| 23 |
|
| 24 |
# Format it with a DOS partition table |
| 25 |
self.click_card_dropdown("Solid State Drive", "Create partition table") |
| 26 |
self.dialog({"type": "dos"}) |
| 27 |
b.wait_text(self.card_row_col("DOS partitions", 1, 1), "Free space") |
| 28 |
|
| 29 |
# Create a primary partition |
| 30 |
self.click_dropdown(self.card_row("DOS partitions", 1), "Create partition") |
| 31 |
self.dialog({"size": 10, |
| 32 |
"type": "ext4", |
| 33 |
"mount_point": f"{self.mnt_dir}/foo", |
| 34 |
"name": "FIRST"}, |
| 35 |
secondary=True) |
| 36 |
b.wait_text(self.card_row_col("DOS partitions", 1, 2), "ext4 filesystem") |
| 37 |
|
| 38 |
# Open dialog for formatting the primary partition and check that "dos-extended" is not offered. |
| 39 |
self.click_card_row("DOS partitions", 1) |
| 40 |
self.click_card_dropdown("ext4 filesystem", "Format") |
| 41 |
self.dialog_wait_open() |
| 42 |
b.wait_not_present("select option[value='dos-extended']") |
| 43 |
self.dialog_cancel() |
| 44 |
self.dialog_wait_close() |
| 45 |
b.click(self.card_parent_link()) |
| 46 |
|
| 47 |
# Create a extended partition to fill the rest of the disk |
| 48 |
self.click_dropdown(self.card_row("DOS partitions", 2), "Create partition") |
| 49 |
self.dialog_wait_open() |
| 50 |
self.dialog_set_val("type", "dos-extended") |
| 51 |
self.dialog_wait_not_present("name") |
| 52 |
self.dialog_wait_not_present("mount_point") |
| 53 |
self.dialog_wait_not_present("mount_options") |
| 54 |
self.dialog_apply() |
| 55 |
self.dialog_wait_close() |
| 56 |
b.wait_text(self.card_row_col("DOS partitions", 2, 1), "Extended partition") |
| 57 |
b.wait_text(self.card_row_col("DOS partitions", 3, 1), "Free space") |
| 58 |
|
| 59 |
# Create logical partitions and check that "dos-extended" is |
| 60 |
# not offered. |
| 61 |
self.click_dropdown(self.card_row("DOS partitions", 3), "Create partition") |
| 62 |
self.dialog_wait_open() |
| 63 |
b.wait_not_present("select option[value='dos-extended']") |
| 64 |
self.dialog_set_val("size", 10) |
| 65 |
self.dialog_set_val("type", "ext4") |
| 66 |
self.dialog_set_val("name", "LOGICAL") |
| 67 |
self.dialog_apply_secondary() |
| 68 |
self.dialog_wait_close() |
| 69 |
|
| 70 |
# Check that we can navigate to the logical partition. This is |
| 71 |
# interesting since the intervening "Extended partition" row |
| 72 |
# can not be navigated to and should be omitted from the |
| 73 |
# breadcrumb. |
| 74 |
|
| 75 |
self.click_card_row("DOS partitions", 4) |
| 76 |
b.wait_text(self.card_desc("ext4 filesystem", "Name"), "LOGICAL") |
| 77 |
b.click(self.card_parent_link()) |
| 78 |
|
| 79 |
# Delete it |
| 80 |
|
| 81 |
self.click_dropdown(self.card_row("DOS partitions", 2), "Delete") |
| 82 |
self.confirm() |
| 83 |
|
| 84 |
b.wait_text(self.card_row_col("DOS partitions", 2, 1), "Free space") |
| 85 |
|
| 86 |
|
| 87 |
if __name__ == '__main__': |
| 88 |
testlib.test_main() |