mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #126638 from soltysh/fix_wait
wait: don't lowercase condition in --for argument
This commit is contained in:
commit
099a88370d
@ -195,8 +195,8 @@ func conditionFuncFor(condition string, errOut io.Writer) (ConditionFunc, error)
|
|||||||
case lowercaseCond == "create":
|
case lowercaseCond == "create":
|
||||||
return IsCreated, nil
|
return IsCreated, nil
|
||||||
|
|
||||||
case strings.HasPrefix(lowercaseCond, "condition="):
|
case strings.HasPrefix(condition, "condition="):
|
||||||
conditionName := lowercaseCond[len("condition="):]
|
conditionName := strings.TrimPrefix(condition, "condition=")
|
||||||
conditionValue := "true"
|
conditionValue := "true"
|
||||||
if equalsIndex := strings.Index(conditionName, "="); equalsIndex != -1 {
|
if equalsIndex := strings.Index(conditionName, "="); equalsIndex != -1 {
|
||||||
conditionValue = conditionName[equalsIndex+1:]
|
conditionValue = conditionName[equalsIndex+1:]
|
||||||
@ -209,8 +209,8 @@ func conditionFuncFor(condition string, errOut io.Writer) (ConditionFunc, error)
|
|||||||
errOut: errOut,
|
errOut: errOut,
|
||||||
}.IsConditionMet, nil
|
}.IsConditionMet, nil
|
||||||
|
|
||||||
case strings.HasPrefix(lowercaseCond, "jsonpath="):
|
case strings.HasPrefix(condition, "jsonpath="):
|
||||||
jsonPathInput := strings.TrimPrefix(lowercaseCond, "jsonpath=")
|
jsonPathInput := strings.TrimPrefix(condition, "jsonpath=")
|
||||||
jsonPathExp, jsonPathValue, err := processJSONPathInput(jsonPathInput)
|
jsonPathExp, jsonPathValue, err := processJSONPathInput(jsonPathInput)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -51,6 +51,12 @@ run_wait_tests() {
|
|||||||
# Post-Condition: Wait failed
|
# Post-Condition: Wait failed
|
||||||
kube::test::if_has_string "${output_message}" 'timed out'
|
kube::test::if_has_string "${output_message}" 'timed out'
|
||||||
|
|
||||||
|
# wait with mixed case jsonpath
|
||||||
|
output_message=$(kubectl wait --for=jsonpath=.status.unavailableReplicas=1 deploy/test-1 2>&1)
|
||||||
|
|
||||||
|
# Post-Condition: Wait failed
|
||||||
|
kube::test::if_has_string "${output_message}" 'test-1 condition met'
|
||||||
|
|
||||||
# Delete all deployments async to kubectl wait
|
# Delete all deployments async to kubectl wait
|
||||||
( sleep 2 && kubectl delete deployment --all ) &
|
( sleep 2 && kubectl delete deployment --all ) &
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user