Skip to content

This project is a Docker image designed to run Service Fabric oriented unit-tests (.NET Core) on Linux.

License

Notifications You must be signed in to change notification settings

coherentsolutionsinc/service-fabric-run-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 

Repository files navigation

What this image is about?

This image is designed to run Service Fabric oriented unit-tests (.NET Core) on Linux.

The latest version can be found on DockerHub.

Why is that needed?

Consider the following simple test:

public class MyStatefulService : Microsoft.ServiceFabric.Services.Runtime.StatefulService
{
    public MyStatefulService(
        StatefulServiceContext serviceContext)
        : base(serviceContext)
    {
    }

    protected override Task RunAsync(
        CancellationToken cancellationToken)
    {
        if (cancellationToken.IsCancellationRequested)
        {
            throw new InvalidOperationException();
        }
        return Task.CompletedTask;
    }
}

public class MyStatefulServiceTests
{
    [Fact]
    public async Task RunAsync_Should_raise_InvalidOperationException_When_CancellationToken_is_cancelled()
    {
        // Arrange
        var instance = new MyStatefulService(MockStatefulServiceContextFactory.Default);
        var cancellationTokenSource = new CancellationTokenSource();
        
        // Act, Assert
        cancellationTokenSource.Cancel();

        await Assert.ThrowsAsync<InvalidOperationException>(() => instance.InvokeRunAsync(cancellationTokenSource.Token));
    }
}

Despite it's simplicity this unit-test requires installed servicefabric runtime and servicefabricsdkcommon package installed to run. These packages cannot be installed as part of container build see issue.

The image solves the exactly this problem by performing manual copy of the required files from the packages.

Tags

  • latest

    The latest tag is the same as runtime.ver-dotnetsdk.ver with the latest available version of runtime and sdk.

  • latest-light

    The latest-light tag is the same as runtime.ver-light with the latest available version of runtime.

  • <runtime.ver-dotnetsdk.ver>

    When image is tagged as runtime.ver-dotnetsdk.ver format i.e. images like 6.4.634.1-2.2 this indicates that current image has binaries from servicefabric=6.4.634.1 runtime and has dotnet-2.2-sdk installed.

  • <runtime.ver-light>

    When image is tagged as runtime.ver-light format i.e. image tag 6.4.634.1-light this indicates that current image has binaries from servicefabric=6.4.634.1 runtime installed. The purpose of this image is to provide more flexibility for scenarios where version of dotnet sdk can vary significantly.

Authors

This project is owned and maintained by Coherent Solutions.

About

This project is a Docker image designed to run Service Fabric oriented unit-tests (.NET Core) on Linux.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published