Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add regression test/fix for gh748 swap space creation #749

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions bib/cmd/bootc-image-builder/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/osbuild/images/pkg/customizations/anaconda"
"github.com/osbuild/images/pkg/customizations/kickstart"
"github.com/osbuild/images/pkg/customizations/users"
"github.com/osbuild/images/pkg/datasizes"
"github.com/osbuild/images/pkg/disk"
"github.com/osbuild/images/pkg/image"
"github.com/osbuild/images/pkg/manifest"
Expand Down Expand Up @@ -234,11 +235,18 @@ func genPartitionTableDiskCust(c *ManifestConfig, diskCust *blueprint.DiskCustom
return nil, err
}

// XXX: copied from images, take from container instead?
requiredDirectorySizes := map[string]uint64{
"/": 1 * datasizes.GiB,
"/usr": 2 * datasizes.GiB,
}
partOptions := &disk.CustomPartitionTableOptions{
PartitionTableType: basept.Type,
// XXX: not setting/defaults will fail to boot with btrfs/lvm
BootMode: platform.BOOT_HYBRID,
DefaultFSType: defaultFSType,
// ensure sensible defaults for /,/usr
RequiredMinSizes: requiredDirectorySizes,
}
return disk.NewCustomPartitionTable(diskCust, partOptions, rng)
}
Expand Down
6 changes: 6 additions & 0 deletions test/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,3 +725,9 @@ def test_manifest_disk_customization_lvm_swap(tmp_path, build_container):
"path": "none",
"options": "defaults",
} in filesystems
# run osbuild schema validation, see gh#748
if not testutil.has_executable("osbuild"):
pytest.skip("no osbuild executable")
osbuild_manifest_path = tmp_path / "manifest.json"
osbuild_manifest_path.write_bytes(output)
subprocess.run(["osbuild", osbuild_manifest_path.as_posix()], check=True)
4 changes: 2 additions & 2 deletions test/testutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ def maybe_create_disk_customizations(cfg, tc):
"minsize": "10 GiB",
"logical_volumes": [
{
"minsize": "10 GiB",
"fs_type": "xfs",
"mountpoint": "/",
"minsize": "1 GiB",
"mountpoint": "/var/log",
},
{
"minsize": "7 GiB",
Expand Down
Loading