Skip to content

Commit

Permalink
fix TestTelegramConfirmedRequest failing in GitHub Actions
Browse files Browse the repository at this point in the history
The reason is likely slow work of goroutines due to limited CPU.
  • Loading branch information
paskal authored and umputun committed Jul 8, 2023
1 parent 29eac12 commit cd01a6e
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions provider/telegram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,13 @@ func TestTelegramConfirmedRequest(t *testing.T) {
servedToken = resp.Token
mu.Unlock()

time.Sleep(apiPollInterval * 2)

// The token should be confirmed by now
r = httptest.NewRequest("GET", fmt.Sprintf("/?token=%s", resp.Token), nil)
w = httptest.NewRecorder()
tg.LoginHandler(w, r)

assert.Equal(t, http.StatusOK, w.Code, "response code should be 200")
// Check the token confirmation
assert.Eventually(t, func() bool {
r = httptest.NewRequest("GET", fmt.Sprintf("/?token=%s", resp.Token), nil)
w = httptest.NewRecorder()
tg.LoginHandler(w, r)
return w.Code == http.StatusOK
}, apiPollInterval*10, apiPollInterval, "response code should be 200")

info := struct {
Name string `name:"name"`
Expand Down

0 comments on commit cd01a6e

Please sign in to comment.