Skip to content

Commit b9a0a1d

Browse files
chmouelpiyush-garg
authored andcommitted
fix some errors found by shellcheck
just some errors and some formatting
1 parent 5445980 commit b9a0a1d

File tree

2 files changed

+81
-81
lines changed

2 files changed

+81
-81
lines changed

hack/dev/e2e-cleanups

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22
set -euf
33

4-
kubectl get ns -o name|grep pac-e2e|sed 's/.*\///'|xargs -I"{}" -rP4 kubectl delete repo --all -n "{}"
5-
{
6-
kubectl get clustertasks|grep pac-|awk '{print $1}'|xargs -rP4 kubectl delete clustertask
7-
kubectl get ns -o name|grep pac-e2e|sed 's/.*\///'|xargs -rP4 kubectl delete ns
8-
} &!
4+
kubectl get ns -o name | grep pac-e2e | sed 's/.*\///' | xargs -I"{}" -rP4 kubectl delete repo --all -n "{}"
5+
(
6+
kubectl get clustertasks | grep pac- | awk '{print $1}' | xargs -rP4 kubectl delete clustertask
7+
kubectl get ns -o name | grep pac-e2e | sed 's/.*\///' | xargs -rP4 kubectl delete ns
8+
) &

hack/dev/e2e-run

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ envfile=/tmp/env
3838
noclean=
3939

4040
function help() {
41-
cat <<EOF
41+
cat <<EOF
4242
Usage: $0 [options] [testcase]
4343
4444
-h: this help
@@ -54,103 +54,103 @@ EOF
5454
}
5555

5656
while getopts "nE:fSldnk:p:h:" o; do
57-
case "${o}" in
58-
n)
59-
noclean=true
60-
;;
61-
E)
62-
[[ -z ${KUBECONFIG:-""} ]] && {
63-
echo "need -k set first"
64-
exit 1
65-
}
66-
passprofile=${OPTARG}
67-
vars=$(pass ls pac/vars/${passprofile})
68-
[[ -n ${vars} ]] || { echo "could not detect vars in pac/vars/${passprofile}"; }
69-
pass show pac/vars/${passprofile} | sed -e '/#/d' -e '/^$/d' -e 's/export //' -e '/^KUBECONFIG=/d' >${envfile}
70-
echo KUBECONFIG=$KUBECONFIG >>/tmp/env
71-
echo "/tmp/env has been generated"
72-
exit 0
73-
;;
74-
d)
75-
debug=yes
76-
;;
77-
S)
78-
nosnazy=yes
79-
;;
80-
l)
81-
[[ -e ${cachedir}/last ]] || {
82-
echo "no last tests to run"
83-
exit 1
84-
}
85-
testcases=$(cat ${cachedir}/last)
86-
;;
87-
k)
88-
export KUBECONFIG=$HOME/.kube/config.${OPTARG}
89-
;;
90-
p)
91-
passprofile=${OPTARG}
92-
vars=$(pass show pac/vars/${passprofile})
93-
if [[ -n ${vars} ]]; then
94-
eval ${vars}
95-
else
96-
echo "could not detect vars in pac/vars/${passprofile}"
97-
fi
98-
;;
99-
f)
100-
fzf="yes"
101-
;;
102-
h)
103-
help
104-
exit 0
105-
;;
106-
*)
107-
echo "Invalid option"
108-
exit 1
109-
;;
110-
esac
57+
case "${o}" in
58+
n)
59+
noclean=true
60+
;;
61+
E)
62+
[[ -z ${KUBECONFIG:-""} ]] && {
63+
echo "need -k set first"
64+
exit 1
65+
}
66+
passprofile=${OPTARG}
67+
vars=$(pass ls pac/vars/${passprofile})
68+
[[ -n ${vars} ]] || { echo "could not detect vars in pac/vars/${passprofile}"; }
69+
pass show pac/vars/${passprofile} | sed -e '/#/d' -e '/^$/d' -e 's/export //' -e '/^KUBECONFIG=/d' >${envfile}
70+
echo KUBECONFIG=$KUBECONFIG >>/tmp/env
71+
echo "/tmp/env has been generated"
72+
exit 0
73+
;;
74+
d)
75+
debug=yes
76+
;;
77+
S)
78+
nosnazy=yes
79+
;;
80+
l)
81+
[[ -e ${cachedir}/last ]] || {
82+
echo "no last tests to run"
83+
exit 1
84+
}
85+
testcases=$(cat ${cachedir}/last)
86+
;;
87+
k)
88+
export KUBECONFIG=$HOME/.kube/config.${OPTARG}
89+
;;
90+
p)
91+
passprofile=${OPTARG}
92+
vars=$(pass show pac/vars/${passprofile})
93+
if [[ -n ${vars} ]]; then
94+
eval ${vars}
95+
else
96+
echo "could not detect vars in pac/vars/${passprofile}"
97+
fi
98+
;;
99+
f)
100+
fzf="yes"
101+
;;
102+
h)
103+
help
104+
exit 0
105+
;;
106+
*)
107+
echo "Invalid option"
108+
exit 1
109+
;;
110+
esac
111111
done
112112
shift $((OPTIND - 1))
113113

114114
[[ -n ${debug} ]] && {
115-
env | grep "^TEST_"
115+
env | grep "^TEST_"
116116
}
117117

118118
initial_query=
119119
[[ -n $* ]] && initial_query=(-q "$@")
120120
cd $(git rev-parse --show-toplevel)/test || exit
121121
if [[ -n ${testcases:-""} ]]; then
122-
echo "Reusing last run runs: ${testcases}"
122+
echo "Reusing last run runs: ${testcases}"
123123
elif [[ -z ${fzf} ]]; then
124-
testcases=$*
124+
testcases=$*
125125
else
126-
testcases=$(rg --no-line-number --no-filename --no-heading '^func (Test[^(]+)' -o | sed 's/^func //' |
127-
sort | env fzf -m -1 -0 ${initial_query[@]})
128-
[[ -z ${testcases} ]] && exit 0
129-
newt=
130-
for t in ${testcases}; do
131-
newt="${newt} ^${t}$"
132-
done
133-
testcases=${newt}
126+
testcases=$(rg --no-line-number --no-filename --no-heading '^func (Test[^(]+)' -o | sed 's/^func //' |
127+
sort | env fzf -m -1 -0 "${initial_query[@]}")
128+
[[ -z ${testcases} ]] && exit 0
129+
newt=
130+
for t in ${testcases}; do
131+
newt="${newt} ^${t}$"
132+
done
133+
testcases=${newt}
134134
fi
135135

136136
[[ -d ${cachedir} ]] || mkdir -p ${cachedir}
137137
echo ${testcases} >${cachedir}/last
138138

139139
if [[ -z ${noclean} ]]; then
140-
e2e-cleanups || true
140+
e2e-cleanups || true
141141
else
142-
export TEST_NOCLEANUP=true
142+
export TEST_NOCLEANUP=true
143143
fi
144144

145145
[[ -z ${nosnazy} ]] && { type -p snazy >/dev/null 2>/dev/null || nosnazy=yes; }
146146

147147
for testcase in ${testcases}; do
148-
echo "Running ${testcase}"
149-
make -f ../Makefile test-clean
150-
cmd=(go test -v -tags e2e -count=1 -failfast -run "${testcase}")
151-
if [[ -z ${nosnazy} ]]; then
152-
"${cmd[@]}" | snazy
153-
else
154-
"${cmd[@]}"
155-
fi
148+
echo "Running ${testcase}"
149+
make -f ../Makefile test-clean
150+
cmd=(go test -v -tags e2e -count=1 -failfast -run "${testcase}")
151+
if [[ -z ${nosnazy} ]]; then
152+
"${cmd[@]}" | snazy
153+
else
154+
"${cmd[@]}"
155+
fi
156156
done

0 commit comments

Comments
 (0)