package dktesting
import "github.com/golang-migrate/migrate/v4/dktesting"
Index ¶
- func ParallelTest(t *testing.T, specs []ContainerSpec, testFunc func(*testing.T, dktest.ContainerInfo))
- type ContainerSpec
Examples ¶
Functions ¶
func ParallelTest ¶
func ParallelTest(t *testing.T, specs []ContainerSpec, testFunc func(*testing.T, dktest.ContainerInfo))
ParallelTest runs Docker tests in parallel
Code:play
Example¶
package main
import (
"context"
"testing"
"github.com/dhui/dktest"
"github.com/golang-migrate/migrate/v4/dktesting"
)
func main() {
t := &testing.T{} // Should actually be used in a Test
var isReady = func(ctx context.Context, c dktest.ContainerInfo) bool {
// Return true if the container is ready to run tests.
// Don't block here though. Use the Context to timeout container ready checks.
return true
}
dktesting.ParallelTest(t, []dktesting.ContainerSpec{{ImageName: "docker_image:9.6",
Options: dktest.Options{ReadyFunc: isReady}}}, func(t *testing.T, c dktest.ContainerInfo) {
// Run your test/s ...
t.Fatal("...")
})
}
Types ¶
type ContainerSpec ¶
ContainerSpec holds Docker testing setup specifications
Source Files ¶
- Version
- v4.12.1
- Published
- Jul 28, 2020
- Platform
- darwin/amd64
- Imports
- 2 packages
- Last checked
- 1 hour ago –
Tools for package owners.