Your source of geek knowledge


Latest stories

Integration Tests in Service Fabric – Client side deployment


In the most recent post, I showed how the R base class fetches all the test definitions from the cluster and executes the tests one by one. In this post, I will walk you through the client side deployment. One of the nice benefits of Service Fabric is that it provides out of the box a relatively complete deployment story. It is possible to deploy application packages entirely in code by using Powershell or C#. All you need for that to work is the latest SDK. To deploy an application to the...

Integration Tests in Service Fabric – Client side test cases


In the last post, I showed how it is possible to write test fixture that gets access to the reliable state manager and more that is only available when running on the cluster. In this post, I’ll explain the client side that interacts over remote proxies with the tests that are running on the cluster. In the post about the test definition I showed that in order to interact with the tests defined in the OrderShippingTests stateful service that is deployed with the...

MultiProducerConcurrentConsumer – Completion


In the last post about the MPCC I explained how the asynchronous synchronization works by leveraging the power of a TaskCompletionSource. Today I’ll walk you through the completion method. The completion method has essentially two modes. A drain mode and a non-drain mode. In the drain mode, all items that are enqueued will be asynchronously pushed until all internal queues are empty. In the non-drain mode, the queues will be emptied but nothing will be pushed if there is something left...

Integration Tests in Service Fabric – Write tests accessing infrastructure


Previously I explained how the test definition works. In this post I’ll show how we declare tests and get access to the infrastructure provided by the stateful service. Components that are used inside a stateful service most likely end-up using either the StatefulServiceContext, the IStatefulServicePartition, the IReliableStateManager or other methods and properties provided by the stateful service inheritance hierarchy. Let’s have an oversimplified look at how the hierarchy looks...

Integration Tests in Service Fabric – Test definition


In the last post I gave an overview of the conventions that drive the solution structure and define the test applications. All the code I’m going to explore in this, and future blog posts can be found on my ServiceFabric.Testing repository. The code in the repository doesn’t use the OrderShipping analogy used in the post, but I’ll hope you still get the point ;). The OrderShippingTests project stateful service has to inherit from the stateful service called AbstractTestRunner...

Integration Tests in Service Fabric – The structure


In my last post, I gave a quick overview how running tests inside Service Fabric looks like both from Visual Studio and Jetbrains Rider. To be able to dive deeper into the infrastructure, I want to present the high-level component pieces first. Every project has its own conventions how tests are componentized and structured around the production code. Many teams I’ve seen usually have a dedicated assembly per production assembly which contains a certain category of tests. For example, if...

Better way of running integration tests inside Service Fabric


In the last post, I showed how you could run integration tests inside Service Fabric.┬áThe approach I showed has one mature problem: It is not possible to reliably run these tests from within your favourite IDE of choices like Visual Studio or Jetbrains Rider. Today I’ll show you a more sophisticated approach to run tests inside Service Fabric including support to run the tests from within any IDE that allows running NUnit tests. Here is a short video how it looks like. The video is...

MultiProducerConcurrentConsumer – Asynchronous synchronisation


In the last post I explained how the push in batches up to the concurrency per slot works. This post covers the asynchronous synchronisation approach I used to unleash the push in batches when the batch size is reached. In the code shown in the Push It post I simplified the synchronisation primitive and called it syncEvent. In reality, the code uses a TaskCompletionSource for synchronisation. The MPCC declares a field of type TaskCompletionSource<bool>. For the MPCC the TResult type of...

MultiProducerConcurrentConsumer – Push in batches up to concurrency per slot


In the previous post I introduced the PushInBatches method who’s responsibility it is to start the PushInBatchesUpToConcurrencyPerQueueForAGivenSlot process. In this post I will focus on the mouthful method above. Like the name of the method already suggest its responsibility is to push items for a slot in batches to the pump delegate while respecting the concurrency settings per slot as provided by the user and explained in the introduction post. Without further ado here is the whole...

Running integration tests inside Service Fabric


I’m currently diving into Service Fabric. One of the difficult things that you’ll be faced with when you write code against the Service Fabric APIs is how you can integration test those components. Infrastructure like the reliable state manager is only available inside Service Fabric. So somehow you need to run the tests that are testing the components that use infrastructure like reliable state manager inside the cluster. In this post, I show you an approach which allows running...

Recent Posts