mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 10:19:50 +00:00
Merge pull request #125808 from bzsuni/cleanup/PollUntil
Use PollUntilContextCancel to replace PollUntil in test
This commit is contained in:
commit
061be57eb1
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package flowcontrol
|
package flowcontrol
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
@ -42,7 +43,7 @@ func TestConditionIsolation(t *testing.T) {
|
|||||||
fsClient := loopbackClient.FlowcontrolV1().FlowSchemas()
|
fsClient := loopbackClient.FlowcontrolV1().FlowSchemas()
|
||||||
var dangleOrig *flowcontrol.FlowSchemaCondition
|
var dangleOrig *flowcontrol.FlowSchemaCondition
|
||||||
|
|
||||||
wait.PollUntil(time.Second, func() (bool, error) {
|
err := wait.PollUntilContextCancel(ctx, time.Second, false, func(ctx context.Context) (done bool, err error) {
|
||||||
fsGot, err := fsClient.Get(ctx, fsOrig.Name, metav1.GetOptions{})
|
fsGot, err := fsClient.Get(ctx, fsOrig.Name, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.Errorf("Failed to fetch FlowSchema %q: %v", fsOrig.Name, err)
|
klog.Errorf("Failed to fetch FlowSchema %q: %v", fsOrig.Name, err)
|
||||||
@ -50,7 +51,10 @@ func TestConditionIsolation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
dangleOrig = getCondition(fsGot.Status.Conditions, flowcontrol.FlowSchemaConditionDangling)
|
dangleOrig = getCondition(fsGot.Status.Conditions, flowcontrol.FlowSchemaConditionDangling)
|
||||||
return dangleOrig != nil, nil
|
return dangleOrig != nil, nil
|
||||||
}, ctx.Done())
|
})
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
|
||||||
ssaType := flowcontrol.FlowSchemaConditionType("test-ssa")
|
ssaType := flowcontrol.FlowSchemaConditionType("test-ssa")
|
||||||
patchSSA := flowcontrolapply.FlowSchema(fsOrig.Name).
|
patchSSA := flowcontrolapply.FlowSchema(fsOrig.Name).
|
||||||
|
Loading…
Reference in New Issue
Block a user