Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run end to end test in CI #152

Merged
merged 8 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
wget https://packages.osrfoundation.org/gazebo.gpg -O /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
if [ "$GZ_VERSION" == "garden" ]; then
export GZ_DEPS="libgz-sim7-dev libgz-plugin2-dev"
export GZ_DEPS="libgz-sim7-dev libgz-plugin2-dev gz-sim7-cli"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should start using rosdep for these steps instead to save us some headache on the buildfarm later

fi

apt-get update && apt-get upgrade -q -y
Expand All @@ -65,6 +65,12 @@ jobs:
export ROSDEP_ARGS="--skip-keys ros_gz_sim --skip-keys gz-plugin2 --skip-keys gz-sim7 --skip-keys gz-transport12 --skip-keys gz-math7 --skip-keys gz-msgs9"
fi
cd /home/ros2_ws/src/
if [ "$ROS_DISTRO" == "rolling" ]; then
git clone https://github.com/gazebosim/ros_gz/
fi
if [ "$ROS_DISTRO" == "iron" ]; then
git clone https://github.com/gazebosim/ros_gz/ -b iron
fi
rosdep init
rosdep update
rosdep install --from-paths ./ -i -y --rosdistro ${ROS_DISTRO} --ignore-src ${ROSDEP_ARGS}
Expand All @@ -73,11 +79,11 @@ jobs:
run: |
cd /home/ros2_ws/
. /opt/ros/${ROS_DISTRO}/local_setup.sh
colcon build --packages-up-to gz_ros2_control_demos
colcon build --packages-up-to gz_ros2_control_demos gz_ros2_control_tests
- name: Run tests
id: test
run: |
cd /home/ros2_ws/
. /opt/ros/${ROS_DISTRO}/local_setup.sh
colcon test --event-handlers console_direct+ --packages-select gz_ros2_control gz_ros2_control_demos
colcon test --event-handlers console_direct+ --packages-select gz_ros2_control gz_ros2_control_demos gz_ros2_control_tests
colcon test-result
5 changes: 4 additions & 1 deletion gz_ros2_control_tests/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@
<exec_depend>joint_trajectory_controller</exec_depend>
<exec_depend>launch</exec_depend>
<exec_depend>launch_ros</exec_depend>
<exec_depend>launch_testing_ament_cmake</exec_depend>
<exec_depend>python3-psutil</exec_depend>
<exec_depend>python3-pytest</exec_depend>
<exec_depend>ros2launch</exec_depend>
<exec_depend>rclcpp</exec_depend>
<exec_depend>robot_state_publisher</exec_depend>
<exec_depend condition="$GZ_VERSION == ''">ros_gz_sim</exec_depend>
<exec_depend condition="$GZ_VERSION == 'garden'">ros_gz_sim</exec_depend>
<exec_depend condition="$GZ_VERSION == fortress">ros_ign_gazebo</exec_depend>
<exec_depend condition="$GZ_VERSION == 'fortress'">ros_ign_gazebo</exec_depend>
<exec_depend>ros2controlcli</exec_depend>
<exec_depend>xacro</exec_depend>

Expand Down
17 changes: 13 additions & 4 deletions gz_ros2_control_tests/src/test_position.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <chrono>
#include <memory>
#include <string>
#include <vector>
Expand Down Expand Up @@ -102,11 +103,19 @@ int main(int argc, char * argv[])
node->get_node_waitables_interface(),
"/joint_trajectory_controller/follow_joint_trajectory");

bool response =
action_client->wait_for_action_server(std::chrono::seconds(1));
if (!response) {
throw std::runtime_error("could not get action server");
while (true) {
bool response =
action_client->wait_for_action_server(std::chrono::seconds(1));
if (!response) {
using namespace std::chrono_literals;
std::this_thread::sleep_for(2000ms);
std::cout << "Trying to connect to the server again" << std::endl;
continue;
} else {
break;
}
}

std::cout << "Created action server" << std::endl;

std::vector<std::string> joint_names = {"slider_to_cart"};
Expand Down
2 changes: 1 addition & 1 deletion gz_ros2_control_tests/tests/position_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def generate_test_description():
class TestFixture(unittest.TestCase):

def test_arm(self, launch_service, proc_info, proc_output):
proc_output.assertWaitFor('Sucessfully loaded controller joint_trajectory_controller '
proc_output.assertWaitFor('Successfully loaded controller joint_trajectory_controller '
'into state active',
timeout=100, stream='stdout')

Expand Down