-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from osrf/issue_34
White list for capability server
- Loading branch information
Showing
10 changed files
with
219 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
test/rostest/test_server/test_package_white_black_lists.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python | ||
|
||
from __future__ import print_function | ||
|
||
import unittest | ||
|
||
import rostest | ||
|
||
import rospy | ||
|
||
from rosservice import get_service_class_by_name | ||
|
||
TEST_NAME = 'test_white_black_list' | ||
|
||
|
||
def call_service(service_name, *args, **kwargs): | ||
rospy.wait_for_service(service_name) | ||
service_type = get_service_class_by_name(service_name) | ||
proxy = rospy.ServiceProxy(service_name, service_type) | ||
return proxy(*args, **kwargs) | ||
|
||
|
||
class Test(unittest.TestCase): | ||
def test_introspection_services(self): | ||
# get interafaces | ||
resp = call_service('/capability_server/get_interfaces') | ||
assert 'minimal_pkg/Minimal' not in resp.interfaces, resp | ||
assert 'navigation_capability/Navigation' in resp.interfaces, resp | ||
assert 'differential_mobile_base_capability/DifferentialMobileBase' not in resp.interfaces, resp | ||
|
||
if __name__ == '__main__': | ||
rospy.init_node(TEST_NAME, anonymous=True) | ||
rostest.unitrun('capabilities', TEST_NAME, Test) |
16 changes: 16 additions & 0 deletions
16
test/rostest/test_server/test_package_white_black_lists.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<launch> | ||
<node pkg="capabilities" name="capability_server" type="capability_server" output="screen" required="true" | ||
launch-prefix="coverage run --append "> | ||
<param name="debug" value="true"/> | ||
<env name="ROS_PACKAGE_PATH" | ||
value="$(find capabilities)/test/unit/discovery_workspaces/minimal:$(find capabilities)/test/rostest/test_server/dependent_capabilities:$(env ROS_PACKAGE_PATH)" /> | ||
<rosparam param="package_whitelist"> | ||
- navigation_capability | ||
- differential_mobile_base_capability | ||
</rosparam> | ||
<rosparam param="package_blacklist"> | ||
- differential_mobile_base_capability | ||
</rosparam> | ||
</node> | ||
<test test-name="white_black_lists_tests" pkg="capabilities" type="test_white_black_lists.py"/> | ||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python | ||
|
||
from __future__ import print_function | ||
|
||
import unittest | ||
|
||
import rostest | ||
|
||
import rospy | ||
|
||
from rosservice import get_service_class_by_name | ||
|
||
TEST_NAME = 'test_white_black_list' | ||
|
||
|
||
def call_service(service_name, *args, **kwargs): | ||
rospy.wait_for_service(service_name) | ||
service_type = get_service_class_by_name(service_name) | ||
proxy = rospy.ServiceProxy(service_name, service_type) | ||
return proxy(*args, **kwargs) | ||
|
||
|
||
class Test(unittest.TestCase): | ||
def test_introspection_services(self): | ||
# get interafaces | ||
resp = call_service('/capability_server/get_interfaces') | ||
assert 'minimal_pkg/Minimal' not in resp.interfaces, resp | ||
assert 'navigation_capability/Navigation' in resp.interfaces, resp | ||
assert 'differential_mobile_base_capability/DifferentialMobileBase' not in resp.interfaces, resp | ||
|
||
if __name__ == '__main__': | ||
rospy.init_node(TEST_NAME, anonymous=True) | ||
rostest.unitrun('capabilities', TEST_NAME, Test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<launch> | ||
<node pkg="capabilities" name="capability_server" type="capability_server" output="screen" required="true" | ||
launch-prefix="coverage run --append "> | ||
<param name="debug" value="true"/> | ||
<env name="ROS_PACKAGE_PATH" | ||
value="$(find capabilities)/test/unit/discovery_workspaces/minimal:$(find capabilities)/test/rostest/test_server/dependent_capabilities:$(env ROS_PACKAGE_PATH)" /> | ||
<rosparam param="whitelist"> | ||
- navigation_capability/Navigation | ||
- differential_mobile_base_capability/DifferentialMobileBase | ||
- differential_mobile_base_capability/faux_differential_mobile_base | ||
</rosparam> | ||
<rosparam param="blacklist"> | ||
- differential_mobile_base_capability/DifferentialMobileBase | ||
</rosparam> | ||
</node> | ||
<test test-name="white_black_lists_tests" pkg="capabilities" type="test_white_black_lists.py"/> | ||
</launch> |