CDAP-13296 fix race in program status call
The call to get a program status was suspectible to races because
run records for the program were not read in a single transaction.
If run state happened to change in between run record reads, the
state could incorrectly be returned as stopped.
This race condition would cascade and cause other tests to fail
that would wait for a program run to complete. If one of those
tests ran into this scenario, the test would move on assuming
the program had stopped when it in fact was still running.
Fixed to read run records in a single transaction, and added
missing unit tests.
Also fixing a bug where a suspended program would have a stopped
status instead of a running status.