From aeee565897eb373ba0bfabd94f6c5148b1027eb2 Mon Sep 17 00:00:00 2001 From: Kimmo Lehto Date: Mon, 2 Dec 2024 13:05:27 +0200 Subject: [PATCH] Further validate when a reinstall happens Signed-off-by: Kimmo Lehto --- smoke-test/smoke-reinstall.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/smoke-test/smoke-reinstall.sh b/smoke-test/smoke-reinstall.sh index 0c93955d..0451a555 100755 --- a/smoke-test/smoke-reinstall.sh +++ b/smoke-test/smoke-reinstall.sh @@ -22,18 +22,31 @@ remoteCommand() { } echo "Installing ${K0S_VERSION}" -../k0sctl apply --config "${K0SCTL_CONFIG}" --debug +../k0sctl apply --config "${K0SCTL_CONFIG}" --debug | tee apply.log +echo "Initial apply should not perform a re-install" +grep -ivq "reinstalling" apply.log + +echo "Install flags should contain the expected flag on a controller" remoteCommand "root@manager0" "k0s status -o json | grep -q -- ${K0S_CONTROLLER_FLAG}" + +echo "Install flags should contain the expected flag on a worker" remoteCommand "root@worker0" "k0s status -o json | grep -q -- ${K0S_WORKER_FLAG}" echo "A re-apply should not re-install if there are no changes" -../k0sctl apply --config "${K0SCTL_CONFIG}" --debug | grep -ivq "reinstalling" +../k0sctl apply --config "${K0SCTL_CONFIG}" --debug | tee apply.log +grep -ivq "reinstalling" apply.log export K0S_CONTROLLER_FLAG="--labels=smoke-stage=2" export K0S_WORKER_FLAG="--labels=smoke-stage=2" envsubst < "k0sctl-installflags.yaml.tpl" > "${K0SCTL_CONFIG}" echo "Re-applying ${K0S_VERSION} with modified installFlags" -../k0sctl apply --config "${K0SCTL_CONFIG}" --debug +../k0sctl apply --config "${K0SCTL_CONFIG}" --debug | tee apply.log +echo "A re-apply should perform a re-install if there are changes" +grep -iq "reinstalling" apply.log + +echo "Install flags should change for controller" remoteCommand "root@manager0" "k0s status -o json | grep -q -- ${K0S_CONTROLLER_FLAG}" + +echo "Install flags should change for worker" remoteCommand "root@worker0" "k0s status -o json | grep -q -- ${K0S_WORKER_FLAG}"