Skip to content

Commit

Permalink
tests: update diagnostics test
Browse files Browse the repository at this point in the history
  • Loading branch information
anders-elastisys committed Nov 29, 2024
1 parent 880e561 commit 9483700
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bin/diagnostics.bash
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,18 @@ run_diagnostics() {
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
if [ -d "${CK8S_CONFIG_PATH}/capi" ]; then
# shellcheck disable=SC2002
capi_version=$(cat "${CK8S_CONFIG_PATH}"/capi/defaults/values.yaml | yq4 '.clusterApiVersion')
capi_version=$(cat "${CK8S_CONFIG_PATH}/capi/defaults/values.yaml" | yq4 '.clusterApiVersion')
echo "CAPI version: ${capi_version}"
elif [ -d "${CK8S_CONFIG_PATH}/sc-config" ]; then
elif [ -d "${CK8S_CONFIG_PATH}/${cluster}-config" ]; then
# shellcheck disable=SC2002
kubespray_version=$(cat "${CK8S_CONFIG_PATH}"/sc-config/group_vars/all/ck8s-kubespray-general.yaml | yq4 '.ck8sKubesprayVersion')
kubespray_version=$(cat "${CK8S_CONFIG_PATH}/${cluster}-config/group_vars/all/ck8s-kubespray-general.yaml" | yq4 '.ck8sKubesprayVersion')
echo "Kubespray version: ${kubespray_version}"
else
echo "Can't find config directory"
fi
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
# shellcheck disable=SC2002
apps_version=$(cat "${CK8S_CONFIG_PATH}"/defaults/common-config.yaml | yq4 '.global.ck8sVersion')
apps_version=$(cat "${CK8S_CONFIG_PATH}/defaults/common-config.yaml" | yq4 '.global.ck8sVersion')
echo "Apps version: ${apps_version}"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
# -- Nodes --
Expand Down Expand Up @@ -219,7 +219,7 @@ run_diagnostics() {
# -- Helm --
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
echo -e "\nFetching Helm releases that are not deployed (<helm>)"
helm=$("${here}"/ops.bash helm wc list -A --all -o yaml | yq4 '.[] | select(.status != "deployed")')
helm=$("${here}"/ops.bash helm "${cluster}" list -A --all -o yaml | yq4 '.[] | select(.status != "deployed")')
if [ -z "${helm}" ]; then
echo -e "All charts are deployed"
else
Expand Down
3 changes: 3 additions & 0 deletions tests/end-to-end/general/bin-diagnostics.bats
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ setup() {
load_file

export CK8S_AUTO_APPROVE=true
CK8S_PGP_FP=$(yq4 '.creation_rules[].pgp' "${CK8S_CONFIG_PATH}/.sops.yaml")
export CK8S_PGP_FP

with_kubeconfig sc
}
Expand All @@ -19,6 +21,7 @@ setup() {
}

@test "ck8s diagnostics creates diagnostics file" {
echo "If this test gets stuck here for too long, visit \"http://localhost:8000\" in your browser in case you need to authenticate" >&3
run ck8s diagnostics sc
assert_success

Expand Down

0 comments on commit 9483700

Please sign in to comment.