Skip to content

Commit 958add8

Browse files
tests: fix various quoting issues found by shellcheck
Signed-off-by: John Mulligan <[email protected]>
1 parent 2c914dc commit 958add8

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

tests/test-deploy-ad-member.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ until [ $tries -ge 120 ] || echo $podstatus | grep -q 'Running'; do
2828
sleep 1
2929
echo -n "."
3030
tries=$(( tries + 1 ))
31-
podstatus="$(kubectl get pod $podname -o go-template='{{.status.phase}}')"
31+
podstatus="$(kubectl get pod "$podname" -o go-template='{{.status.phase}}')"
3232
done
3333
echo
3434
kubectl get pod
3535
echo
36-
echo $podstatus | grep -q 'Running' || _error "Pod did not reach Running state"
36+
echo "$podstatus" | grep -q 'Running' || _error "Pod did not reach Running state"
3737

3838
echo "waiting for samba to become reachable"
3939
tries=0

tests/test-deploy-ad-server.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ fi
1616

1717
kubectl get deployment
1818

19-
replicaset="$(kubectl describe deployment ${AD_DEPLOYMENT_NAME} | grep -s "NewReplicaSet:" | awk '{ print $2 }')"
19+
replicaset="$(kubectl describe deployment "${AD_DEPLOYMENT_NAME}" | grep -s "NewReplicaSet:" | awk '{ print $2 }')"
2020
[ $? -eq 0 ] || _error "Error getting replicaset"
2121

22-
podname="$(kubectl get pod | grep $replicaset | awk '{ print $1 }')"
22+
podname="$(kubectl get pod | grep "$replicaset" | awk '{ print $1 }')"
2323
[ $? -eq 0 ] || _error "Error getting podname"
2424

2525
echo "Samba ad pod is $podname"
@@ -31,12 +31,12 @@ until [ $tries -ge 120 ] || echo $podstatus | grep -q 'Running'; do
3131
sleep 1
3232
echo -n "."
3333
tries=$(( tries + 1 ))
34-
podstatus="$(kubectl get pod $podname -o go-template='{{.status.phase}}')"
34+
podstatus="$(kubectl get pod "$podname" -o go-template='{{.status.phase}}')"
3535
done
3636
echo
3737
kubectl get pod
3838
echo
39-
echo $podstatus | grep -q 'Running' || _error "Pod did not reach Running state"
39+
echo "$podstatus" | grep -q 'Running' || _error "Pod did not reach Running state"
4040

4141
echo "waiting for samba to become reachable"
4242
tries=0
@@ -76,15 +76,15 @@ echo >> "${TMPFILE}"
7676
FIRSTLINE="$(head -1 ./tests/files/coredns-snippet.template)"
7777
LASTLINE=" }"
7878

79-
sed -i .backup -e "/$FIRSTLINE/,/$LASTLINE/d" ${TMPFILE}
79+
sed -i .backup -e "/$FIRSTLINE/,/$LASTLINE/d" "${TMPFILE}"
8080

81-
cat tests/files/coredns-snippet.template \
82-
| sed -e "s/AD_SERVER_IP/${AD_POD_IP}/" \
81+
sed -e "s/AD_SERVER_IP/${AD_POD_IP}/" \
82+
< tests/files/coredns-snippet.template \
8383
>> "${TMPFILE}"
8484

8585
echo >> "${TMPFILE}"
8686

87-
kubectl patch cm -n kube-system coredns -p "$(cat ${TMPFILE})"
87+
kubectl patch cm -n kube-system coredns -p "$(cat "${TMPFILE}")"
8888
[ $? -eq 0 ] || _error "Error patching coredns config map"
8989

9090
echo "ad setup done"

tests/test-remove-ad-member.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SCRIPT_DIR="$(cd "$(dirname "${0}")" && pwd)"
44

55
source "${SCRIPT_DIR}/common.sh"
66

7-
if [ ${KEEP} -eq 1 ]; then
7+
if [ "${KEEP}" -eq 1 ]; then
88
echo "keeping ad member pod (KEEP=1)"
99
exit 0
1010
fi

tests/test-remove-ad-server.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ SCRIPT_DIR="$(cd "$(dirname "${0}")" && pwd)"
44

55
source "${SCRIPT_DIR}/common.sh"
66

7-
if [ ${KEEP} -eq 1 ]; then
7+
if [ "${KEEP}" -eq 1 ]; then
88
echo "keeping ad server deployment (KEEP=1)"
99
exit 0
1010
fi

tests/test-samba-ad-server-kubernetes.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ SCRIPT_DIR="$(cd "$(dirname "${0}")" && pwd)"
44

55
source "${SCRIPT_DIR}/common.sh"
66

7-
source ${SCRIPT_DIR}/test-deploy-ad-server.sh
7+
source "${SCRIPT_DIR}/test-deploy-ad-server.sh"
88

99
kubectl exec "${podname}" -- samba-tool domain info 127.0.0.1
1010
[ $? -eq 0 ] || _error "Error listing domain info"
1111
echo
1212

13-
source ${SCRIPT_DIR}/test-deploy-ad-member.sh
13+
source "${SCRIPT_DIR}/test-deploy-ad-member.sh"
1414

1515
kubectl exec "${podname}" -c "smb" -- smbclient -N -L 127.0.0.1
1616
kubectl exec "${podname}" -c "winbind" -- wbinfo -t
1717
# note: testing `wbinfo -t` from the smb container again
1818
# to make sure samba can communicate to winbindd
1919
kubectl exec "${podname}" -c "smb" -- wbinfo -t
2020

21-
source ${SCRIPT_DIR}/test-remove-ad-member.sh
21+
source "${SCRIPT_DIR}/test-remove-ad-member.sh"
2222

23-
source ${SCRIPT_DIR}/test-remove-ad-server.sh
23+
source "${SCRIPT_DIR}/test-remove-ad-server.sh"
2424

2525
echo
2626
echo "Success"

0 commit comments

Comments
 (0)