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

Add service/client construction/destruction API test coverage. #138

Merged
merged 3 commits into from
Sep 29, 2020

Conversation

hidmic
Copy link
Contributor

@hidmic hidmic commented Sep 23, 2020

Precisely what the title says. Depends on ros2/rmw_fastrtps#445, ros2/rmw_cyclonedds#247, and ros2/rmw_connext#464.

@hidmic
Copy link
Contributor Author

hidmic commented Sep 23, 2020

CI up to test_rmw_implementation and rcl:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

ASSERT_NE(nullptr, srv) << rmw_get_error_string().str;

// Destroying service with invalid arguments fails.
rmw_ret_t ret = rmw_destroy_service(nullptr, srv);
Copy link
Contributor

Choose a reason for hiding this comment

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

If this succeeds, couldn't the failure bleed into the other checks below? Should you be creating a valid service every time?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Failures would bleed out, yes, and likely cause a crash, as the service has been freed.

We could split each bad destruction attempt into its own test, and assert that the destruction call did not succeed before proceeding to destruct it (which is part of the test). But either way we have to trust rmw_destroy_service() outcome. There's no other way to test for validity.

Would you have rather have N tests? I don't feel strongly about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I do like N TEST_Fs a bit better, especially if you created a small test fixture. I'm realizing I probably did something like what you've done here plenty of times, but more recently, I've been leaning towards more TEST_F rather than fewer so issues in failing tests can be isolated quickly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough. See 8680b3e.

ASSERT_NE(nullptr, client) << rmw_get_error_string().str;

// Destroying client with invalid arguments fails.
rmw_ret_t ret = rmw_destroy_client(nullptr, client);
Copy link
Contributor

Choose a reason for hiding this comment

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

If this unintentionally modifies client, it could impact the other checks below. It might be better to recreate client each time you try to destroy it, or check it's valid each time

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above.

@hidmic hidmic changed the title Add service/client construction/destriction API test coverage. Add service/client construction/destruction API test coverage. Sep 24, 2020
@hidmic hidmic force-pushed the hidmic/rmw-service-construction-destruction-tests branch from d766e41 to 399e059 Compare September 24, 2020 16:14
@hidmic
Copy link
Contributor Author

hidmic commented Sep 24, 2020

CI up to test_rmw_implementation and rcl:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Signed-off-by: Michel Hidalgo <[email protected]>
@hidmic
Copy link
Contributor Author

hidmic commented Sep 25, 2020

CI up to test_rmw_implementation and rcl:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@hidmic
Copy link
Contributor Author

hidmic commented Sep 28, 2020

@ros-pull-request-builder retest this please.

@hidmic
Copy link
Contributor Author

hidmic commented Sep 28, 2020

@ros-pull-request-builder retest this please.

1 similar comment
@hidmic
Copy link
Contributor Author

hidmic commented Sep 29, 2020

@ros-pull-request-builder retest this please.

@hidmic
Copy link
Contributor Author

hidmic commented Sep 29, 2020

Finally all's green !

@hidmic hidmic merged commit 18a7ff0 into master Sep 29, 2020
@delete-merged-branch delete-merged-branch bot deleted the hidmic/rmw-service-construction-destruction-tests branch September 29, 2020 00:59
ahcorde pushed a commit that referenced this pull request Oct 9, 2020
ahcorde pushed a commit that referenced this pull request Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants