Running Service Fabric Unit-Tests in Linux Container

Introduction

As you may know (or not) I am working on open-source project that simplifies configuration of Service Fabric Reliable Services in .NET. This project (as I believe almost all projects) has unit-tests and some of these unit-tests use (indirectly) instances of StatefulService and StatelessService classes.

Quite recently (a few month ago) I was configuring continuous integration using AWS CodeBuild. Simple enough I created the following build definition:

  version: 0.2
  phases:
    install:
      commands:
        - cd src
    pre_build:
      commands:
        - dotnet restore
    build:
      commands:
        - dotnet build -c Release --no-restore
        - dotnet test -c Test --no-restore --no-build
  

… and used aws/codebuild/dot-net:core-2.0 image on Linux as build environment.

Unfortunately the first build ended with the the following exception:

System.TypeInitializationException
The type initializer for ‘System.Fabric.Common.AppTrace’ threw an exception.
System.DllNotFoundException
Unable to load shared library ‘libFabricCommon.so’ or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibFabricCommon.so.so: cannot open shared object file: No such file or directory.

The solution was found but this was a long journey…

Continue reading “Running Service Fabric Unit-Tests in Linux Container”