OpenSSL vulnerability and some ideas on testing

The importance of automated testing.

I’ve been working on a number of core Simple IoT improvements lately and trying to get some end-to-end testing going. A few realizations:

  1. globals are really bad. Never assume any module will be a singleton.
  2. every thread needs lifecycle management including a stop function that initiates a controlled shutdown. Never assume a thread will run forever, because then it is not testable.
  3. your entire app should have lifecycle management such that it can be started in a unit test and shut down cleanly.
  4. ideally, there is no difference between unit and e2e testing – same framework, tools.

This is an interesting approach to make your main() function runnable:

This already mentioned article has some good ideas as well.