@@ -1478,11 +1478,14 @@ func TestProcessSourceURLsConcurrentAllFail(t *testing.T) {
14781478 defer failServer .Close ()
14791479
14801480 client := newTestClient (failServer .URL )
1481+ startedAt := time .Now ()
14811482 _ , _ , err := client .processSourceURLsConcurrent (
14821483 []string {failServer .URL + "/1" , failServer .URL + "/2" },
14831484 "best" , "anime-id" , "1" ,
14841485 )
1485- assert .Error (t , err )
1486+ require .Error (t , err )
1487+ assert .Less (t , time .Since (startedAt ), 2 * time .Second , "failed sources should not wait for the global timeout" )
1488+ assert .NotContains (t , err .Error (), "timeout waiting for results" )
14861489}
14871490
14881491func TestProcessSourceURLsConcurrentPartialFailure (t * testing.T ) {
@@ -1505,12 +1508,14 @@ func TestProcessSourceURLsConcurrentPartialFailure(t *testing.T) {
15051508 defer server .Close ()
15061509
15071510 client := newTestClient (server .URL )
1511+ startedAt := time .Now ()
15081512 url , _ , err := client .processSourceURLsConcurrent (
15091513 []string {server .URL + "/fail" , server .URL + "/ok" },
15101514 "best" , "anime-id" , "1" ,
15111515 )
15121516 require .NoError (t , err )
15131517 assert .Equal (t , "https://cdn.example.com/720.mp4" , url )
1518+ assert .Less (t , time .Since (startedAt ), 2 * time .Second , "successful fallback should not wait for the global timeout" )
15141519}
15151520
15161521func TestProcessSourceURLsConcurrentHighPriorityWins (t * testing.T ) {
@@ -1622,16 +1627,16 @@ func TestHTTPStatusCodes(t *testing.T) {
16221627 t .Parallel ()
16231628
16241629 tests := []struct {
1625- code int
1630+ code int
16261631 shouldBeUnavailable bool
16271632 }{
16281633 {200 , false },
1629- {301 , true }, // redirect is non-2xx
1630- {400 , true }, // bad request
1631- {403 , true }, // forbidden -> ErrSourceUnavailable
1632- {429 , true }, // rate limited -> ErrSourceUnavailable
1633- {500 , true }, // internal server error
1634- {503 , true }, // service unavailable -> ErrSourceUnavailable
1634+ {301 , true }, // redirect is non-2xx
1635+ {400 , true }, // bad request
1636+ {403 , true }, // forbidden -> ErrSourceUnavailable
1637+ {429 , true }, // rate limited -> ErrSourceUnavailable
1638+ {500 , true }, // internal server error
1639+ {503 , true }, // service unavailable -> ErrSourceUnavailable
16351640 }
16361641
16371642 for _ , tt := range tests {
@@ -1929,12 +1934,12 @@ func TestDecodeToBeParsedNoPanicOnMalformed(t *testing.T) {
19291934 t .Parallel ()
19301935
19311936 inputs := []string {
1932- "" , // empty
1933- "AA==" , // 1 byte
1934- "AAAAAAAAAAAAAAAA" , // 12 bytes exactly (nonce only, too short)
1935- "AAAAAAAAAAAAAAAAAAAA" , // 15 bytes
1937+ "" , // empty
1938+ "AA==" , // 1 byte
1939+ "AAAAAAAAAAAAAAAA" , // 12 bytes exactly (nonce only, too short)
1940+ "AAAAAAAAAAAAAAAAAAAA" , // 15 bytes
19361941 base64 .StdEncoding .EncodeToString (make ([]byte , 100 )), // 100 zero bytes
1937- "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=" , // "abcdefghijklmnopqrstuvwxyz"
1942+ "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=" , // "abcdefghijklmnopqrstuvwxyz"
19381943 }
19391944
19401945 for i , input := range inputs {
0 commit comments