Tomas Tulka's Blog
Random thoughts about programming and other stuff.
Designing a system architecture is always about making tradeoffs. Microservices resp. serverless architecture has a lot of benefits, but some drawbacks as well. One of them is testing. Testing serverless systems is hard. In this article I will discuss some practices which work for my project.
Implementing a SaaS as a multitenant system brings a lot of benefits. As usual, there are some tradeoffs, too. For example security becomes more complex. Let's take a look at possible approaches when implementing security in a multitenant architectrure.
Queues and topics are standard communication channels in messaging systems. How to use then in AWS, for example to implement the Competing Consumers pattern?
TypeScript application wants tests to be written in TypeScript as well, right?
Let's image an external standalone program producing a big amount of binary data. Good example is a files converter (images, mp3s, documents, etc).
How to design such a program and what are the pitfalls of the approach?
When one-thread-access is too restrictive, and we want to allow more threads to our resource then come semaphores on the stage.
But there is one important difference in these approaches.
It's recommended to avoid any asynchrony within the scope of test, but this is unfortunaly not possible everywhere. In some systems the caller must wait for another thread or transaction to be completed.
Testing asynchrony could be pretty tricky, not always is clear how long must a test wait for a result to be delivered - if it's too little the test fails event when the tested functionality works, if it's too long the test is just wasting time (so expensive especially in the commit stage).
So, how to deal with this problem?
Not everywhere could be immutable objects used to ensure thread-safe code.
It's easy to generate test mock JSON data for a small HTTP request or a similar use, because there is a planty of online tools providing this functionality for you.
But what if you want to generate data for a database performance test for systems like MongoDB or Elasticsearch?