Skip to content

Commit

Permalink
Trying to find why cpp test fails. It appears to be a local issue wit…
Browse files Browse the repository at this point in the history
…h library paths not getting passed properly. SOme mention of this is here mikepurvis/ros-install-osx#12
  • Loading branch information
hawesie committed Oct 26, 2015
1 parent 4b3d009 commit fc50c36
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
10 changes: 7 additions & 3 deletions mongodb_store/scripts/message_store_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ def __init__(self, replicate_on_write=False):
self.replicate_on_write = replicate_on_write

use_daemon = rospy.get_param('mongodb_use_daemon', False)
db_host = rospy.get_param('mongodb_host')
db_port = rospy.get_param('mongodb_port')
if use_daemon:
if use_daemon:
db_host = rospy.get_param('mongodb_host')
db_port = rospy.get_param('mongodb_port')
is_daemon_alive = dc_util.check_connection_to_mongod(db_host, db_port)
if not is_daemon_alive:
raise Exception("No Daemon?")
else:
have_dc = dc_util.wait_for_mongo()
if not have_dc:
raise Exception("No Datacentre?")
# move these to after the wait_for_mongo check as they may not be set before the db is available
db_host = rospy.get_param('mongodb_host')
db_port = rospy.get_param('mongodb_port')


self._mongo_client=MongoClient(db_host, db_port)

Expand Down
6 changes: 3 additions & 3 deletions mongodb_store/tests/message_store.test
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<launch>

<node name="mongo_server" pkg="mongodb_store" type="mongodb_server.py" output="screen">
<node name="mongo_server" pkg="mongodb_store" type="mongodb_server.py">
<param name="test_mode" value="true"/>
</node>

<node name="message_store" pkg="mongodb_store" type="message_store_node.py" output="screen"/>
<node name="message_store" pkg="mongodb_store" type="message_store_node.py"/>

<!-- rosout and diagnostic topic logger -->
<!-- <node name="diagnostics_logger" pkg="strands_diagnostics" type="logger" output="screen"/> -->
<!-- <node name="diagnostics_logger" pkg="strands_diagnostics" type="logger"/> -->

<test test-name="test_messagestore" pkg="mongodb_store" type="test_messagestore.py" />

Expand Down
4 changes: 2 additions & 2 deletions mongodb_store/tests/message_store_cpp_client.test
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<launch>

<node name="mongo_server" pkg="mongodb_store" type="mongodb_server.py" output="screen">
<node name="mongo_server" pkg="mongodb_store" type="mongodb_server.py">
<param name="test_mode" value="true"/>
</node>

<node name="message_store" pkg="mongodb_store" type="message_store_node.py" output="screen"/>

<test test-name="test_message_store_cpp" pkg="mongodb_store" type="message_store_cpp_test" />
<test test-name="test_message_store_cpp" pkg="mongodb_store" type="message_store_cpp_test"/>

</launch>
28 changes: 15 additions & 13 deletions mongodb_store/tests/message_store_cpp_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ TEST(ROSDatacentre, cppTest)

BOOST_FOREACH( boost::shared_ptr<Pose> p, results)
{
//ROS_INFO_STREAM("Got by ID: " << *p);
ROS_INFO_STREAM("Got by ID: " << *p);
}

}
Expand Down Expand Up @@ -123,18 +123,20 @@ TEST(ROSDatacentre, cppTest)
EXPECT_EQ(0, results.size());
}

results.clear();
for(int i = 0; i < 100; ++i) {
geometry_msgs::Pose p;
p.orientation.z = i;
messageStore.insert<Pose>(p);
}
if(messageStore.query<Pose>(results, mongo::BSONObj(), mongo::BSONObj(), false, 10)){
EXPECT_EQ(10, results.size());
}
else {
ADD_FAILURE() << "Documents are not limited";
}
results.clear();
for(int i = 0; i < 100; ++i) {
geometry_msgs::Pose p;
p.orientation.z = i;
messageStore.insert<Pose>(p);
}
if(messageStore.query<Pose>(results, mongo::BSONObj(), mongo::BSONObj(), false, 10)){
EXPECT_EQ(10, results.size());
}
else {
ADD_FAILURE() << "Documents are not limited";
}

ROS_INFO_STREAM("happy here");
}

/**
Expand Down

0 comments on commit fc50c36

Please sign in to comment.