Job main loop: just break out of the loop instead of using special flags

As spotted by Ruda. Thanks!

CC: Ruda Moura <rmoura@redhat.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
Job main loop: add functional tests to the selftest suite

Signed-off-by: Cleber Rosa <crosa@redhat.com>