Sometimes you might have a long duration testcase in CircleCI, for example, you want to test your production database with new master branch before pushing it to production? You've come by the annoying facepalm when phpunit is running your test and CircleCI kills it as 'inactive for 10minutes' because phpunit does not output by default to screen when it's going through loop..
So, what we do at Redorent is we pull nightly backup of our production DBs, convert them so we don't use customers' real emails or phone numbers and run a testcase where we loop all users and core models so that all views for our FEs are solid. As our DBs are quite big, it takes easily more than 10 minutes to loop the views through so we inject writes inside our loops.
Here's how we do it:
fwrite(STDERR, print_r($user->id, true));
That's it! Now each time we have next user in the loop, we print out the user id to stderr and phpunit keeps CircleCI's watchdog happy.
Top comments (0)