Skip to main content

Package test

This package acts as a wrapper over Golang's testing module.

Interfaces

Suite

Interface

type TestingSuite interface {
Env() *env.Environment
SetEnv(environment *env.Environment)
SetT(t *testing.T)
T() *testing.T
SetupSuite() []Option
}

Functions

Run()

Parameters

  • t *testing.T
  • suite TestingSuite
  • extraOptions ...Option

Description

This is the starting point for a gosoline integration test. This performs the following steps:

  1. Uses reflection to find all test cases declared by a given TestSuite.
  2. Applies each of the extraOptions.
  3. Creates a kernel with whatever modules or APIs were declared in the SetupSuite and SetupApiDefinitions.
  4. Runs the tests.

Configuration

Test components are docker container like wiremock or localstack which support you in your integration tests to mock your applications infrastructure.

image configuration

The used image for a component can be configured on a global and on a per component level. The following configuration snipped shows a config for two wiremock components. mockA gets the image configuration from the global level which is configured via the key test.defaults.images.wiremock and mockB has local configuration. With this, mockA gets tag 3.4.0 and mockB gets 3.3.0.

test:
defaults:
images:
wiremock:
repository: wiremock/wiremock
tag: 3.4.0
components:
wiremock:
mockA:
expire_after: 5m
mockB:
image:
repository: wiremock/wiremock
tag: 3.3.0
expire_after: 5m