3030#include < olp/core/http/NetworkProxySettings.h>
3131#include < testutils/CustomParameters.hpp>
3232
33+ #include " Utils.h"
34+
3335using namespace ::olp::authentication;
3436
3537namespace {
@@ -420,7 +422,8 @@ TEST_F(HereAccountOuauth2ProductionTest, RequestTokenConcurrent) {
420422 TokenRequest{},
421423 [&, barrier, start](TokenEndpoint::TokenResponse token_response) {
422424 auto delta = std::chrono::high_resolution_clock::now () - start;
423- EXPECT_TRUE (token_response.IsSuccessful ());
425+ EXPECT_TRUE (token_response.IsSuccessful ())
426+ << token_response.GetError ().GetMessage ();
424427 EXPECT_FALSE (token_response.GetResult ().GetAccessToken ().empty ());
425428 {
426429 std::lock_guard<std::mutex> guard (global_state_mutex);
@@ -441,7 +444,7 @@ TEST_F(HereAccountOuauth2ProductionTest, RequestTokenConcurrent) {
441444
442445 auto delta_total_time =
443446 std::chrono::high_resolution_clock::now () - start_total_time;
444- EXPECT_LE (( delta_total_time * 2 ) , delta_sum)
447+ EXPECT_LT ( delta_total_time, delta_sum)
445448 << " Expect token request operations to have happened in parallel" ;
446449
447450 EXPECT_EQ (access_tokens.size (), 5u );
@@ -462,7 +465,8 @@ TEST_F(HereAccountOuauth2ProductionTest, RequestTokenConcurrentFuture) {
462465 auto start = std::chrono::high_resolution_clock::now ();
463466 auto token_response = token_endpoint_.RequestToken ().get ();
464467 auto delta = std::chrono::high_resolution_clock::now () - start;
465- EXPECT_TRUE (token_response.IsSuccessful ());
468+ EXPECT_TRUE (token_response.IsSuccessful ())
469+ << token_response.GetError ().GetMessage ();
466470 EXPECT_FALSE (token_response.GetResult ().GetAccessToken ().empty ());
467471 {
468472 std::lock_guard<std::mutex> guard (global_state_mutex);
@@ -478,7 +482,7 @@ TEST_F(HereAccountOuauth2ProductionTest, RequestTokenConcurrentFuture) {
478482 threads[i].join ();
479483 }
480484
481- EXPECT_LE (( delta_total_time * 2 ) , delta_sum)
485+ EXPECT_LT ( delta_total_time, delta_sum)
482486 << " Expect token request operations to have happened in parallel" ;
483487
484488 EXPECT_EQ (access_tokens.size (), 5u );
0 commit comments