From f9b3996c0d3a72339b5847b369d3740fd532c157 Mon Sep 17 00:00:00 2001 From: Steven Hartland Date: Tue, 13 Aug 2024 17:13:07 +0100 Subject: [PATCH] debugging: rate limit config dump Add output of the docker config if we hit rate limiting to aid in debugging why this is happening on github actions. --- generic.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/generic.go b/generic.go index d94cf1f7517..49c5426d258 100644 --- a/generic.go +++ b/generic.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "strings" "sync" "github.com/testcontainers/testcontainers-go/internal/core" @@ -74,6 +75,14 @@ func GenericContainer(ctx context.Context, req GenericContainerRequest) (Contain } if err != nil { // At this point `c` might not be nil. Give the caller an opportunity to call Destroy on the container. + // TODO: Remove this debugging. + if strings.Contains(err.Error(), "toomanyrequests") { + // Debugging information for rate limiting. + cfg, err := getDockerConfig() + if err == nil { + Logger.Printf("XXX: too many requests: %+v", cfg) + } + } return c, fmt.Errorf("create container: %w", err) }