From a32c30d06c9b4c09b68b9214ef0207fa33c41355 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Mon, 13 Jan 2020 11:11:24 +0100 Subject: [PATCH] test: add simple check for kernel-cmdline stage Add a stage test to check that the new kopts stage is creating the target file /etc/kernel/cmdline with the right content. Since tree diff currently seems to lack support for content hashing new files we work around this by creating first an empty /etc/kernel/cmdline file and then get a content diff with the desired options set. --- test/stages_tests/kernel-cmdline/a.json | 29 ++++++++++++++++++++ test/stages_tests/kernel-cmdline/b.json | 32 ++++++++++++++++++++++ test/stages_tests/kernel-cmdline/diff.json | 12 ++++++++ 3 files changed, 73 insertions(+) create mode 100644 test/stages_tests/kernel-cmdline/a.json create mode 100644 test/stages_tests/kernel-cmdline/b.json create mode 100644 test/stages_tests/kernel-cmdline/diff.json diff --git a/test/stages_tests/kernel-cmdline/a.json b/test/stages_tests/kernel-cmdline/a.json new file mode 100644 index 00000000..61dfe7d9 --- /dev/null +++ b/test/stages_tests/kernel-cmdline/a.json @@ -0,0 +1,29 @@ +{ + "build": { + "pipeline": { + "stages": [ + { + "name": "org.osbuild.dnf", + "options": { + "releasever": "30", + "basearch": "x86_64", + "install_weak_deps": false, + "repos": [ + "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97" + ], + "packages": [ + "dnf" + ] + } + } + ] + }, + "runner": "org.osbuild.fedora30" + }, + "stages": [ + { + "name": "org.osbuild.kernel-cmdline", + "options": {} + } + ] +} diff --git a/test/stages_tests/kernel-cmdline/b.json b/test/stages_tests/kernel-cmdline/b.json new file mode 100644 index 00000000..de43f4de --- /dev/null +++ b/test/stages_tests/kernel-cmdline/b.json @@ -0,0 +1,32 @@ +{ + "build": { + "pipeline": { + "stages": [ + { + "name": "org.osbuild.dnf", + "options": { + "releasever": "30", + "basearch": "x86_64", + "install_weak_deps": false, + "repos": [ + "sha256:9f596e18f585bee30ac41c11fb11a83ed6b11d5b341c1cb56ca4015d7717cb97" + ], + "packages": [ + "dnf" + ] + } + } + ] + }, + "runner": "org.osbuild.fedora30" + }, + "stages": [ + { + "name": "org.osbuild.kernel-cmdline", + "options": { + "root_fs_uuid": "76a22bf4-f153-4541-b6c7-0332c0dfaeac", + "kernel_opts": "net.ifnames=0 crashkernel=auto" + } + } + ] +} diff --git a/test/stages_tests/kernel-cmdline/diff.json b/test/stages_tests/kernel-cmdline/diff.json new file mode 100644 index 00000000..6f88ddac --- /dev/null +++ b/test/stages_tests/kernel-cmdline/diff.json @@ -0,0 +1,12 @@ +{ + "added_files": [], + "deleted_files": [], + "differences": { + "/etc/kernel/cmdline": { + "content": [ + "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "sha256:f8636596eb6b9046fa1578df931790da5a8f6a8630749e3616c2d9adf45f9633" + ] + } + } +}