Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 33 for UntilSuccess (0.16 sec)

  1. pkg/test/util/retry/retry_test.go

    		n := 0
    		err := UntilSuccess(func() error {
    			n++
    			return fmt.Errorf("oops")
    		}, MaxAttempts(10), Delay(0))
    		if err == nil {
    			t.Fatalf("expected error")
    		}
    		if n != 10 {
    			t.Fatalf("expected exactly 10 attempts, got %d", n)
    		}
    	})
    
    	t.Run("attempts success", func(t *testing.T) {
    		n := 0
    		err := UntilSuccess(func() error {
    			n++
    			if n == 7 {
    				return nil
    			}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Jul 20 19:13:32 UTC 2023
    - 2K bytes
    - Viewed (0)
  2. pkg/test/util/retry/retry.go

    	}
    }
    
    // RetriableFunc a function that can be retried.
    type RetriableFunc func() (result any, completed bool, err error)
    
    // UntilSuccess retries the given function until success, timeout, or until the passed-in function returns nil.
    func UntilSuccess(fn func() error, options ...Option) error {
    	_, e := UntilComplete(func() (any, bool, error) {
    		err := fn()
    		if err != nil {
    			return nil, false, err
    		}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Aug 08 16:43:05 UTC 2023
    - 5.6K bytes
    - Viewed (0)
  3. pkg/test/kube/util.go

    // WaitUntilPodsAreReady waits until the pod with the name/namespace is in ready state.
    func WaitUntilPodsAreReady(fetchFunc PodFetchFunc, opts ...retry.Option) ([]corev1.Pod, error) {
    	var pods []corev1.Pod
    	err := retry.UntilSuccess(func() error {
    		scopes.Framework.Infof("Checking pods ready...")
    
    		fetched, err := CheckPodsAreReady(fetchFunc)
    		if err != nil {
    			return err
    		}
    		pods = fetched
    		return nil
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Dec 04 22:47:52 UTC 2023
    - 9.4K bytes
    - Viewed (0)
  4. tests/integration/telemetry/api/accesslogs_test.go

    	err := retry.UntilSuccess(func() error {
    		clientCount := logCount(t, from, testID)
    		serverCount := logCount(t, to, testID)
    
    		from.CallOrFail(t, echo.CallOptions{
    			To: to,
    			Port: echo.Port{
    				Name: "http",
    			},
    			HTTP: echo.HTTP{
    				Path: "/" + testID,
    			},
    		})
    
    		return retry.UntilSuccess(func() error {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Apr 08 22:02:59 UTC 2024
    - 11.6K bytes
    - Viewed (0)
  5. tests/integration/telemetry/api/stats_test.go

    			g, _ := errgroup.WithContext(context.Background())
    			for _, cltInstance := range GetClientInstances() {
    				cltInstance := cltInstance
    				g.Go(func() error {
    					err := retry.UntilSuccess(func() error {
    						if err := SendTraffic(cltInstance); err != nil {
    							return err
    						}
    						c := cltInstance.Config().Cluster
    						sourceCluster := constants.DefaultClusterName
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Apr 08 22:02:59 UTC 2024
    - 17.3K bytes
    - Viewed (0)
  6. pkg/test/framework/components/crd/gateway.go

    		File("", filepath.Join(env.IstioSrc, "tests/integration/pilot/testdata/gateway-api-crd.yaml")).
    		Apply(apply.NoCleanup); err != nil {
    		return err
    	}
    	// Wait until our GatewayClass is ready
    	return retry.UntilSuccess(func() error {
    		for _, c := range ctx.Clusters().Configs() {
    			_, err := c.GatewayAPI().GatewayV1beta1().GatewayClasses().Get(context.Background(), "istio", metav1.GetOptions{})
    			if err != nil {
    				return err
    			}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Aug 14 17:54:38 UTC 2023
    - 2.6K bytes
    - Viewed (0)
  7. pkg/test/echo/server/endpoint/udp.go

    func (s *udpInstance) Close() error {
    	if s.l != nil {
    		_ = s.l.Close()
    	}
    	return nil
    }
    
    func (s *udpInstance) awaitReady(onReady OnReadyFunc, address string) {
    	defer onReady()
    
    	err := retry.UntilSuccess(func() error {
    		conn, err := net.Dial("udp", address)
    		if err != nil {
    			return err
    		}
    		defer func() { _ = conn.Close() }()
    
    		// Server is up now, we're ready.
    		return nil
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 23 16:20:31 UTC 2023
    - 3.4K bytes
    - Viewed (0)
  8. pkg/test/framework/components/istio/eastwest.go

    		ComponentName: "eastwestgateway",
    		Revision:      revision,
    		Files:         inFileNames,
    		Set:           setArgs,
    	}); err != nil {
    		return err
    	}
    
    	// wait for a ready pod
    	if err := retry.UntilSuccess(func() error {
    		pods, err := cluster.Kube().CoreV1().Pods(i.cfg.SystemNamespace).List(context.TODO(), metav1.ListOptions{
    			LabelSelector: eastWestIngressIstioLabel,
    		})
    		if err != nil {
    			return err
    		}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri Nov 10 02:30:20 UTC 2023
    - 4.8K bytes
    - Viewed (0)
  9. pkg/test/framework/components/echo/kube/instance.go

    	for _, wl := range c.workloadMgr.workloads {
    		wl.mutex.Lock()
    		pod := wl.pod
    		wl.mutex.Unlock()
    		if pod.Name != "" {
    			return retry.UntilSuccess(func() (err error) {
    				podName := pod.Name
    				podNamespace := pod.Namespace
    				pod, err := wl.Cluster().Kube().CoreV1().Pods(c.NamespaceName()).Get(context.TODO(), podName, metav1.GetOptions{})
    				if err != nil {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Feb 16 18:55:23 UTC 2023
    - 9K bytes
    - Viewed (0)
  10. pkg/test/framework/components/istio/util.go

    		}
    	}()
    
    	scopes.Framework.Info("Creating dummy virtual service to check for validation webhook readiness")
    	return retry.UntilSuccess(func() error {
    		err := ctx.ConfigKube(cluster).YAML("", dummyValidationVirtualService).Apply()
    		if err == nil {
    			return nil
    		}
    
    		return fmt.Errorf("validation webhook not ready yet: %v", err)
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Feb 29 17:13:34 UTC 2024
    - 4.7K bytes
    - Viewed (0)
Back to top