Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions test/conformance/api/v1/single_threaded_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ func TestSingleConcurrency(t *testing.T) {
t.Logf("Maintaining %d concurrent requests for %v.", concurrency, duration)
group, _ := errgroup.WithContext(context.Background())
for i := 0; i < concurrency; i++ {
threadIdx := i
group.Go(func() error {
requestIdx := 0
done := time.After(duration)
req, err := http.NewRequest(http.MethodGet, url.String(), nil)
if err != nil {
Expand All @@ -89,13 +91,14 @@ func TestSingleConcurrency(t *testing.T) {
return nil
default:
res, err := client.Do(req)
requestIdx = requestIdx + 1
if err != nil {
return fmt.Errorf("error making request %w", err)
return fmt.Errorf("error making request, thread index: %d, request index: %d: %w", threadIdx, requestIdx, err)
}
if res.StatusCode == http.StatusInternalServerError {
return errors.New("detected concurrent requests")
} else if res.StatusCode != http.StatusOK {
return fmt.Errorf("non 200 response %v", res.StatusCode)
return fmt.Errorf("non 200 response, thread index: %d, request index: %d, response %s", threadIdx, requestIdx, res)
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions test/conformance/api/v1alpha1/single_threaded_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ func TestSingleConcurrency(t *testing.T) {
t.Logf("Maintaining %d concurrent requests for %v.", concurrency, duration)
group, _ := errgroup.WithContext(context.Background())
for i := 0; i < concurrency; i++ {
threadIdx := i
group.Go(func() error {
requestIdx := 0
done := time.After(duration)
req, err := http.NewRequest(http.MethodGet, url.String(), nil)
if err != nil {
Expand All @@ -90,13 +92,14 @@ func TestSingleConcurrency(t *testing.T) {
return nil
default:
res, err := client.Do(req)
requestIdx = requestIdx + 1
if err != nil {
return fmt.Errorf("error making request %w", err)
return fmt.Errorf("error making request, thread index: %d, request index: %d: %w", threadIdx, requestIdx, err)
}
if res.StatusCode == http.StatusInternalServerError {
return errors.New("detected concurrent requests")
} else if res.StatusCode != http.StatusOK {
return fmt.Errorf("non 200 response %v", res.StatusCode)
return fmt.Errorf("non 200 response, thread index: %d, request index: %d, response %s", threadIdx, requestIdx, res)
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions test/conformance/api/v1beta1/single_threaded_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ func TestSingleConcurrency(t *testing.T) {
t.Logf("Maintaining %d concurrent requests for %v.", concurrency, duration)
group, _ := errgroup.WithContext(context.Background())
for i := 0; i < concurrency; i++ {
threadIdx := i
group.Go(func() error {
requestIdx := 0
done := time.After(duration)
req, err := http.NewRequest(http.MethodGet, url.String(), nil)
if err != nil {
Expand All @@ -89,13 +91,14 @@ func TestSingleConcurrency(t *testing.T) {
return nil
default:
res, err := client.Do(req)
requestIdx = requestIdx + 1
if err != nil {
return fmt.Errorf("error making request %w", err)
return fmt.Errorf("error making request, thread index: %d, request index: %d: %w", threadIdx, requestIdx, err)
}
if res.StatusCode == http.StatusInternalServerError {
return errors.New("detected concurrent requests")
} else if res.StatusCode != http.StatusOK {
return fmt.Errorf("non 200 response %v", res.StatusCode)
return fmt.Errorf("non 200 response, thread index: %d, request index: %d, response %s", threadIdx, requestIdx, res)
}
}
}
Expand Down