Add unit test for org.osbuild.grub2.legacy
For now, test the content of /etc/default/grub configuration file. Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
b131d3cf57
commit
21ebed9305
1 changed files with 38 additions and 0 deletions
38
stages/test/test_grub2_legacy.py
Normal file
38
stages/test/test_grub2_legacy.py
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
STAGE_NAME = "org.osbuild.grub2.legacy"
|
||||||
|
|
||||||
|
|
||||||
|
# Test that the /etc/default/grub file is created with the correct content
|
||||||
|
def test_grub2_default_conf(tmp_path, stage_module):
|
||||||
|
treedir = tmp_path / "tree"
|
||||||
|
confpath = treedir / "etc/default/grub"
|
||||||
|
confpath.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
|
options = {
|
||||||
|
"rootfs": {
|
||||||
|
"label": "root"
|
||||||
|
},
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"id": "fff",
|
||||||
|
"kernel": "4.18",
|
||||||
|
"product": {
|
||||||
|
"name": "Fedora",
|
||||||
|
"version": "40"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
stage_module.main(treedir, options)
|
||||||
|
assert os.path.exists(confpath)
|
||||||
|
assert confpath.read_text() == """GRUB_TIMEOUT=0
|
||||||
|
GRUB_CMDLINE_LINUX=""
|
||||||
|
GRUB_DISABLE_SUBMENU=true
|
||||||
|
GRUB_DISABLE_RECOVERY=true
|
||||||
|
GRUB_TIMEOUT_STYLE=countdown
|
||||||
|
GRUB_DEFAULT=saved
|
||||||
|
"""
|
||||||
Loading…
Add table
Add a link
Reference in a new issue