Jiaji's Blog

A Simple HTTP Load Testing Client in Go

May 17, 2015

Last week we try to reproduce an incident in our production system which is caused by an eleviation of HTTPS connection creation rate. The service was flooded by more than 2000 concurrent connections per server at peak.

Unit Test without Breaking Encapsulation in Node

May 1, 2015

When writing unit tests, the most ugly & painful & stupid thing you might have to do is to expose some internal implementation of your module to the testing code so that:

  • It is easier to enumerate all possible conditional branches to cover some edge cases; (although if you have a complex design, you can always achieve this by mocking things, however sometimes it's an overkill)
  • It is possible to inspect side effects of your code; (accept the dark side of the reality, you cannot totally avoid side effects)
  • It is easier to replace some dependencies with mocks. (although if you have a good design, you should be able to inject all dependencies, but it's not a common thing in javascript realm)