当前位置: 首页>>代码示例>>C++>>正文


C++ TestConnections::stop_timeout方法代码示例

本文整理汇总了C++中TestConnections::stop_timeout方法的典型用法代码示例。如果您正苦于以下问题:C++ TestConnections::stop_timeout方法的具体用法?C++ TestConnections::stop_timeout怎么用?C++ TestConnections::stop_timeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestConnections的用法示例。


在下文中一共展示了TestConnections::stop_timeout方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char *argv[])
{
    TestConnections * Test = new TestConnections(argc, argv);
    char sql[10240];

    Test->connect_maxscale();
    create_t1(Test->conn_rwsplit);

    Test->tprintf("INSERTing data\n");
    for (int i = 0; i < 2000; i++)
    {
        Test->set_timeout(20);
        create_insert_string(sql, 100, i);
        Test->try_query(Test->conn_rwsplit, sql);
    }
    Test->tprintf("done, sleeping\n");
    Test->stop_timeout();
    sleep(20);
    Test->tprintf("Trying SELECT\n");
    Test->set_timeout(30);
    Test->try_query(Test->conn_rwsplit, (char *) "SELECT * FROM t1");

    Test->check_maxscale_alive();
    int rval = Test->global_result;
    delete Test;
    return rval;
}
开发者ID:mariadb-corporation,项目名称:maxscale-system-test,代码行数:27,代码来源:lots_of_rows.cpp

示例2: main

int main(int argc, char *argv[])
{
    TestConnections * Test = new TestConnections(argc, argv);
    Test->set_timeout(100);

    Test->repl->connect();

    Test->tprintf("Connecting to ReadConnnRouter in 'master' mode\n");
    Test->connect_readconn_master();
    printf("Sleeping 10 seconds\n");
    Test->stop_timeout();
    sleep(10);
    Test->set_timeout(50);
    Test->add_result(check_connnections_only_to_master(Test, 0), "connections are not only to Master\n");
    Test->close_readconn_master();
    Test->tprintf("Changing master to node 1\n");
    Test->set_timeout(50);
    Test->repl->change_master(1, 0);
    printf("Sleeping 10 seconds\n");
    Test->stop_timeout();
    sleep(10);
    Test->set_timeout(50);
    printf("Connecting to ReadConnnRouter in 'master' mode\n");
    Test->connect_readconn_master();
    printf("Sleeping 10 seconds\n");
    Test->stop_timeout();
    sleep(10);
    Test->set_timeout(50);
    Test->add_result(check_connnections_only_to_master(Test, 1), "connections are not only to master");
    Test->close_readconn_master();
    Test->set_timeout(50);
    printf("Changing master back to node 0\n");
    Test->repl->change_master(0, 1);

    Test->check_log_err((char *) "The service 'CLI' is missing a definition of the servers", false);

    int rval = Test->global_result;
    delete Test;
    return rval;
}
开发者ID:mariadb-corporation,项目名称:maxscale-system-test,代码行数:40,代码来源:readconnrouter_master.cpp

示例3: run_test

bool run_test(TestConnections& test)
{
    bool rval = true;

    for (int x = 0; test_set[x].types; x++)
    {
        for (int i = 0; test_set[x].types[i]; i++)
        {
            std::string name = type_to_table_name(test_set[x].types[i]);
            insert_data(test, name.c_str(), test_set[x].types[i], test_set[x].values);
        }
    }

    test.repl->connect();
    execute_query(test.repl->nodes[0], "FLUSH LOGS");
    test.repl->close_connections();
    sleep(10);

    for (int x = 0; test_set[x].types; x++)
    {
        for (int i = 0; test_set[x].types[i]; i++)
        {
            test.set_timeout(60);
            test.tprintf("Testing type: %s", test_set[x].types[i]);
            std::string name = type_to_table_name(test_set[x].types[i]);
            CDC::Connection conn(test.maxscale_IP, 4001, "skysql", "skysql");

            if (conn.createConnection() && conn.requestData(name))
            {
                for (int j = 0; test_set[x].values[j]; j++)
                {
                    std::string row;

                    if (conn.readRow(row))
                    {
                        TestInput input(test_set[x].values[j], test_set[x].types[i]);
                        TestOutput output(row, field_name);

                        if (input != output)
                        {
                            test.tprintf("Result mismatch: %s(%s) => %s",
                                         test_set[x].types[i], test_set[x].values[j], output.getValue().c_str());
                            rval = false;
                        }
                    }
                    else
                    {
                        std::string err = conn.getError();
                        test.tprintf("Failed to read data: %s", err.c_str());
                    }
                }
            }
            else
            {
                std::string err = conn.getError();
                test.tprintf("Failed to request data: %s", err.c_str());
                rval = false;
            }
            test.stop_timeout();
        }
    }
    return rval;
}
开发者ID:mariadb-corporation,项目名称:maxscale-system-test,代码行数:63,代码来源:cdc_datatypes.cpp

示例4: main


//.........这里部分代码省略.........
            Test->add_result(1, "********** rules%d test FAILED\n", i);
        }
        else
        {
            Test->tprintf("********** rules%d test PASSED\n", i);
        }

        mysql_close(Test->conn_rwsplit);
    }

    Test->set_timeout(180);
    Test->stop_maxscale();

    // Test for at_times clause
    Test->tprintf("Trying at_times clause\n");
    copy_rules(Test, (char *) "rules_at_time", rules_dir);

    Test->tprintf("DELETE quries without WHERE clause will be blocked during next 2 minutes\n");
    Test->tprintf("Put time to rules.txt: %s\n", str);
    Test->ssh_maxscale(false, "start_time=`date +%%T`; stop_time=` date --date "
                       "\"now +2 mins\" +%%T`; %s sed -i \"s/###time###/$start_time-$stop_time/\" %s/rules/rules.txt",
                       Test->maxscale_access_sudo, Test->maxscale_access_homedir);

    Test->start_maxscale();
    Test->connect_rwsplit();

    Test->tprintf("Trying 'DELETE FROM t1' and expecting FAILURE\n");
    execute_query(Test->conn_rwsplit, "DELETE FROM t1");
    if (mysql_errno(Test->conn_rwsplit) != 1141)
    {
        Test->add_result(1, "Query succeded, but fail expected, errono is %d\n", mysql_errno(Test->conn_rwsplit));
    }
    Test->tprintf("Waiting 3 minutes and trying 'DELETE FROM t1', expecting OK\n");
    Test->stop_timeout();
    sleep(180);
    Test->set_timeout(180);
    Test->try_query(Test->conn_rwsplit, "DELETE FROM t1");

    mysql_close(Test->conn_rwsplit);
    Test->stop_maxscale();

    Test->tprintf("Trying limit_queries clause\n");
    Test->tprintf("Copying rules to Maxscale machine: %s\n", str);
    copy_rules(Test, (char *) "rules_limit_queries", rules_dir);

    Test->start_maxscale();
    Test->connect_rwsplit();

    printf("Trying 10 quries as fast as possible\n");
    for (i = 0; i < 10; i++)
    {
        Test->add_result(execute_query(Test->conn_rwsplit, "SELECT * FROM t1"), "%d -query failed\n", i);
    }

    Test->tprintf("Expecting failures during next 5 seconds\n");

    time_t start_time_clock = time(NULL);
    timeval t1, t2;
    double elapsedTime;
    gettimeofday(&t1, NULL);


    do
    {
        gettimeofday(&t2, NULL);
        elapsedTime = (t2.tv_sec - t1.tv_sec);
开发者ID:mariadb-corporation,项目名称:maxscale-system-test,代码行数:67,代码来源:fwf.cpp

示例5: main

int main(int argc, char *argv[])
{
    TestConnections * Test = new TestConnections(argc, argv);
    Test->set_timeout(10);

    Test->connect_maxscale();

    Test->set_timeout(10);
    Test->try_query(Test->conn_rwsplit, (char *) "SET @a=1");
    Test->stop_timeout();
    sleep(1);
    Test->set_timeout(20);
    Test->tprintf("Blocking first slave\n");
    Test->repl->block_node(1);
    Test->stop_timeout();
    sleep(5);
    Test->set_timeout(10);
    Test->tprintf("Unblocking first slave and blocking second slave\n");

    Test->repl->unblock_node(1);
    Test->stop_timeout();
    sleep(5);
    Test->repl->block_node(2);
    Test->stop_timeout();
    sleep(5);
    Test->set_timeout(20);

    int retries;

    for (retries = 0; retries < 10; retries++)
    {
        char server1_status[256];
        Test->get_maxadmin_param((char *) "show server server2", (char *) "Status", server1_status);
        if (strstr(server1_status, "Running"))
        {
            break;
        }
        sleep(1);
    }

    Test->add_result(retries == 10, "Slave is not recovered, slave status is not Running\n");

    Test->repl->connect();
    int real_id = Test->repl->get_server_id(1);

    char server_id[200] = "";
    find_field(Test->conn_rwsplit, "SELECT @@server_id", "@@server_id", server_id);
    int queried_id = atoi(server_id);

    Test->add_result(queried_id != real_id, "The query server ID '%d' does not match the one from server '%d'. "
                     "Slave was not recovered.", queried_id, real_id);

    char userval[200] = "";
    find_field(Test->conn_rwsplit, "SELECT @a", "@a", userval);

    Test->add_result(atoi(userval) != 1, "User variable @a is not 1, it is '%s'", userval);

    Test->tprintf("Unblocking second slave\n");
    Test->repl->unblock_node(2);

    Test->check_maxscale_alive();
    int rval = Test->global_result;
    delete Test;
    return rval;
}
开发者ID:mariadb-corporation,项目名称:maxscale-system-test,代码行数:65,代码来源:mxs874_slave_recovery.cpp


注:本文中的TestConnections::stop_timeout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。