1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

testutil: use testing.TB instead of assert.TestingT

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2019-09-23 14:23:01 +02:00
parent 0d4ffa3588
commit 51ca8081d8
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
13 changed files with 152 additions and 288 deletions

View file

@ -2,10 +2,10 @@ package daemon
import (
"context"
"testing"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/testutil"
"gotest.tools/assert"
)
@ -13,10 +13,8 @@ import (
type ConfigConstructor func(*swarm.Config)
// CreateConfig creates a config given the specified spec
func (d *Daemon) CreateConfig(t assert.TestingT, configSpec swarm.ConfigSpec) string {
if ht, ok := t.(testutil.HelperT); ok {
ht.Helper()
}
func (d *Daemon) CreateConfig(t testing.TB, configSpec swarm.ConfigSpec) string {
t.Helper()
cli := d.NewClientT(t)
defer cli.Close()
@ -26,10 +24,8 @@ func (d *Daemon) CreateConfig(t assert.TestingT, configSpec swarm.ConfigSpec) st
}
// ListConfigs returns the list of the current swarm configs
func (d *Daemon) ListConfigs(t assert.TestingT) []swarm.Config {
if ht, ok := t.(testutil.HelperT); ok {
ht.Helper()
}
func (d *Daemon) ListConfigs(t testing.TB) []swarm.Config {
t.Helper()
cli := d.NewClientT(t)
defer cli.Close()
@ -39,10 +35,8 @@ func (d *Daemon) ListConfigs(t assert.TestingT) []swarm.Config {
}
// GetConfig returns a swarm config identified by the specified id
func (d *Daemon) GetConfig(t assert.TestingT, id string) *swarm.Config {
if ht, ok := t.(testutil.HelperT); ok {
ht.Helper()
}
func (d *Daemon) GetConfig(t testing.TB, id string) *swarm.Config {
t.Helper()
cli := d.NewClientT(t)
defer cli.Close()
@ -52,10 +46,8 @@ func (d *Daemon) GetConfig(t assert.TestingT, id string) *swarm.Config {
}
// DeleteConfig removes the swarm config identified by the specified id
func (d *Daemon) DeleteConfig(t assert.TestingT, id string) {
if ht, ok := t.(testutil.HelperT); ok {
ht.Helper()
}
func (d *Daemon) DeleteConfig(t testing.TB, id string) {
t.Helper()
cli := d.NewClientT(t)
defer cli.Close()
@ -65,10 +57,8 @@ func (d *Daemon) DeleteConfig(t assert.TestingT, id string) {
// UpdateConfig updates the swarm config identified by the specified id
// Currently, only label update is supported.
func (d *Daemon) UpdateConfig(t assert.TestingT, id string, f ...ConfigConstructor) {
if ht, ok := t.(testutil.HelperT); ok {
ht.Helper()
}
func (d *Daemon) UpdateConfig(t testing.TB, id string, f ...ConfigConstructor) {
t.Helper()
cli := d.NewClientT(t)
defer cli.Close()