Make ProgramControllerTest more robust to avoid race condition in verifying the result