Welcome to the Linux Foundation Forum!

Lab 7.1: validate.js timeout restriction too strict?

I just did Lab 7.1 and ran the tests with node validate. I passed the first 6 test cases, and then the tests hung for 1.5 seconds (since one of the backend services is down), and then I get a failed assertion "GET http://localhost:3000/1 failed to respond". So I dug into validate.js to figure out what was going on, changed line 27 (in the get function) to timeout at 4 seconds instead of 1.5, and re-ran the tests, which then passed successfully.

Since the lab exercise did not mention that our "front of the back-end" service should forcibly cut the connection(s) to back-end services after a given time limit, I suppose that this is unintentional? In case it matters, I'm doing the lab exercises on Ubuntu 20.04 LTS.

Comments

  • Having the same issue here, got library has a different timeout than the test. I had to add a timeout to GOT to make it work:

    const boat = await got(${BOAT_SERVICE}/${id}, {
    timeout:500,
    retry: 0
    }).json();

  • this is a fair point, the lab has been clarified with an extra bullet point:

    Be sure that if an upstream service is not available, that the service responds within 1250ms.

    (this allows an additional 250ms for processing)

  • the problem is that with got module you need to also set retry to 0 in order to validate the exercice

Sign In or Register to comment.