Squadron

Squadron

  • Docs
  • Blog
  • GitHub

›Introduction

Introduction

  • Introduction
  • Quickstart
  • Basic Concept
  • Container Options
  • Configuration
  • Multiple resources

Container Providers

  • MongoDB
  • MongoDB Replica Set
  • SQL Server
  • Elasticsearch
  • PostgreSQL
  • Redis
  • RabbitMQ
  • Azure Storage
  • Generic
  • Compose

Azure Cloud Providers

  • Setup
  • ServiceBus
Edit

Container Options

Default container options are always provided by to resource implementation. You can overwrite options by creating a new options class and override the configure() method.

Example to overwrite image tag for a Redis resource to use an alpine image

We have tested the containers tags using the driver version and default options. When overriding these options it is your responsibility to ensure that tag and driver versions are compatible.

public class RedisSpecialTagOptions : RedisDefaultOptions
{
    public override void Configure(ContainerResourceBuilder builder)
    {
        base.Configure(builder);
        builder.Tag("alpine")
    }
}

And use the custom resource in your test

    public class RedisSpecialTagTests : IClassFixture<RedisResource<RedisSpecialTagOptions>>
    {
        private readonly RedisResource<RedisSpecialTagOptions> _redisResource;

        public RedisSpecialTagTests(RedisResource<RedisSpecialTagOptions> redisResource)
        {
            _redisResource = redisResource;
        }
    }

The following options can be configured

PropertyDescriptionExample
ImageDocker image with or without tagmongo:4.0
TagDocker image tagalpine
InternalPortInternal port inside the container27017
ExternalPortExternal not be defined whenever possible to avoid conflicts, when no port is defined a dynamic free port will be allocated443
RegistryThe name of a docker registry which will be used to pull the container. Default is Docker Hub, custom registries must be defined in configuration.MyPrivate
WaitTimeoutThe time to wait until a container is ready. Default is 30 seconds60
AddNetworkThe base name of the network, of which the container should be part of (used to connect multiple containers)demo-network
PreferLocalThis option makes sure, that Squadron will search and use local images if available, before pulling them from a registry(no params)
Last updated on 9/7/2020 by Lucien Zimmermann
← Basic ConceptConfiguration →

Community

Contributor License AgreementsCode of Conduct
Swiss Life OSSSwiss Life | OSS
Copyright © 2021 Swiss Life Developers