Fix #1143, SB_UT corrections and clear event count history after setup #2347
+101
−134
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
Describe the contribution
While looking at this, I realised that lots of tests were checking events related the 'setup', not the actual function that is the focus of the test.
For example, there are dozens of asserts for
CFE_SB_PIPE_ADDED_EID
andCFE_SB_SUBSCRIPTION_RCVD_EID
- even thoughCFE_SB_CreatePipe()
andCFE_SB_Subscribe()
have their own tests...These asserts are largely redundant and just add clutter to the tests - I've removed the obvious cases from the tests I was already updating with
UT_ClearEventHistory()
.Test_SB_Cmds_MapInfoDef
was checking forCFE_SB_PIPE_ADDED_EID
andCFE_SB_SUBSCRIPTION_RCVD_EID
which are part of the setup, not the function under test. I changed this to check for the command counter being incremented instead.Test_Unsubscribe_Basic
,Test_Unsubscribe_AppId
andTest_Unsubscribe_Local
were checking forCFE_SB_SUBSCRIPTION_RCVD_EID
. They should really be checking forCFE_SB_SUBSCRIPTION_REMOVED_EID
given thatCFE_SB_Unsubscribe()
is the focus of these tests.Test_Unsubscribe_Local
, it was actually sending aCFE_SB_UNSUB_NO_SUBS_EID
event. The reason this wasn't noticed may be becauseCFE_SB_UnsubscribeLocal()
returnsCFE_SUCCESS
(and sends theCFE_SB_UNSUB_NO_SUBS_EID
event) if the pipe is not subscribed to theMsgId
.CFE_SB_SubscribeLocal()
, instead ofCFE_SB_Subscribe()
, and now the call toCFE_SB_UnsubscribeLocal()
in the test actually works and returnsCFE_SUCCESS
while sending theCFE_SB_SUBSCRIPTION_REMOVED_EID
event.Even though these are coverage tests, they should still be clear and at least check for what they are testing...
Testing performed
GitHub CI actions all passing successfully (incl. Build + Run, Unit/Functional Tests etc.).
Local testing confirms net coverage unchanged.
Expected behavior changes
No change to code behavior. Test behavior updated as described above.
System(s) tested on
Debian GNU/Linux 11 (bullseye)
Current main branch of cFS bundle.
Contributor Info
Avi Weiss @thnkslprpt