Test your code without writing mocks with ephemeral Docker containers ๐Ÿ“ฆ Setup popular services with just a couple lines of code โฑ๏ธ No bash, no yaml, only code ๐Ÿ’ป

Gnomock โ€“ tests without mocks

๐Ÿ—๏ธ Spin up entire dependency stack

๐ŸŽ Setup initial dependency state โ€“ easily!

๐Ÿญ Test against actual, close to production software

โณ Spend no time writing mocks

๐Ÿ•น๏ธ Test actual program behavior and side effects

PkgGoDev Test Go Report Card codecov

Gnomock is an integration and end-to-end testing toolkit. It uses Docker to create temporary containers for application dependencies, setup their initial state and clean them up in the end. Gnomock allows to test the code with no mocks wherever possible.

The power of Gnomock is in a variety of Presets, each implementing a specific database, service or other tools. Each preset provides ways of setting up its initial state as easily as possible: SQL schema creation, test data upload into S3, sending test events to Splunk, etc.

The name "Gnomock" stands for "no mock", with a "G" for "Go" ๐Ÿ˜ผ . It also sounds like "gnome", that's why the friendly garden gnome artwork (by Michael Zolotov)

Demo

See for yourself how easy and fast it is to write tests that use actual services running in ephemeral Docker containers:

asciicast

Table of contents

Getting started

Gnomock can be used in two different ways:

  • Imported directly as a package in any Go project
  • Accessed over HTTP running as a daemon in any other language

โš ๏ธ Both ways require an active Docker daemon running locally in the same environment.

Using Gnomock in Go applications

See the following example to get started:

go get github.com/orlangure/gnomock

Setting up a Postgres container with schema setup example:

import (
	"database/sql"

	_ "github.com/lib/pq" // postgres driver
	"github.com/orlangure/gnomock"
	"github.com/orlangure/gnomock/preset/postgres"
)

p := postgres.Preset(
    postgres.WithUser("gnomock", "gnomick"),
    postgres.WithDatabase("mydb"),
    postgres.WithQueriesFile("/var/project/db/schema.sql"),
)
container, _ := gnomock.Start(p)
defer func() { _ = gnomock.Stop(container) }()

connStr := fmt.Sprintf(
    "host=%s port=%d user=%s password=%s  dbname=%s sslmode=disable",
    container.Host, container.DefaultPort(),
    "gnomock", "gnomick", "mydb",
)
db, _ := sql.Open("postgres", connStr)
// db has the required schema and data, and is ready to use

See package reference. For Preset documentation, refer to Presets section.

Using Gnomock in other languages

If you use Go, please refer to Using Gnomock in Go applications section. Otherwise, refer to documentation.

Official presets

The power of Gnomock is in the Presets. Existing Presets with their supported* versions are listed below.

* Supported versions are tested as part of CI pipeline. Other versions might work as well.

Preset Go package HTTP API Go API Supported versions
Localstack (AWS) Go package Docs Reference 0.12.2
Splunk Go package Docs Reference 8.0.2
Redis Go package Docs Reference 5.0.10, 6.0.9
Memcached Go package Docs Reference 1.6.9
MySQL Go package Docs Reference 5.7.32, 8.0.22
MariaDB Go package Docs Reference 10.5.8
PostgreSQL Go package Docs Reference 10.15, 11.10, 12.5, 13.1
Microsoft SQL Server Go package Docs Reference 2017-latest, 2019-latest
MongoDB Go package Docs Reference 3.6.21, 4.4
RabbitMQ Go package Docs Reference 3.8.9-alpine, 3.8.9-management-alpine
Kafka Go package Docs Reference 2.5.1-L0
Elasticsearch Go package Docs Reference 5.6, 6.8.13, 7.9.3
Kubernetes Go package Docs Reference v1.19.3
CockroachDB Go package Docs Reference v19.2.11, v20.1.10

It is possible to use Gnomock directly from Go code without any presets. HTTP API only allows to setup containers using presets that exist in this repository.

Similar projects

Gnomock is not the only project that aims to simplify integration and end-to-end testing by using ephemeral docker containers:

  • testcontainers/testcontainers-go
  • ory/dockertest

These projects are amazing, and they give plenty of flexibility and power to their users. There are many things that are possible with them, but are impossible with Gnomock. Still, below is a short list of things that sometimes give Gnomock an advantage:

  • Gnomock tries to provide a batteries-included solution. Gnomock has a growing number of Presets, each one implementing an integration with a popular external service. For every Preset, there already is a number of "invisible" utilities that transparently relieve you from implementing them yourself:
    • Built-in health check function that you don't even need to know it exists. It makes sure you only get control over a container when it is ready to use.
    • Wrappers for some of the configuration exposed by the container, such as default username/password. You can easily provide your own credentials to connect to the container.
    • Seed data ingestion for your convenience. Sometimes you just need to make sure your queries work given some data. Gnomock puts your data in there with a single line of code. Sometimes you only test a program that consumes messages from Kafka, and Gnomock produces the messages for you with another line of code.
  • Simple API that does not expose anything that happens "under the hood" most of the time. Yet Gnomock allows some additional configuration and custom Preset implementation whenever necessary.
  • Gnomock's vision includes being useful not only in Go projects, but in any projects via HTTP. It already supports almost all its features over HTTP layer, has a clear OpenAPI spec, and even a proof of concept wrapper in Python.
  • Gnomock has a friendly garden gnome mascot ๐Ÿ˜ป

Troubleshooting

Tests with Gnomock take too long and time-out eventually

It happens a lot locally if your internet isn't fast enough to pull docker images used in tests. In CI, such as in Github Actions, the images are downloaded very quickly. To work around this issue locally, pull the image manually before running the tests. You only need to do it once, the images stay in local cache until deleted. For example, to pull Postgres 11 image, run:

docker pull postgres:11

Tests time-out even when the image exists locally

It can happen if the containers can't become ready to use before they time out. By default, Gnomock uses fairly high timeouts for new containers (for starting and for setting them up). If you choose to change default timeout using WithTimeout (timeout in HTTP), it is possible that the values you choose are too short.

Tests pass when run one-by-one, and fail when run in parallel

It happens when you try to start up a lot of containers at the same time. The system, especially in CI environments such as Github Actions, cannot handle the load, and containers fail to become healthy before they time-out. That's the reason Gnomock has a few separate build jobs, each running only a small subset of tests, one package at a time.

Containers fail to setup with a "File not found" error

If you run gnomock as a server, you need to make sure the files you use in your setup are available inside gnomock container. Use -v $(pwd):$(pwd) argument to docker run to mount the current working directory under the same path inside the gnomock container. If you prefer to keep a permanent gnomock container running, you can mount your entire $HOME directory (or any other directory where you keep the code).

Owner
Yury Fedorov
Software Developer
Yury Fedorov
Comments
  • Bug:  can't connect to container: canceled after error: %!w(<nil>)

    Bug: can't connect to container: canceled after error: %!w()

    Describe the bug Gnomock fails to connect to containers. I've forked this repo and ran the tests in it and I receive the same error as my own tests. I suspect it has something to do with docker but i'm not sure what, these tests were working before i updated to the newest docker (prior to that I was a few major versions behind). To Reproduce For me, and another colleague just running any tests that call gnomock.Start() causes the error.

    Screenshots Here are some scerens of attempting to run the postgres preset tests, they take forever but eventually they do fail with the following error: === RUN TestPreset/10.15 preset_test.go:37: Error Trace: preset_test.go:37 Error: Received unexpected error: can't connect to container: canceled after error: %!w() Test: TestPreset/10.15 --- FAIL: TestPreset/10.15 (312.93s)

    image

    System (please complete the following information):

    • OS: [e.g. MacOS] Windows 10 Professional
    • Version [e.g. 0.9.2]
    	github.com/orlangure/gnomock v0.12.0
    
    • Docker version
    Client: Docker Engine - Community
    Cloud integration: 1.0.9
    Version:           20.10.5
    API version:       1.41
    Go version:        go1.13.15
    Git commit:        55c4c88
    Built:             Tue Mar  2 20:14:53 2021
    OS/Arch:           windows/amd64
    Context:           default
    Experimental:      true
    
    Server: Docker Engine - Community
    Engine:
     Version:          20.10.5
     API version:      1.41 (minimum version 1.12)
     Go version:       go1.13.15
     Git commit:       363e9a8
     Built:            Tue Mar  2 20:15:47 2021
     OS/Arch:          linux/amd64
     Experimental:     false
    containerd:
     Version:          1.4.3
     GitCommit:        269548fa27e0089a8b8278fc4fc781d7f65a939b
    runc:
     Version:          1.0.0-rc92
     GitCommit:        ff819c7e9184c13b7c2607fe6c30ae19403a7aff
    docker-init:
     Version:          0.19.0
     GitCommit:        de40ad0
    
    
  • Add support for re-usable containers

    Add support for re-usable containers

    Add support for developers to pass gnomock.WithContainerReuse() option that makes Gnomock attempt to re-use an already running container with the name specified via gnomock.WithContainerName().

    If the container with the given name does not exist, or if it uses a different image than the one configured, the normal flow of Gnomock is used, namely a new container is created in case it doesn't exist, or replaced if using a different image.

    Pending:

    • [x] Agree on technical solution
    • [x] Add inline comments
    • [x] Write tests
  • Implement Cassandra preset

    Implement Cassandra preset

    A short guide on implementing a new preset: https://github.com/orlangure/gnomock/blob/master/CONTRIBUTING.md#new-presets

    MySQL preset for inspiration: https://github.com/orlangure/gnomock/tree/master/preset/mysql

    The objective is to implement a new Preset that spins up Cassandra docker container, sets up its initial state (user provided data), waits for it to become ready and kills it in the end.

    Please note that there are multiple steps required to create a new preset (see the guide above). I'm here to help ๐Ÿ˜ผ

  • Bug: gnomockd in github action 'services:' & 'container:' requires preallocated exposed port range

    Bug: gnomockd in github action 'services:' & 'container:' requires preallocated exposed port range

    Describe the bug When using gnomockd as a GitHub Actions "service container" outside the container needs to connect to not only the gnomockd port, but also the ports of the services it starts.

    This works when using services on the default runner container, however it fails when the services are run on a specified container.

    In order for that to work, the service needs to expose 23042, which works, however the ports of the started services also need to be exposed, so they can be seen in sibling containers.

    One way to remedy this is to expose large ranges of ports which gnomockd is likely to end up being given, like -p 24000-26000:24000-26000, however that fails because of https://github.com/moby/moby/issues/11185

    In order to get around that, gnomockd would need to force the service containers to be started with ports from a smaller preallocated range.

    It might be possible for gnomockd to detect which ports were exposed when its container was set up (i.e. the docker -p 24000-24500:24000-24500). If not, the same range in the docker -p argument needs to be passed to gnomockd as a cli arg so that it knows which range are visible outside the container.

    To Reproduce In order to verify the created services can be accessed, I am using:

    nc -vvv -z 127.0.0.1 $(curl 127.0.0.1:23042/start/mongo -d '{}' | jq .ports.default.port)

    https://github.com/jayvdb/gnomock/blob/demo-github-action/.github/workflows/test.yaml contains four jobs.

    https://github.com/jayvdb/gnomock/actions/runs/1836345457 is the output.

    Ignore the first and fourth.

    The second shows "services" working normally with image orlangure/gnomock (which is an old version of gnomockd). For some reason, only port 23042 needs to be exposed. I tried removing that, and it fails.

    The third shows that using "container: .." for a job breaks gnomockd. It is able to connect to port 23042, but not to the port where the created service is hosted.

    The fourth is a more manual but incomplete attempt at trying to get the github action to work with a sibling container. Even connecting to port 23042 fails.

    Expected behavior It should be possible to tell gnomockd to use a predetermined port range for services it starts, so that it is possible to expose them allowing the services started by gnomockd to be accessed from a sibling container.

    System (please complete the following information):

    • OS: GitHub Actions runner ubuntu-latest (focal)
    • Version: https://github.com/orlangure/gnomock/commit/9770ce0849ed193427470c01454225cae2cc9870 - v0.19.0+21
    • Docker version: GitHub Actions runner default
  • Suggestion: Add image name to kafka preset

    Suggestion: Add image name to kafka preset

    Since this image for kafka doesn't really work with M1 (yet) there has been a need to override the default image name

    Good idea or not to have this in the main repo?

  • Ryuk from testcontainers adoption

    Ryuk from testcontainers adoption

    Testcontainers have a really nice feature to cleanup stuff with help of https://github.com/testcontainers/moby-ryuk https://github.com/testcontainers/testcontainers-go/blob/master/reaper.go

    Would you consider that in your library? Or maybe the question one step further - is it possible to adopt low-level testcontainers api under the hood? As I really like api of gnomock, however testcontainer maintainers doing a great job keeping away all the docker issues.

  • Kubernetes preset

    Kubernetes preset

    It would be incredibly useful to have a Kubernetes preset, that spins up an empty cluster (maybe https://k3s.io/) and gives code access to it in some sort (https://github.com/kubernetes/client-go)?

  • Support explicit port mappings in remote mode

    Support explicit port mappings in remote mode

    When gnomock runs in server mode, it is impossible to control the port mappings created by the presets. In this commit I add an ability to override preset-specific named ports by any other values in order to control which ports are allocated by the remote gnomock instance.

    This feature is a bit fragile, because the user is required to study the preset before attempting to override its built-in values. Custom named ports must expose the ports with the same names and internal ports for the override to work. Basically, only the "host port" value should be changed.

    This commit fixes https://github.com/orlangure/gnomock/issues/441.

  • Bug: gnomock-cleaner not work well in M1(arm64)

    Bug: gnomock-cleaner not work well in M1(arm64)

    Describe the bug StartCustom cleaner image maybe(random) hang at the M1 system. docker logs print this

    no specific platform was requested
    qemu: uncaught target signal 11 (Segmentation fault) - core dumped
    

    To Reproduce Start any preset in M1

    Expected behavior work well

    System (please complete the following information):

    • OS: MacOS
    • Version 12.2
    • Docker version 20.10.7

    Please add arm64 platform docker images in the dockerhub

  • Postgres Preset: Add support for timezone

    Postgres Preset: Add support for timezone

    Hey !

    I needed something like this for a project I'm working on, and though it would be useful for someone else. What do you think about this ?

    It was fun doing this, if you need anything else, let me know !

    P.S. Big thanks for this project !

  • Bump github.com/aws/aws-sdk-go from 1.44.37 to 1.44.57

    Bump github.com/aws/aws-sdk-go from 1.44.37 to 1.44.57

    Bumps github.com/aws/aws-sdk-go from 1.44.37 to 1.44.57.

    Release notes

    Sourced from github.com/aws/aws-sdk-go's releases.

    Release v1.44.57 (2022-07-18)

    Service Client Updates

    • service/discovery: Updates service API and documentation
      • Add AWS Agentless Collector details to the GetDiscoverySummary API response
    • service/ec2: Updates service documentation
      • Documentation updates for Amazon EC2.
    • service/elasticache: Updates service API and documentation
      • Adding AutoMinorVersionUpgrade in the DescribeReplicationGroups API
    • service/kms: Updates service API, documentation, and paginators
      • Added support for the SM2 KeySpec in China Partition Regions
    • service/mediapackage: Updates service API and documentation
      • This release adds "IncludeIframeOnlyStream" for Dash endpoints and increases the number of supported video and audio encryption presets for Speke v2
    • service/sagemaker: Updates service API, documentation, and paginators
      • Amazon SageMaker Edge Manager provides lightweight model deployment feature to deploy machine learning models on requested devices.
    • service/sso-admin: Updates service API, documentation, and paginators

    Release v1.44.56 (2022-07-15)

    Service Client Updates

    • service/datasync: Updates service documentation
    • service/drs: Updates service API and documentation
    • service/evidently: Updates service API, documentation, and paginators
    • service/wafv2: Updates service API and documentation

    Release v1.44.55 (2022-07-14)

    Service Client Updates

    • service/athena: Updates service API and documentation
      • This release updates data types that contain either QueryExecutionId, NamedQueryId or ExpectedBucketOwner. Ids must be between 1 and 128 characters and contain only non-whitespace characters. ExpectedBucketOwner must be 12-digit string.
    • service/codeartifact: Updates service API and documentation
    • service/config: Updates service API and documentation
    • service/ec2: Updates service API
      • This release adds flow logs for Transit Gateway to allow customers to gain deeper visibility and insights into network traffic through their Transit Gateways.
    • service/fms: Updates service API and documentation
    • service/glue: Updates service API and documentation
      • This release adds an additional worker type for Glue Streaming jobs.
    • service/inspector2: Updates service API and documentation
    • service/kendra: Updates service API, documentation, and paginators
      • This release adds AccessControlConfigurations which allow you to redefine your document level access control without the need for content re-indexing.
    • service/nimble: Updates service API and documentation
    • service/outposts: Updates service API and documentation
    • service/sagemaker: Updates service API and documentation
      • This release adds support for G5, P4d, and C6i instance types in Amazon SageMaker Inference and increases the number of hyperparameters that can be searched from 20 to 30 in Amazon SageMaker Automatic Model Tuning

    Release v1.44.54 (2022-07-13)

    ... (truncated)

    Changelog

    Sourced from github.com/aws/aws-sdk-go's changelog.

    Release v1.44.57 (2022-07-18)

    Service Client Updates

    • service/discovery: Updates service API and documentation
      • Add AWS Agentless Collector details to the GetDiscoverySummary API response
    • service/ec2: Updates service documentation
      • Documentation updates for Amazon EC2.
    • service/elasticache: Updates service API and documentation
      • Adding AutoMinorVersionUpgrade in the DescribeReplicationGroups API
    • service/kms: Updates service API, documentation, and paginators
      • Added support for the SM2 KeySpec in China Partition Regions
    • service/mediapackage: Updates service API and documentation
      • This release adds "IncludeIframeOnlyStream" for Dash endpoints and increases the number of supported video and audio encryption presets for Speke v2
    • service/sagemaker: Updates service API, documentation, and paginators
      • Amazon SageMaker Edge Manager provides lightweight model deployment feature to deploy machine learning models on requested devices.
    • service/sso-admin: Updates service API, documentation, and paginators

    Release v1.44.56 (2022-07-15)

    Service Client Updates

    • service/datasync: Updates service documentation
    • service/drs: Updates service API and documentation
    • service/evidently: Updates service API, documentation, and paginators
    • service/wafv2: Updates service API and documentation

    Release v1.44.55 (2022-07-14)

    Service Client Updates

    • service/athena: Updates service API and documentation
      • This release updates data types that contain either QueryExecutionId, NamedQueryId or ExpectedBucketOwner. Ids must be between 1 and 128 characters and contain only non-whitespace characters. ExpectedBucketOwner must be 12-digit string.
    • service/codeartifact: Updates service API and documentation
    • service/config: Updates service API and documentation
    • service/ec2: Updates service API
      • This release adds flow logs for Transit Gateway to allow customers to gain deeper visibility and insights into network traffic through their Transit Gateways.
    • service/fms: Updates service API and documentation
    • service/glue: Updates service API and documentation
      • This release adds an additional worker type for Glue Streaming jobs.
    • service/inspector2: Updates service API and documentation
    • service/kendra: Updates service API, documentation, and paginators
      • This release adds AccessControlConfigurations which allow you to redefine your document level access control without the need for content re-indexing.
    • service/nimble: Updates service API and documentation
    • service/outposts: Updates service API and documentation
    • service/sagemaker: Updates service API and documentation
      • This release adds support for G5, P4d, and C6i instance types in Amazon SageMaker Inference and increases the number of hyperparameters that can be searched from 20 to 30 in Amazon SageMaker Automatic Model Tuning

    Release v1.44.54 (2022-07-13)

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Bump github.com/aws/aws-sdk-go from 1.44.167 to 1.44.170

    Bump github.com/aws/aws-sdk-go from 1.44.167 to 1.44.170

    Bumps github.com/aws/aws-sdk-go from 1.44.167 to 1.44.170.

    Release notes

    Sourced from github.com/aws/aws-sdk-go's releases.

    Release v1.44.170 (2022-12-29)

    Service Client Updates

    • service/apigateway: Updates service documentation
      • Documentation updates for Amazon API Gateway
    • service/elasticmapreduce: Updates service API and documentation
      • Added GetClusterSessionCredentials API to allow Amazon SageMaker Studio to connect to EMR on EC2 clusters with runtime roles and AWS Lake Formation-based access control for Apache Spark, Apache Hive, and Presto queries.
    • service/secretsmanager: Updates service API and documentation
      • Added owning service filter, include planned deletion flag, and next rotation date response parameter in ListSecrets.
    • service/wisdom: Updates service API and documentation

    Release v1.44.169 (2022-12-28)

    Service Client Updates

    • service/elasticache: Updates service API and documentation
      • This release allows you to modify the encryption in transit setting, for existing Redis clusters. You can now change the TLS configuration of your Redis clusters without the need to re-build or re-provision the clusters or impact application availability.
    • service/network-firewall: Updates service API and documentation
    • service/rds: Updates service API, documentation, waiters, paginators, and examples
      • This release adds support for Custom Engine Version (CEV) on RDS Custom SQL Server.
    • service/route53-recovery-control-config: Updates service documentation and paginators

    Release v1.44.168 (2022-12-27)

    Service Client Updates

    • service/memorydb: Updates service API, documentation, and paginators
    • service/transfer: Updates service API
      • Add additional operations to throw ThrottlingExceptions
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • fix: disabe auto remove if debug is enabled

    fix: disabe auto remove if debug is enabled

    fixes: https://github.com/orlangure/gnomock/issues/748

    Changes

    This PR changes the behaviour of the WithDebugMode option. If it is specified, the container will not be auto removed.

    Tests
    • Stop container without WithDebugMode -> should be gone
    • Stop container with WithDebugMode -> should be still visible
  • feat: add extra hosts option

    feat: add extra hosts option

    Context

    At the moment gnomock doesn't support adding extra hosts to the container. This PR adds a WithExtraHosts option, which implements exactly that. If the option is provided, the extra hosts will be added to the container and otherwise it will just receive an empty array and it will do nothing with it.

    Notes

    ~I am not sure on a proper test for it.~ ~Maybe I could run some busybox and check if the specified host is reachable.~

    Tests:

    • ping with extra host (success)
    • ping without extra host (failure)
    • ping with extra host to other domain (success)
  • Bug: Nearly impossible to debug failing containers

    Bug: Nearly impossible to debug failing containers

    Describe the bug When trying to start a custom container and then it fails, it is nearly impossible to debug what happened. This is mainly due to two reasons:

    1. Container is not shown in any history (e.g. docker ps -a)
    2. Logs are also not there anymore. Neither using docker logs, nor when trying to get the logs from the /var/lib/docker/containers/ directory.

    Also options like WithDisableAutoCleanup() or WithDebugMode() don't seem to change anything.

    To Reproduce There are a lot of options to reproduce. For example the code below will fail with Error running container: can't start container: container network isn't ready: can't inspect container xxx: Error: No such container: xxx. But there is no indication on what really happened.

    _, err := gnomock.StartCustom("busybox", gnomock.DefaultTCP(8080))
    if err != nil {
    	fmt.Printf("Error running container: %s", err)
    }
    

    Expected behavior A proper error message is shown or at least it is possible to check the logs or the description of the failing container.

    System (please complete the following information):

    • OS: MacOs
    • Version 12.4
    • Docker version: Docker Desktop 4.11.1 (84025)
    • gnomock version: v0.24.0
    • go version: 18.4 darwin/arm64

    Additional context Might be related to https://github.com/orlangure/gnomock/issues/8

  • Add container reset feature + postgres impl

    Add container reset feature + postgres impl

    This feature allows to reset containers to their initial state between tests, when reused.

    As the first example, I implemented Reset function for postgres preset. It drops schemas and deletes users, and then calls the regular init function to restore the state requested by user options in the beginning. New postgres test suite demonstrates how the feature can be used.

  • Request: allow use of already previous test session Docker containers

    Request: allow use of already previous test session Docker containers

    Context: Starting Docker containers can take from a few seconds to some minutes depending on the Docker image being used. The current implementation forcefully kills containers if there is already one running with the same container name. This impedes the ability of setting up a faster test workflow for developers to do so: the re-use of the same container in different test runs.

    Proposal: Allow developers to pass an option like .WithContainerNameReuse("some-container-name") (or other some other option name) that would make Gnomock re-use the container with the given name, instead of killing it and starting a new.

Just Dance Unlimited mock-up server written on Golang and uses a popular Gin framework for Go.

BDCS Just Dance Unlimited mock-up server written on Golang and uses a popular Gin framework for Go. Features Security Authorization works using UbiSer

Nov 10, 2021
A toolkit with common assertions and mocks that plays nicely with the standard library

Testify - Thou Shalt Write Tests โ„น๏ธ We are working on testify v2 and would love to hear what you'd like to see in it, have your say here: https://cutt

Dec 30, 2022
Configuration management tool inspired by Ansible, but with no yaml - just Go

GOSSH This repo is an experiement with creating a declarative IT automation and configuration management package for Golang. Think Ansible, but no Yam

Dec 21, 2022
Test your command line interfaces on windows, linux and osx and nodes viรก ssh and docker

Commander Define language independent tests for your command line scripts and programs in simple yaml files. It runs on windows, osx and linux It can

Dec 17, 2022
HTTP mocking to test API services for chaos scenarios
HTTP mocking to test API services for chaos scenarios

GAOS HTTP mocking to test API services for chaos scenarios Gaos, can create and provide custom mock restful services via using your fully-customizable

Nov 5, 2022
go-test-trace is like go test but it also generates distributed traces.
go-test-trace is like go test but it also generates distributed traces.

go-test-trace go-test-trace is like go test but it also generates distributed traces. Generated traces are exported in OTLP to a OpenTelemetry collect

Jan 5, 2023
Flugel Test Documentation for steps to run and test the automatio
Flugel Test Documentation for steps to run and test the automatio

Flugel Test Documentation Documentation for steps to run and test the automation #Test-01 1 - Local Test Using Terratest (End To End) 1- By runing " t

Nov 13, 2022
Test-assignment - Test assignment with golang
Test-assignment - Test assignment with golang

test-assignment We have a two steam of data and we need to save it in the map: I

Jan 19, 2022
This repository includes consumer driven contract test for provider, unit test and counter api.

This repository includes consumer driven contract test for provider, unit test and counter api.

Feb 1, 2022
Create your own mock server with just a JSON file!

Gmocker Run a blazing fast mock server in just seconds! ?? All you need is to make a json file that contains path and response mapping. See an example

Dec 21, 2022
Create your own blazing fast mock server with just a JSON file!

Gmocker Run a blazing fast mock server in just seconds! ?? All you need is to make a json file that contains path and response mapping. See an example

Dec 21, 2022
Ritchie CLI is an open-source tool that allows to create, store and share any kind of automation, executing them through command lines, to run operations or start workflows โš™๏ธ ๐Ÿ–ฅ ๐Ÿ’ก
Ritchie CLI is an open-source tool that allows to create, store and share any kind of automation, executing them through command lines, to run operations or start workflows โš™๏ธ ๐Ÿ–ฅ ๐Ÿ’ก

Table of contents 1. About 2. Getting Started i. Installation ii. Initialize rit locally iii. Add your first formulas repository iv. Run the Hello Wor

Dec 29, 2022
Automatically generate Go test boilerplate from your source code.
Automatically generate Go test boilerplate from your source code.

gotests gotests makes writing Go tests easy. It's a Golang commandline tool that generates table driven tests based on its target source files' functi

Jan 8, 2023
Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.
Selenium Hub successor running browsers within containers. Scalable, immutable, self hosted Selenium-Grid on any platform with single binary.

Selenoid Selenoid is a powerful implementation of Selenium hub using Docker containers to launch browsers. Features One-command Installation Start bro

Jan 5, 2023
Rest API to receive solana tokens in testnet just like a faucet

solana-example Rest API to receive solana tokens in testnet just like a faucet Running go run main.go Test Request airdrop curl --header "Content-Type

Oct 14, 2021
This is just a repository to play around with Generics and Fuzzing, two big things coming with go 1.18!

This is just a repository to play around with Generics and Fuzzing, two big things coming with go 1.18!

Feb 6, 2022
Generate a test coverage badge like this one for your go projects.

coverage-badge-go ?? Generate a test coverage badge like this one for your go projects. Usage on: pull_request: branches: -

Dec 11, 2022
Cloud Spanner load generator to load test your application and pre-warm the database before launch

GCSB GCSB Quickstart Create a test table Load data into table Run a load test Operations Load Single table load Multiple table load Loading into inter

Nov 30, 2022
Testing framework for Go. Allows writing self-documenting tests/specifications, and executes them concurrently and safely isolated. [UNMAINTAINED]

GoSpec GoSpec is a BDD-style testing framework for the Go programming language. It allows writing self-documenting tests/specs, and executes them in p

Nov 28, 2022