From 123b5c269d13ec12d127079e50152b9f9223e2fb 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 --- 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 5c0550ac..7ef2ecf5 100755 --- a/tests/cli/test_build_and_deploy_openstack.sh +++ b/tests/cli/test_build_and_deploy_openstack.sh @@ -60,6 +60,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 cbc515ea..b521f4cf 100755 --- a/tests/cli/test_build_and_deploy_vmware.sh +++ b/tests/cli/test_build_and_deploy_vmware.sh @@ -82,6 +82,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 48b58e4a..11d65e71 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 faa4c853..07bd1d96 100755 --- a/tests/test_cli.sh +++ b/tests/test_cli.sh @@ -15,6 +15,14 @@ function setup_tests { /%end/ && FLAG == 1 {print \"sed -i 's/.*PermitEmptyPasswords.*/PermitEmptyPasswords yes/' /etc/ssh/sshd_config\"; FLAG=2} {print}" \ $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 {