tasks: fix race in test_stale_caps

Signed-off-by: John Spray <john.spray@redhat.com>