Skip to content

Commit

Permalink
Don't use boost global test fixture.
Browse files Browse the repository at this point in the history
  • Loading branch information
aholmberg committed Sep 9, 2014
1 parent db9ea7e commit ff3b39f
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions test/integration_tests/src/schema_agreement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,35 +30,23 @@

#include <algorithm>

test_utils::MultipleNodesTest* inst;
struct ClusterInit {
ClusterInit() {
inst = new test_utils::MultipleNodesTest(3, 0);
cass_cluster_set_log_level(inst->cluster, CASS_LOG_DEBUG);
}

~ClusterInit() {
delete inst;
}
};

BOOST_GLOBAL_FIXTURE(ClusterInit)

struct SessionInit {
SessionInit()
: session(NULL),
log_counter("", true) {
cass_cluster_set_log_callback(inst->cluster, test_utils::count_message_log_callback, &log_counter);
ClusterInit()
: inst(3, 0),
log_counter("", true),
session(NULL) {
cass_cluster_set_log_level(inst.cluster, CASS_LOG_DEBUG);
cass_cluster_set_log_callback(inst.cluster, test_utils::count_message_log_callback, &log_counter);
new_session();
}

~SessionInit() {
~ClusterInit() {
close_session();
}

void new_session() {
close_session();
test_utils::CassFuturePtr connect_future(cass_cluster_connect(inst->cluster));
test_utils::CassFuturePtr connect_future(cass_cluster_connect(inst.cluster));
test_utils::wait_and_check_error(connect_future.get());
session = cass_future_get_session(connect_future.get());
}
Expand All @@ -71,11 +59,12 @@ struct SessionInit {
}
}

CassSession* session;
test_utils::MultipleNodesTest inst;
test_utils::LogData log_counter;
CassSession* session;
};

BOOST_FIXTURE_TEST_SUITE(schema_agreement, SessionInit)
BOOST_FIXTURE_TEST_SUITE(schema_agreement, ClusterInit)

// only doing a keyspace for now since there is no difference for types or tables
BOOST_AUTO_TEST_CASE(keyspace_add_drop)
Expand All @@ -102,7 +91,7 @@ BOOST_AUTO_TEST_CASE(keyspace_add_drop)
BOOST_AUTO_TEST_CASE(agreement_node_down) {
log_counter.reset("ControlConnection: Node 127.0.0.3 is down");

inst->ccm->stop(3);
inst.ccm->stop(3);

size_t t = 0;
size_t max_tries = 15;
Expand All @@ -128,7 +117,7 @@ BOOST_AUTO_TEST_CASE(agreement_node_down) {

BOOST_CHECK_EQUAL(log_counter.message_count, 2);

inst->ccm->start(3);
inst.ccm->start(3);
}

#define MAX_SCHEMA_AGREEMENT_WAIT_MS 10000
Expand Down

0 comments on commit ff3b39f

Please sign in to comment.