Waiting for the pods to become available

The process of waiting and retrying was significantly more tricky with Node.js, promises, and callbacks. In this case, I leveraged a capability of the mocha test library to allow a test to be retried and manipulate the overall timeout for a section of the test structure to get the same end result:

describe('should repeat until the pods are ready', function() {  // Mocha supports a retry mechanism limited by number of retries...  this.retries(30);  // an a default timeout of 20,000ms that we can increase  this.timeout(300000);it('check to see that all pods are reporting ready', function() {   return new Promise(function(resolve, reject) {       console.log(' - delay 5 seconds...') setTimeout(() => resolve(1), 5000); ...

Get Kubernetes for Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.