| 1 |
#!/usr/bin/python3 -cimport os, sys; os.execv(os.path.dirname(sys.argv[1]) + "/../common/pywrap", sys.argv) |
| 2 |
|
| 3 |
# |
| 4 |
# Copyright (C) 2023 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 TestStorageUnrecognized(storagelib.StorageCase): |
| 14 |
def test(self): |
| 15 |
m = self.machine |
| 16 |
b = self.browser |
| 17 |
|
| 18 |
self.login_and_go("/storage") |
| 19 |
|
| 20 |
disk = self.add_ram_disk() |
| 21 |
|
| 22 |
# Initially, new disks should have zeroes in their superblock |
| 23 |
# and be recognized as "unformatted" by Cockpit. |
| 24 |
|
| 25 |
self.click_card_row("Storage", name=disk) |
| 26 |
b.wait_visible(self.card("Unformatted data")) |
| 27 |
|
| 28 |
# This is the superblock of a legacy VDO device. Cockpit does |
| 29 |
# not recognize it. |
| 30 |
|
| 31 |
data = """ |
| 32 |
ZG12ZG8wMDEFAAAABAAAAAAAAABdAAAAAAAAAJQJAgCGsH0mrQgGAC4WnB4G50Fzu20jY6J1rfwA |
| 33 |
AAAAAQAAAAAAAAABAAAA2FwKAAAAAAAA////AAAAAAA7tw9zAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
| 34 |
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
| 35 |
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
| 36 |
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
| 37 |
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
| 38 |
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
| 39 |
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
| 40 |
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= |
| 41 |
""" |
| 42 |
m.execute(f"base64 -d >{disk}", input=data) |
| 43 |
# Wait for udev to settle and re-trigger, udisks sometimes misses udev events on ubuntu 2204. |
| 44 |
m.execute(f"udevadm settle; udevadm trigger {disk}") |
| 45 |
|
| 46 |
b.wait_text(self.card_desc("Unrecognized data", "Usage"), "other") |
| 47 |
b.wait_text(self.card_desc("Unrecognized data", "Type"), "vdo") |
| 48 |
|
| 49 |
|
| 50 |
if __name__ == '__main__': |
| 51 |
testlib.test_main() |