Conversation
Signed-off-by: Stephen Brawner <brawner@gmail.com>
Signed-off-by: Stephen Brawner <brawner@gmail.com>
| } | ||
| } | ||
|
|
||
| TEST(test_graph_cache, get_writers_info_by_topic_maybe_fail) |
There was a problem hiding this comment.
@brawner would it make sense to split this test case into three separate ones (i.e. one for each method being fault injected).
There was a problem hiding this comment.
Yes, done! I think I originally intended for that given the test name.
| graph_cache, { | ||
| {"participant1", "ns1", "node1"}, | ||
| {"participant1", "ns1", "node2"}, | ||
| {"participant1", "ns2", "node1"}}); |
There was a problem hiding this comment.
@brawner perhaps not an issue, but should the test fixture be setup outside the fault injection loop?
There was a problem hiding this comment.
Yah, created a test fixture class.
| &allocator, | ||
| &info); | ||
| if (RMW_RET_OK == ret) { | ||
| ret = rmw_topic_endpoint_info_array_fini(&info, &allocator); |
There was a problem hiding this comment.
@brawner should this be:
| ret = rmw_topic_endpoint_info_array_fini(&info, &allocator); | |
| EXPECT_EQ(RWM_RET_OK, rmw_topic_endpoint_info_array_fini(&info, &allocator)); |
instead? Also, what if fault injection occurs here?
There was a problem hiding this comment.
Actually, it will fail during a fault injection test because there will be at least one hook in there. I added a check on the return of fini just in case it needs be done a second time.
| RCUTILS_FAULT_INJECTION_TEST( | ||
| { | ||
| GraphCache graph_cache; | ||
| add_participants(graph_cache, {"participant1"}); |
There was a problem hiding this comment.
Can this init section be left out of the fault_injection test macro?
There was a problem hiding this comment.
I think so. I created a test fixture class and split this test into three separate TEST_Fs
| } | ||
| } | ||
|
|
||
| TEST(test_graph_cache, get_writers_info_by_topic_maybe_fail) |
There was a problem hiding this comment.
Yes, done! I think I originally intended for that given the test name.
| RCUTILS_FAULT_INJECTION_TEST( | ||
| { | ||
| GraphCache graph_cache; | ||
| add_participants(graph_cache, {"participant1"}); |
There was a problem hiding this comment.
I think so. I created a test fixture class and split this test into three separate TEST_Fs
| graph_cache, { | ||
| {"participant1", "ns1", "node1"}, | ||
| {"participant1", "ns1", "node2"}, | ||
| {"participant1", "ns2", "node1"}}); |
There was a problem hiding this comment.
Yah, created a test fixture class.
| &allocator, | ||
| &info); | ||
| if (RMW_RET_OK == ret) { | ||
| ret = rmw_topic_endpoint_info_array_fini(&info, &allocator); |
There was a problem hiding this comment.
Actually, it will fail during a fault injection test because there will be at least one hook in there. I added a check on the return of fini just in case it needs be done a second time.
| ret = rcutils_string_array_fini(&namespaces); | ||
| ret = rcutils_string_array_fini(&enclaves); | ||
| // rcutils_string_array_fini is not under test, so disable fault injection test here. | ||
| int64_t fault_injection_count = rcutils_fault_injection_get_count(); |
There was a problem hiding this comment.
@hidmic This is the only location here that would make sense to disable fault injection testing because rcutils_string_array_fini is out of scope for this test. Do you think it would make sense to submit a PR to rcutils to add in the disable fault injection testing macros?
There was a problem hiding this comment.
I think it's fine as-is for the time being. If it starts showing up more often, we can add a macro.
|
Trying again after merging ros2/rcutils#283 |
|
|
Why not first release |
|
That's reasonable. It will be my first release, so I was just unsure about the whole process. I'll work to figure it out. |
* Add fault injection macro unit tests Signed-off-by: Stephen Brawner <brawner@gmail.com> * target definitions Signed-off-by: Stephen Brawner <brawner@gmail.com> * PR Fixup Signed-off-by: Stephen Brawner <brawner@gmail.com>
* Add fault injection macro unit tests Signed-off-by: Stephen Brawner <brawner@gmail.com> * target definitions Signed-off-by: Stephen Brawner <brawner@gmail.com> * PR Fixup Signed-off-by: Stephen Brawner <brawner@gmail.com>
Adding fault injection unit tests to rmw_dds_common. This should get coverage to about 99%. I'll post CI results soon.
Signed-off-by: Stephen Brawner brawner@gmail.com