Skip to content

Commit

Permalink
Set more realistic timeouts for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmckendry committed Nov 10, 2023
1 parent 878b56f commit 4742289
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestViews(t *testing.T) {

for _, route := range routes {
req := httptest.NewRequest("GET", route, nil)
resp, err := app.Test(req)
resp, err := app.Test(req, 10000)
if err != nil {
t.Error("Error sending request to Fiber: ", err)
}
Expand All @@ -49,7 +49,7 @@ func TestViews(t *testing.T) {
}

req := httptest.NewRequest("GET", route, nil)
resp, err := app.Test(req)
resp, err := app.Test(req, 10000)
if err != nil {
t.Error("Error sending request to Fiber: ", err)
}
Expand Down Expand Up @@ -88,7 +88,7 @@ func TestBadPaths(t *testing.T) {

for _, route := range routes {
req := httptest.NewRequest("GET", route, nil)
resp, err := app.Test(req)
resp, err := app.Test(req, 10000)
if err != nil {
t.Error("Error sending request to Fiber: ", err)
}
Expand Down Expand Up @@ -116,7 +116,7 @@ func TestPostReq(t *testing.T) {

req := httptest.NewRequest("POST", "/dogs", strings.NewReader(formData.Encode()))
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
resp, err := app.Test(req)
resp, err := app.Test(req, 10000)
if err != nil {
t.Error("Error sending request to Fiber: ", err)
}
Expand All @@ -135,7 +135,7 @@ func TestPostReq(t *testing.T) {

req = httptest.NewRequest("POST", "/dogs", strings.NewReader(formData.Encode()))
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
resp, err = app.Test(req)
resp, err = app.Test(req, 10000)
if err != nil {
t.Error("Error sending request to Fiber: ", err)
}
Expand All @@ -161,7 +161,7 @@ func TestPutReq(t *testing.T) {

req := httptest.NewRequest("PUT", "/dogs/1", strings.NewReader(formData.Encode()))
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
resp, err := app.Test(req)
resp, err := app.Test(req, 10000)
if err != nil {
t.Error("Error sending request to Fiber: ", err)
}
Expand All @@ -180,7 +180,7 @@ func TestPutReq(t *testing.T) {

req = httptest.NewRequest("PUT", "/dogs/1", strings.NewReader(formData.Encode()))
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
resp, err = app.Test(req)
resp, err = app.Test(req, 10000)
if err != nil {
t.Error("Error sending request to Fiber: ", err)
}
Expand All @@ -192,7 +192,7 @@ func TestPutReq(t *testing.T) {
}

req = httptest.NewRequest("PUT", "/dogs/abc", nil)
resp, err = app.Test(req)
resp, err = app.Test(req, 10000)
if err != nil {
t.Error("Error sending request to Fiber: ", err)
}
Expand All @@ -212,7 +212,7 @@ func TestDeleteReq(t *testing.T) {
setRoutes(app)

req := httptest.NewRequest("DELETE", "/dogs/1", nil)
resp, err := app.Test(req)
resp, err := app.Test(req, 10000)
if err != nil {
t.Error("Error sending request to Fiber: ", err)
}
Expand All @@ -224,7 +224,7 @@ func TestDeleteReq(t *testing.T) {
}

req = httptest.NewRequest("DELETE", "/dogs/abc", nil)
resp, err = app.Test(req)
resp, err = app.Test(req, 10000)
if err != nil {
t.Error("Error sending request to Fiber: ", err)
}
Expand All @@ -244,7 +244,7 @@ func TestInvoicePostReq(t *testing.T) {
setRoutes(app)

req := httptest.NewRequest("POST", "/invoice/2", nil)
resp, err := app.Test(req)
resp, err := app.Test(req, 10000)
if err != nil {
t.Error("Error sending request to Fiber: ", err)
}
Expand All @@ -256,7 +256,7 @@ func TestInvoicePostReq(t *testing.T) {
}

req = httptest.NewRequest("POST", "/invoice/abc", nil)
resp, err = app.Test(req)
resp, err = app.Test(req, 10000)
if err != nil {
t.Error("Error sending request to Fiber: ", err)
}
Expand Down

0 comments on commit 4742289

Please sign in to comment.