Skip to content

Commit

Permalink
kubectl: wait for test pod to be ready before attempting to connect t…
Browse files Browse the repository at this point in the history
…o it
  • Loading branch information
roobre committed Sep 14, 2023
1 parent 9205e19 commit 76d34e3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/testutils/e2e/kubectl/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package kubectl

import (
"bytes"
"context"
"fmt"
"net/http"
Expand All @@ -17,7 +16,6 @@ import (
"github.com/grafana/xk6-disruptor/pkg/testutils/k3sutils"
"github.com/grafana/xk6-disruptor/pkg/testutils/kubernetes/builders"


"github.com/testcontainers/testcontainers-go/modules/k3s"

"k8s.io/client-go/tools/clientcmd"
Expand Down Expand Up @@ -77,6 +75,7 @@ func Test_Kubectl(t *testing.T) {
builders.NewContainerBuilder("nginx").
WithImage("nginx").
WithPort("http", 80).
WithHTTPReadinessProbe().
Build(),
).
Build()
Expand Down Expand Up @@ -104,7 +103,7 @@ func Test_Kubectl(t *testing.T) {
}

url := fmt.Sprintf("http://localhost:%d", port)
request, err := http.NewRequest("GET", url, bytes.NewReader([]byte{}))
request, err := http.NewRequest("GET", url, nil)
if err != nil {
t.Errorf("failed to create request: %v", err)
return
Expand Down

0 comments on commit 76d34e3

Please sign in to comment.