Add restclientconfig helper fn for parsing timeout

This patch adds a package `pkg/client/unversioned/clientcmd/util` and
defines a `ParseTimeout` helper function for parsing time from a
user-defined string. This allows code re-use in other packages that
require the creation of a new restclient (and therefore must set the
`--global-timeout` flag value manually).
This commit is contained in:
juanvallejo
2016-11-30 14:17:39 -05:00
parent b14dda12f8
commit 885b7a6da8
4 changed files with 41 additions and 10 deletions

View File

@@ -1282,7 +1282,7 @@ __EOF__
## check --request-timeout value with invalid time unit
output_message=$(! kubectl get pod valid-pod --request-timeout="1p" 2>&1)
kube::test::if_has_string "${output_message}" 'Invalid value for option'
kube::test::if_has_string "${output_message}" 'Invalid timeout value'
# cleanup
kubectl delete pods valid-pod "${kube_flags[@]}"