-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
specify flags to test-integration #33952
specify flags to test-integration #33952
Conversation
Jenkins GCE e2e failed for commit 08d41ed. Full PR test history. The magic incantation to run this job again is |
I doubt the failure on gce e2e is this PRs:
|
Jenkins GCI GCE e2e failed for commit 08d41ed. Full PR test history. The magic incantation to run this job again is |
@@ -90,8 +90,17 @@ if [[ -n "${KUBE_TEST_ARGS}" ]]; then | |||
runTests v1 | |||
fi | |||
|
|||
# Pass arguments that with "-" and move them to goflags. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing word: begining?
what_flags="" | ||
for arg in "$@"; do | ||
if [[ "${arg}" == -* ]]; then | ||
what_flags="${what_flags} \"${arg}\"" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what_flags=()
for arg in "$@"; do
if [[ "${arg}" == -* ]]; then
what_flags+=("${arg}")
fi
done
echo "${what_flags[@]}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "${what_flags[@]}"
Where do I do this echo? Just informational or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what_flags=()
for arg in "$@"; do
if [[ "${arg}" == -* ]]; then
what_flags+=("${arg}")
fi
doneecho "${what_flags[@]}"
Didn't work. It dropped the second flag, so hack/test-integration.sh auth -test.run=TestKindAuthorization -v
didn't give me the -v
.
08d41ed
to
a134620
Compare
@stevekuznetsov can you help with this bash? |
@@ -62,7 +62,7 @@ runTests() { | |||
# TODO: Re-enable race detection when we switch to a thread-safe etcd client | |||
# KUBE_RACE="-race" | |||
make -C "${KUBE_ROOT}" test \ | |||
WHAT="$(kube::test::find_integration_test_dirs ${2-} | paste -sd' ' -)" \ | |||
WHAT="$(kube::test::find_integration_test_dirs ${2-} | paste -sd' ' -) ${3-} " \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We prefer ${var:-'default'}
since it's not often that someone wants to pass an null var around as a meaningful value.
@@ -90,8 +90,17 @@ if [[ -n "${KUBE_TEST_ARGS}" ]]; then | |||
runTests v1 | |||
fi | |||
|
|||
# Pass arguments that begin with "-" and move them to goflags. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want optparse
for parsing options ... not sure attempts to do things like this are a good idea, they can get bloated quickly and have rough edges.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want optparse for parsing options ... not sure attempts to do things like this are a good idea, they can get bloated quickly and have rough edges.
Not for this I don't think.
fi | ||
done | ||
|
||
|
||
# Convert the CSV to an array of API versions to test | ||
IFS=';' read -a apiVersions <<< "${KUBE_TEST_API_VERSIONS}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm 99% sure this IFS
reset is leaking to the rest of the script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm 99% sure this IFS reset is leaking to the rest of the script
preexisting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leave it better than you found it and all that :)
# Convert the CSV to an array of API versions to test | ||
IFS=';' read -a apiVersions <<< "${KUBE_TEST_API_VERSIONS}" | ||
for apiVersion in "${apiVersions[@]}"; do | ||
runTests "${apiVersion}" "${1-}" | ||
runTests "${apiVersion}" "${1-}" "${what_flags}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work how you think it will. You're always going to have one argument to runTests
that you break up later, but it will break like this:
myvar="\"-first\" \"-second=val\" \"-third 'other val'\""
...
runTests "${apiVersion}" "${1-}" "\"-first\" \"-second=val\" \"-third 'other val'\""
^----arg0-----^ ^-arg1^ ^----------------------arg2-----------------------^
...
make
...
WHAT="... \"-first\" \"-second=val\" \"-third 'other val'\""
^--arg0--^ ^----arg1-----^ ^-arg2-^ ^arg3^ ^arg4^
What you want to do is:
- make
$what_flags
into an array - append to the array correctly (
array+=( "new item with spaces or whatever" )
) - expand the array into args here
runTests ... "${what_flags[@]}"
- expect varargs in
runTests
from arg 3 onwardWHAT="$( whatever ) ${@:4}"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you want to do is:
make $what_flags into an array
append to the array correctly (array+=( "new item with spaces or whatever" ))
expand the array into args here runTests ... "${what_flags[@]}"
expect varargs in runTests from arg 3 onward WHAT="$( whatever ) ${@:4}"
Doesn't work.
a134620
to
48c1e83
Compare
Alright, pretty sure I got everyone's bash nits. You still can't read it. |
Jenkins GKE smoke e2e failed for commit 48c1e83. Full PR test history. The magic incantation to run this job again is |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue |
Allows a specific test to be run in test-integration:
hack/test-integration.sh auth -test.run=TestKindAuthorization
@eparis I don't know how good or bad my bash is.
This change is