mirror of https://gitee.com/bigwinds/arangodb
try to make the tests cope with async execution (#3982)
This commit is contained in:
parent
74347827bf
commit
5a4613c0bf
|
@ -192,6 +192,7 @@ TEST_CASE("ClusterComm::wait", "[cluster][mev]") {
|
|||
id_first = testme.getResponse(0).result->operationID;
|
||||
id_other = testme.getResponse(1).result->operationID;
|
||||
|
||||
startTime = TRI_microtime();
|
||||
std::future<void> f1(std::async(std::launch::async, [&]{
|
||||
timespec ts={0,15000000};
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(ts.tv_nsec / 1000L));
|
||||
|
@ -200,7 +201,6 @@ TEST_CASE("ClusterComm::wait", "[cluster][mev]") {
|
|||
} // lambda
|
||||
));
|
||||
|
||||
startTime = TRI_microtime();
|
||||
result = testme.wait("", transId, 0, "", 0.1);
|
||||
endTime = TRI_microtime();
|
||||
diff = endTime - startTime;
|
||||
|
@ -210,6 +210,7 @@ TEST_CASE("ClusterComm::wait", "[cluster][mev]") {
|
|||
f1.get();
|
||||
|
||||
// do second time to get other response
|
||||
startTime = TRI_microtime();
|
||||
std::future<void> f2(std::async(std::launch::async, [&]{
|
||||
timespec ts={0, 30000000};
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(ts.tv_nsec / 1000L));
|
||||
|
@ -218,7 +219,6 @@ TEST_CASE("ClusterComm::wait", "[cluster][mev]") {
|
|||
} // lambda
|
||||
));
|
||||
|
||||
startTime = TRI_microtime();
|
||||
result = testme.wait("", transId, 0, "", 0.1);
|
||||
endTime = TRI_microtime();
|
||||
diff = endTime - startTime;
|
||||
|
@ -241,6 +241,7 @@ TEST_CASE("ClusterComm::wait", "[cluster][mev]") {
|
|||
id_first = testme.getResponse(0).result->operationID;
|
||||
id_other = testme.getResponse(1).result->operationID;
|
||||
|
||||
startTime = TRI_microtime();
|
||||
std::future<void> f3(std::async(std::launch::async, [&]{
|
||||
timespec ts={0,15000000};
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(ts.tv_nsec / 1000L));
|
||||
|
@ -249,7 +250,6 @@ TEST_CASE("ClusterComm::wait", "[cluster][mev]") {
|
|||
} // lambda
|
||||
));
|
||||
|
||||
startTime = TRI_microtime();
|
||||
result = testme.wait("", transId, 0, "", 0.1);
|
||||
endTime = TRI_microtime();
|
||||
diff = endTime - startTime;
|
||||
|
@ -259,6 +259,7 @@ TEST_CASE("ClusterComm::wait", "[cluster][mev]") {
|
|||
f3.get();
|
||||
|
||||
// do second time to get other response
|
||||
startTime = TRI_microtime();
|
||||
std::future<void> f4(std::async(std::launch::async, [&]{
|
||||
timespec ts={0, 30000000};
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(ts.tv_nsec / 1000L));
|
||||
|
@ -267,7 +268,6 @@ TEST_CASE("ClusterComm::wait", "[cluster][mev]") {
|
|||
} // lambda
|
||||
));
|
||||
|
||||
startTime = TRI_microtime();
|
||||
result = testme.wait("", transId, 0, "", 0.1);
|
||||
endTime = TRI_microtime();
|
||||
diff = endTime - startTime;
|
||||
|
@ -278,6 +278,7 @@ TEST_CASE("ClusterComm::wait", "[cluster][mev]") {
|
|||
|
||||
// infinite wait
|
||||
id_first = testme.addSimpleRequest(transId, CL_COMM_SUBMITTED);
|
||||
startTime = TRI_microtime();
|
||||
std::future<void> f5(std::async(std::launch::async, [&]{
|
||||
timespec ts={0, 500000000}; //0.5 seconds
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(ts.tv_nsec / 1000L));
|
||||
|
@ -286,7 +287,6 @@ TEST_CASE("ClusterComm::wait", "[cluster][mev]") {
|
|||
} // lambda
|
||||
));
|
||||
|
||||
startTime = TRI_microtime();
|
||||
result = testme.wait("", transId, 0, "", 0.0);
|
||||
endTime = TRI_microtime();
|
||||
diff = endTime - startTime;
|
||||
|
|
Loading…
Reference in New Issue