Skip to content

Commit

Permalink
add retry
Browse files Browse the repository at this point in the history
Signed-off-by: Manabu Mccloskey <[email protected]>
  • Loading branch information
nabuskey committed Oct 26, 2023
1 parent c14e767 commit 2ff688c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions pkg/kind/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package kind
import (
"context"
"testing"
"time"

"github.com/cnoe-io/idpbuilder/pkg/docker"
"github.com/docker/docker/api/types"
Expand Down Expand Up @@ -32,10 +33,21 @@ func TestReconcileRegistry(t *testing.T) {
}

// Create registry
err = cluster.ReconcileRegistry(ctx)
defer dockerCli.ContainerRemove(ctx, cluster.getRegistryContainerName(), types.ContainerRemoveOptions{Force: true})
if err != nil {
t.Fatalf("Error reconciling registry: %v", err)
waitTimeout := time.Second * 90
waitInterval := time.Second * 3
endTime := time.Now().Add(waitTimeout)

for {
if time.Now().After(endTime) {
t.Fatalf("Timed out waiting for registry. recent error: %v", err)
}
err = cluster.ReconcileRegistry(ctx)
if err == nil {
break
}
t.Logf("Failed to reconcile: %v", err)
time.Sleep(waitInterval)
}

// Get resulting container
Expand All @@ -55,3 +67,4 @@ func TestReconcileRegistry(t *testing.T) {
t.Fatalf("Error reconciling registry: %v", err)
}
}

0 comments on commit 2ff688c

Please sign in to comment.