mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-03 07:12:27 +00:00
lib/api: Deflake TestAPIServiceRequests (#9413)
Somewhere along the way, the non-parallel test became parallel, and at that point, timeouts occurred. Parallel is better, so increase the timeout on the offending call a bit...
This commit is contained in:
parent
7ebeaefe77
commit
ad81ac8da7
@ -229,6 +229,7 @@ func TestAPIServiceRequests(t *testing.T) {
|
|||||||
Code: 200,
|
Code: 200,
|
||||||
Type: "application/json",
|
Type: "application/json",
|
||||||
Prefix: "{",
|
Prefix: "{",
|
||||||
|
Timeout: 15 * time.Second,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
URL: "/rest/db/file?folder=default&file=something",
|
URL: "/rest/db/file?folder=default&file=something",
|
||||||
@ -433,7 +434,7 @@ func TestAPIServiceRequests(t *testing.T) {
|
|||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
tc := tc
|
tc := tc
|
||||||
t.Run(cases[0].URL, func(t *testing.T) {
|
t.Run(tc.URL, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
testHTTPRequest(t, baseURL, tc, testAPIKey)
|
testHTTPRequest(t, baseURL, tc, testAPIKey)
|
||||||
})
|
})
|
||||||
@ -443,8 +444,6 @@ func TestAPIServiceRequests(t *testing.T) {
|
|||||||
// testHTTPRequest tries the given test case, comparing the result code,
|
// testHTTPRequest tries the given test case, comparing the result code,
|
||||||
// content type, and result prefix.
|
// content type, and result prefix.
|
||||||
func testHTTPRequest(t *testing.T, baseURL string, tc httpTestCase, apikey string) {
|
func testHTTPRequest(t *testing.T, baseURL string, tc httpTestCase, apikey string) {
|
||||||
// Should not be parallelized, as that just causes timeouts eventually with more test-cases
|
|
||||||
|
|
||||||
timeout := time.Second
|
timeout := time.Second
|
||||||
if tc.Timeout > 0 {
|
if tc.Timeout > 0 {
|
||||||
timeout = tc.Timeout
|
timeout = tc.Timeout
|
||||||
|
Loading…
Reference in New Issue
Block a user