mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +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":
|
||||
return IsCreated, nil
|
||||
|
||||
case strings.HasPrefix(lowercaseCond, "condition="):
|
||||
conditionName := lowercaseCond[len("condition="):]
|
||||
case strings.HasPrefix(condition, "condition="):
|
||||
conditionName := strings.TrimPrefix(condition, "condition=")
|
||||
conditionValue := "true"
|
||||
if equalsIndex := strings.Index(conditionName, "="); equalsIndex != -1 {
|
||||
conditionValue = conditionName[equalsIndex+1:]
|
||||
@ -209,8 +209,8 @@ func conditionFuncFor(condition string, errOut io.Writer) (ConditionFunc, error)
|
||||
errOut: errOut,
|
||||
}.IsConditionMet, nil
|
||||
|
||||
case strings.HasPrefix(lowercaseCond, "jsonpath="):
|
||||
jsonPathInput := strings.TrimPrefix(lowercaseCond, "jsonpath=")
|
||||
case strings.HasPrefix(condition, "jsonpath="):
|
||||
jsonPathInput := strings.TrimPrefix(condition, "jsonpath=")
|
||||
jsonPathExp, jsonPathValue, err := processJSONPathInput(jsonPathInput)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -51,6 +51,12 @@ run_wait_tests() {
|
||||
# Post-Condition: Wait failed
|
||||
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
|
||||
( sleep 2 && kubectl delete deployment --all ) &
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user