mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-17 12:42:16 +01:00
adding test for handler package for simulating multiple requests at once
This commit is contained in:
@@ -164,8 +164,26 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
t.Errorf("Handler returned a wrong status code: got '%v' want '%v'", status, http.StatusOK)
|
t.Errorf("Handler returned a wrong status code: got '%v' want '%v'", status, http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
// case 5: sends two requests (almost) simultany.
|
// case 5: sends five requests (almost) simultany.
|
||||||
// TODO
|
path, _ = filepath.Abs("../_tests/file.docx")
|
||||||
|
filesPaths := []string{
|
||||||
|
path,
|
||||||
|
path,
|
||||||
|
path,
|
||||||
|
path,
|
||||||
|
path,
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := 0; i < len(filesPaths); i++ {
|
||||||
|
go func(i int) {
|
||||||
|
req := makeRequest(filesPaths[i])
|
||||||
|
rr := httptest.NewRecorder()
|
||||||
|
h.ServeHTTP(rr, req)
|
||||||
|
if status := rr.Code; status != http.StatusOK {
|
||||||
|
t.Errorf("Handler returned a wrong status code: got '%v' want '%v'", status, http.StatusOK)
|
||||||
|
}
|
||||||
|
}(i)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestServeHandler(t *testing.T) {
|
func TestServeHandler(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user