Skip to content

Commit

Permalink
BATS: Fix lint issues
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Yen <[email protected]>
  • Loading branch information
mook-as committed Jun 18, 2024
1 parent 7a767a1 commit ff7056e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bats/tests/helpers/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ capture_logs() {
cp -LR "${PATH_LOGS}/" "$logdir"
echo "${BATS_TEST_DESCRIPTION:-teardown}" >"${logdir}/test_description"
# Capture settings.json
if [[ -f "$PATH_CONFIG_FILE" ]]; then
if [[ -f $PATH_CONFIG_FILE ]]; then
cp "$PATH_CONFIG_FILE" "$logdir"
fi
foreach_profile export_profile "$logdir"
Expand Down
23 changes: 11 additions & 12 deletions bats/tests/k8s/helm-install-rancher.bats
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,17 @@ deploy_rancher() {
try --max 60 --delay 10 kubectl get namespace cattle-system

try --max 60 --delay 10 kubectl get deployment --namespace cattle-fleet-system fleet-controller
try assert_kube_deployment_available --namespace cattle-fleet-system gitjob
try assert_kube_deployment_available --namespace cattle-fleet-system fleet-controller
try assert_kube_deployment_available --namespace cattle-fleet-system gitjob
try assert_kube_deployment_available --namespace cattle-fleet-system fleet-controller

try --max 120 --delay 10 assert_not_empty_list kubectl get pods --namespace cattle-system --selector app=rancher-webhook --output jsonpath='{.items}'

# Unfortunately, the webhook pod might restart too :(
try wait_for_webhook_pod

try --max 60 --delay 10 assert_kube_deployment_available --namespace cattle-system rancher
try --max 60 --delay 10 assert_kube_deployment_available --namespace cattle-fleet-local-system fleet-agent
try --max 120 --delay 10 assert_kube_deployment_available --namespace cattle-system rancher-webhook
try --max 60 --delay 10 assert_kube_deployment_available --namespace cattle-system rancher
try --max 60 --delay 10 assert_kube_deployment_available --namespace cattle-fleet-local-system fleet-agent
try --max 120 --delay 10 assert_kube_deployment_available --namespace cattle-system rancher-webhook

# The rancher pod sometimes falls over on its own; retry in a loop
local i
Expand All @@ -231,16 +231,16 @@ verify_rancher() {
fi

# Get k3s logs if possible before things fail
kubectl get deployments --all-namespaces ||:
kubectl get pods --all-namespaces ||:
kubectl get deployments --all-namespaces || :
kubectl get pods --all-namespaces || :
local name
name="$(kubectl get pod -n cattle-system --selector app=rancher --output=jsonpath='{.items[].metadata.name}' || echo '')"
if [[ -n "$name" ]]; then
kubectl logs -n cattle-system "$name" ||:
if [[ -n $name ]]; then
kubectl logs -n cattle-system "$name" || :
fi
name="$(kubectl get pod -n cattle-system --selector app=rancher-webhook --output=jsonpath='{.items[].metadata.name}' || echo '')"
if [[ -n "$name" ]]; then
kubectl logs -n cattle-system "$name" ||:
if [[ -n $name ]]; then
kubectl logs -n cattle-system "$name" || :
fi

local host
Expand All @@ -254,7 +254,6 @@ verify_rancher() {
assert_output --partial "bootstrapPassword"
}


@test 'add helm repo' {
helm repo add jetstack https://charts.jetstack.io
helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
Expand Down

0 comments on commit ff7056e

Please sign in to comment.