-
Notifications
You must be signed in to change notification settings - Fork 333
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
test: ✅ add activation_and_receive_command #441
base: master
Are you sure you want to change the base?
test: ✅ add activation_and_receive_command #441
Conversation
Codecov Report
@@ Coverage Diff @@
## master #441 +/- ##
==========================================
- Coverage 35.78% 29.98% -5.80%
==========================================
Files 189 7 -182
Lines 17570 737 -16833
Branches 11592 422 -11170
==========================================
- Hits 6287 221 -6066
+ Misses 994 161 -833
+ Partials 10289 355 -9934
Flags with carried forward coverage won't be shown. Click here to find out more.
|
I am not sure about the activation of the unit test that was commented out, but I can comment on this:
|
Are you suggesting that I should separate the PR? The reason I included it was because it was related to the failure mode that the test would have if simply commented in. Though, yes, I could technically separate the fixes, I thought it trivial to add in as the PR is small. If you're suggesting that the change to |
No, I agree with you that the change is quite small so I think that it could be included in this PR.
I am not sure how the change you suggested would be shorter, as it should still take the same amount of time, the only difference being that on the one unit test it runs in full tilt for Now regarding why running the update function more than twice is needed, I find it hard to believe that the original author who wrote the unit test wrote a while loop like that instead of a simple My comment in your code is just stating the obvious, that the code you replaced is not 1-1 equivalent. It doesn't run the exact same thing but in a more efficient way, it modifies what the function does. Lastly, this function is called a few lines below, so it seems required to call update a few times for these checks to pass, is it not? |
I see your point. The change in the function is not all that different is that it just replaces a while-loop running for a period of time with some sleeps for roughly that same period of time. But I would argue that this methodology is not good practice for a unit test. I would think we would want our tests to run as fast as possible and not depend on a certain period of time passing. I tried implementing this without the sleeps but one of the tests crashes when accessing uninitialized memory and would require some bug fixing. I would guess that the while loop was originally added for the same reason I added it, because they couldn't get it to work otherwise and don't quite get the complexity of the tests. Perhaps I should remove the change to
The tests run just fine with two calls to update. I believe this is because I'm essentially setting up a step function in |
ASSERT_EQ(traj_node->get_current_state().id(), State::PRIMARY_STATE_ACTIVE); | ||
|
||
// send msg | ||
auto duration = rclcpp::Duration::from_nanoseconds(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to set it to 0 or remove it completely
On further inspection, I'm not sure I see the value of adding this test back in. As I see it, the test mainly has two components:
These two parts are already tested in two different unit tests. The first one is tested in |
4bcf772
to
00fec30
Compare
00fec30
to
0cf856b
Compare
This pull request is in conflict. Could you fix it @jaron-l? |
refs: #421