Example #1
0
    def test_configure_valid_type_param_mismatch(self, pipeline_manager,
                                                 proc_info, proc_output):
        param = 'components'

        req = ConfigurePipeline.Request()
        pipeline_type = PipelineType()
        test_type = 'example'
        pipeline_type.type = test_type
        req.pipeline_type = pipeline_type
        test_file_name = 'test_param_mismatch'
        req.config_file_name = test_file_name
        future = self.configure_client.call_async(req)
        while rclpy.ok():
            rclpy.spin_once(self.node)
            if future.done():
                res = future.result()
                if res.success is False:
                    proc_output.assertWaitFor(
                        expected_output=
                        'Could not get the pipeline parameter "{}", wrong type'
                        .format(param))

                else:
                    self.fail('Expected configure pipeline service to fail'
                              ' due to no parameter for yaml item'
                              ' associated to pipeline type')
                break
Example #2
0
    def test_configure_valid_type_yaml_component_package_mismatch(
            self, pipeline_manager, proc_info, proc_output):
        compnum = 1
        packnum = 2

        req = ConfigurePipeline.Request()
        pipeline_type = PipelineType()
        test_type = 'example'
        pipeline_type.type = test_type
        req.pipeline_type = pipeline_type
        test_file_name = 'test_comp_pack_mismatch'
        req.config_file_name = test_file_name
        future = self.configure_client.call_async(req)
        while rclpy.ok():
            rclpy.spin_once(self.node)
            if future.done():
                res = future.result()
                if res.success is False:
                    proc_output.assertWaitFor(
                        expected_output=
                        'Number of components and package names do not match, {} and {} respectively'
                        .format(compnum, packnum))
                else:
                    self.fail('Expected configure pipeline service to fail'
                              ' due to nonmatching component and'
                              ' package name numbers')
                break
    def _send_configure_request(self, next_type):
        """
        Helper for sending the ConfigurePipeline request

        @param next_type: The next pipeline type to configure
        """
        req = ConfigurePipeline.Request()
        pipeline_type = PipelineType()
        pipeline_type.type = next_type
        req.pipeline_type = pipeline_type
        return self.configure_client.call_async(req)
Example #4
0
    def test_run_pkg_not_valid(self, pipeline_manager, proc_info, proc_output):
        req = ConfigurePipeline.Request()
        pipeline_type = PipelineType()
        test_type = 'example'
        pipeline_type.type = test_type
        req.pipeline_type = pipeline_type
        test_file_name = 'test_run_pkg_not_valid'
        req.config_file_name = test_file_name
        future = self.configure_client.call_async(req)

        while rclpy.ok():
            rclpy.spin_once(self.node)
            if future.done():
                break

        goal_msg = RunPipeline.Goal()
        goal_msg.input = 0
        future = self.run_client.send_goal_async(goal_msg)

        future_count = 0
        result = None
        while rclpy.ok():
            rclpy.spin_once(self.node)
            if future.done():
                future_count += 1
                if future_count == 1:
                    future = future.result().get_result_async()
                if future_count == 2:
                    result = future.result().result
                    break
        if result.output == 1:
            component = 'example::ComponentOne'
            proc_output.assertWaitFor(
                expected_output=
                'Could not find requested resource in ament index')
            proc_output.assertWaitFor(
                expected_output='The component {} was not loaded successfully'.
                format(component))
            proc_output.assertWaitFor(expected_output='Aborting the pipeline')
        else:
            self.fail('Should abort from component not able to load')
Example #5
0
 def test_configure_invalid_type(self, pipeline_manager, proc_info,
                                 proc_output):
     req = ConfigurePipeline.Request()
     pipeline_type = PipelineType()
     test_type = 'no_exist'
     pipeline_type.type = test_type
     req.pipeline_type = pipeline_type
     future = self.configure_client.call_async(req)
     while rclpy.ok():
         rclpy.spin_once(self.node)
         if future.done():
             res = future.result()
             if res.success is False:
                 proc_output.assertWaitFor(
                     expected_output='Configuration of pipeline type "{}"'
                     ' is not allowed, no such type'.format(test_type),
                     process=pipeline_manager)
             else:
                 self.fail('Expected configure pipeline service to fail'
                           ' due to non existent type')
             break
Example #6
0
 def test_configure_valid_type_no_yaml(self, pipeline_manager, proc_info,
                                       proc_output):
     req = ConfigurePipeline.Request()
     pipeline_type = PipelineType()
     test_type = 'example'
     pipeline_type.type = test_type
     req.pipeline_type = pipeline_type
     test_file_name = 'test_no_yaml'
     req.config_file_name = test_file_name
     future = self.configure_client.call_async(req)
     while rclpy.ok():
         rclpy.spin_once(self.node)
         if future.done():
             res = future.result()
             if res.success is False:
                 proc_output.assertWaitFor(
                     expected_output='Could not find {}.yaml'.format(
                         test_file_name))
             else:
                 self.fail('Expected configure pipeline service to fail'
                           ' due to no yaml associated to pipeline type')
             break