Closed jonbinney closed 9 years ago
The tests don't seem to pass. I think it might be a side effect of you modifying the minimal_pkg
test fixture.
Oops. I made sure that the test I added passed, but forgot to check the other ones. I'll sort it out.
The discovery test wasn't expecting to find the new capability I added. I've updated the test to expect this. All tests pass on my computer now, we'll see what travis thinks.
Damn, a couple tests fail on travis but not on my machine.
Ok, I just turned travis over to see if it is one of those pesky race condition tests. If it is I can try to help tune it up so it doesn't spuriously fail.
Looks like it's still failing. I'll look a bit deeper at it. Its a bit frustrating because each of the tests in a file run in the same ros system; so if one test function runs a capability, but has a bug and fails to stop that capability, a later test could fail because it expects only a certain capability to be running. Sometimes the test that fails isn't the one with the bug.
ok i can reproduce this locally; it happens about 1 in 4 times i run the tests.
I think i'm beginning to understand what is going on. I wrote a test to start the SlowToDie capability, then ask it to stop, then ask it to start again immediately. I asserted that starting it up again would fail, because it should still be busy shutting down. BUT it looks like the stop_capability service actually blocks. So by the time stop_capability finally returns, it is often actually stopped (not necessarily, since there's still an asynchronous bit before the graph gets updated, but it's a spit second timing thing).
Moral of the story is that if you call stop_capability, it's gonna block until the capability is stopped, and because there's an asynchronous Event before the actual graph gets updated, you can't count on it being for sure started or for sure stopped. So there isn't any bug here, its just that we can't write a test that expects it to go one way or the other. I'll remove this particular test.
Looks like it is working now.
Cool, thanks @jonbinney.
My previous PR had two typos in it that I didn't notice because it only causes problems if a capability is started while a previous instance of it is in the process of stopping. This PR fixes those typos, and adds tests to catch this case.