Rearrange cookie test loop to return earlier

For some reason, we were repeatedly testing that dozens of times...

Signed-off-by: Nick Semenkovich <semenko@alum.mit.edu>