From 481f33b898ad77e404111f0adca31ea74e2d99bc Mon Sep 17 00:00:00 2001 From: Jiri Kortus Date: Mon, 8 Apr 2019 11:00:41 +0200 Subject: [PATCH] Add test for passing custom option on kernel command line Related: rhbz#1688335 --- tests/cli/lib/lib.sh | 6 ++++++ tests/cli/test_build_and_deploy_openstack.sh | 4 ++++ tests/cli/test_build_and_deploy_vmware.sh | 3 +++ tests/cli/test_compose_qcow2.sh | 3 +++ tests/test_cli.sh | 8 ++++++++ 5 files changed, 24 insertions(+) diff --git a/tests/cli/lib/lib.sh b/tests/cli/lib/lib.sh index 02e7d705..9aeb9631 100755 --- a/tests/cli/lib/lib.sh +++ b/tests/cli/lib/lib.sh @@ -8,6 +8,7 @@ verify_image() { SSH_OPTS="-o StrictHostKeyChecking=no $3" rlLogInfo "verify_image: SSH_OPTS:'$SSH_OPTS' SSH_USER:'$SSH_USER' SSH_MACHINE: '$SSH_MACHINE'" check_root_account "$@" + check_kernel_cmdline "$@" } check_root_account() { @@ -42,3 +43,8 @@ check_root_account() { rlRun -t -c "ssh $SSH_OPTS ${SSH_USER}@${SSH_MACHINE} 'cat /etc/redhat-release'" } +# verify that a kernel command line argument was passed from the blueprint (this is added to the blueprint in ../test_cli.sh) +check_kernel_cmdline() { + rlRun -t -c "ssh $SSH_OPTS ${SSH_USER}@${SSH_MACHINE} 'grep custom_cmdline_arg /proc/cmdline'" 0 \ + "System booted from the image contains specified parameter on kernel command line" +} diff --git a/tests/cli/test_build_and_deploy_openstack.sh b/tests/cli/test_build_and_deploy_openstack.sh index 6a066222..39833772 100755 --- a/tests/cli/test_build_and_deploy_openstack.sh +++ b/tests/cli/test_build_and_deploy_openstack.sh @@ -65,6 +65,10 @@ version = "*" [[packages]] name = "rng-tools" version = "*" + +[customizations.kernel] +append = "custom_cmdline_arg" + __EOF__ rlRun -t -c "$CLI blueprints push $TMP_DIR/http-with-rng.toml" diff --git a/tests/cli/test_build_and_deploy_vmware.sh b/tests/cli/test_build_and_deploy_vmware.sh index a157ee3c..c0f5ef55 100755 --- a/tests/cli/test_build_and_deploy_vmware.sh +++ b/tests/cli/test_build_and_deploy_vmware.sh @@ -83,6 +83,9 @@ version = "*" [[customizations.user]] name = "root" key = "$PUB_KEY" + +[customizations.kernel] +append = "custom_cmdline_arg" __EOF__ rlRun -t -c "$CLI blueprints push $TMP_DIR/vmware.toml" diff --git a/tests/cli/test_compose_qcow2.sh b/tests/cli/test_compose_qcow2.sh index 1a6c23b3..c8171d71 100755 --- a/tests/cli/test_compose_qcow2.sh +++ b/tests/cli/test_compose_qcow2.sh @@ -43,6 +43,9 @@ version = "*" [[customizations.user]] name = "root" key = "$PUB_KEY" + +[customizations.kernel] +append = "custom_cmdline_arg" __EOF__ rlRun -t -c "$CLI blueprints push $TMP_DIR/with-ssh.toml" diff --git a/tests/test_cli.sh b/tests/test_cli.sh index 402bb898..eb68c83e 100755 --- a/tests/test_cli.sh +++ b/tests/test_cli.sh @@ -15,6 +15,14 @@ function setup_tests { /%post/ && FLAG != 2 {FLAG=1} /%end/ && FLAG == 1 {print \"sed -i 's/.*PermitEmptyPasswords.*/PermitEmptyPasswords yes/' /etc/ssh/sshd_config\"; FLAG=2} {print}" $1/composer/live-iso.ks)" > $1/composer/live-iso.ks + + # append a section with additional option on kernel command line to example-http-server blueprint + # which is used for building of most of the images + cat >> $BLUEPRINTS_DIR/example-http-server.toml << __EOF__ + +[customizations.kernel] +append = "custom_cmdline_arg" +__EOF__ } function teardown_tests {