Пример #1
0
    TEST_F(ShardConnFixture, KilledGoodConnShouldNotClearPool) {
        ShardConnection conn1(TARGET_HOST, "test.user");
        ShardConnection conn2(TARGET_HOST, "test.user");
        ShardConnection conn3(TARGET_HOST, "test.user");

        const uint64_t upperBoundCreationTime =
                conn3.get()->getSockCreationMicroSec();
        conn3.done();

        const uint64_t badCreationTime = conn1.get()->getSockCreationMicroSec();
        conn1.kill();

        conn2.done();

        ShardConnection conn4(TARGET_HOST, "test.user");
        ShardConnection conn5(TARGET_HOST, "test.user");

        ASSERT_GREATER_THAN(conn4.get()->getSockCreationMicroSec(), badCreationTime);
        ASSERT_LESS_THAN_OR_EQUALS(conn4.get()->getSockCreationMicroSec(),
                upperBoundCreationTime);

        ASSERT_GREATER_THAN(conn5.get()->getSockCreationMicroSec(), badCreationTime);
        ASSERT_LESS_THAN_OR_EQUALS(conn5.get()->getSockCreationMicroSec(),
                upperBoundCreationTime);

        checkNewConns(assertGreaterThan, upperBoundCreationTime, 10);
    }
Пример #2
0
TEST(ConnectXTest, consCheck) //Check possible condition cases for constructor.
{
	ConnectX conn1(4,5,3);
	ConnectX conn2(-4,5,2);
	ConnectX conn3(4,-5,3);	
	ConnectX conn4(4,5,-3);
}