mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
internal: test/env: switch to assert.TestingT
Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
parent
175b1d7830
commit
ba0afa6ba8
3 changed files with 12 additions and 22 deletions
|
@ -12,16 +12,6 @@ import (
|
||||||
"gotest.tools/assert"
|
"gotest.tools/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
type testingT interface {
|
|
||||||
assert.TestingT
|
|
||||||
logT
|
|
||||||
Fatalf(string, ...interface{})
|
|
||||||
}
|
|
||||||
|
|
||||||
type logT interface {
|
|
||||||
Logf(string, ...interface{})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clean the environment, preserving protected objects (images, containers, ...)
|
// Clean the environment, preserving protected objects (images, containers, ...)
|
||||||
// and removing everything else. It's meant to run after any tests so that they don't
|
// and removing everything else. It's meant to run after any tests so that they don't
|
||||||
// depend on each others.
|
// depend on each others.
|
||||||
|
|
|
@ -157,7 +157,7 @@ func (e *Execution) IsUserNamespace() bool {
|
||||||
// HasExistingImage checks whether there is an image with the given reference.
|
// HasExistingImage checks whether there is an image with the given reference.
|
||||||
// Note that this is done by filtering and then checking whether there were any
|
// Note that this is done by filtering and then checking whether there were any
|
||||||
// results -- so ambiguous references might result in false-positives.
|
// results -- so ambiguous references might result in false-positives.
|
||||||
func (e *Execution) HasExistingImage(t testingT, reference string) bool {
|
func (e *Execution) HasExistingImage(t assert.TestingT, reference string) bool {
|
||||||
if ht, ok := t.(test.HelperT); ok {
|
if ht, ok := t.(test.HelperT); ok {
|
||||||
ht.Helper()
|
ht.Helper()
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ func newProtectedElements() protectedElements {
|
||||||
// ProtectAll protects the existing environment (containers, images, networks,
|
// ProtectAll protects the existing environment (containers, images, networks,
|
||||||
// volumes, and, on Linux, plugins) from being cleaned up at the end of test
|
// volumes, and, on Linux, plugins) from being cleaned up at the end of test
|
||||||
// runs
|
// runs
|
||||||
func ProtectAll(t testingT, testEnv *Execution) {
|
func ProtectAll(t assert.TestingT, testEnv *Execution) {
|
||||||
if ht, ok := t.(test.HelperT); ok {
|
if ht, ok := t.(test.HelperT); ok {
|
||||||
ht.Helper()
|
ht.Helper()
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ func ProtectAll(t testingT, testEnv *Execution) {
|
||||||
|
|
||||||
// ProtectContainer adds the specified container(s) to be protected in case of
|
// ProtectContainer adds the specified container(s) to be protected in case of
|
||||||
// clean
|
// clean
|
||||||
func (e *Execution) ProtectContainer(t testingT, containers ...string) {
|
func (e *Execution) ProtectContainer(t assert.TestingT, containers ...string) {
|
||||||
if ht, ok := t.(test.HelperT); ok {
|
if ht, ok := t.(test.HelperT); ok {
|
||||||
ht.Helper()
|
ht.Helper()
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ func (e *Execution) ProtectContainer(t testingT, containers ...string) {
|
||||||
|
|
||||||
// ProtectContainers protects existing containers from being cleaned up at the
|
// ProtectContainers protects existing containers from being cleaned up at the
|
||||||
// end of test runs
|
// end of test runs
|
||||||
func ProtectContainers(t testingT, testEnv *Execution) {
|
func ProtectContainers(t assert.TestingT, testEnv *Execution) {
|
||||||
if ht, ok := t.(test.HelperT); ok {
|
if ht, ok := t.(test.HelperT); ok {
|
||||||
ht.Helper()
|
ht.Helper()
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ func getExistingContainers(t assert.TestingT, testEnv *Execution) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProtectImage adds the specified image(s) to be protected in case of clean
|
// ProtectImage adds the specified image(s) to be protected in case of clean
|
||||||
func (e *Execution) ProtectImage(t testingT, images ...string) {
|
func (e *Execution) ProtectImage(t assert.TestingT, images ...string) {
|
||||||
if ht, ok := t.(test.HelperT); ok {
|
if ht, ok := t.(test.HelperT); ok {
|
||||||
ht.Helper()
|
ht.Helper()
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ func (e *Execution) ProtectImage(t testingT, images ...string) {
|
||||||
|
|
||||||
// ProtectImages protects existing images and on linux frozen images from being
|
// ProtectImages protects existing images and on linux frozen images from being
|
||||||
// cleaned up at the end of test runs
|
// cleaned up at the end of test runs
|
||||||
func ProtectImages(t testingT, testEnv *Execution) {
|
func ProtectImages(t assert.TestingT, testEnv *Execution) {
|
||||||
if ht, ok := t.(test.HelperT); ok {
|
if ht, ok := t.(test.HelperT); ok {
|
||||||
ht.Helper()
|
ht.Helper()
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ func tagsFromImageSummary(image types.ImageSummary) []string {
|
||||||
|
|
||||||
// ProtectNetwork adds the specified network(s) to be protected in case of
|
// ProtectNetwork adds the specified network(s) to be protected in case of
|
||||||
// clean
|
// clean
|
||||||
func (e *Execution) ProtectNetwork(t testingT, networks ...string) {
|
func (e *Execution) ProtectNetwork(t assert.TestingT, networks ...string) {
|
||||||
if ht, ok := t.(test.HelperT); ok {
|
if ht, ok := t.(test.HelperT); ok {
|
||||||
ht.Helper()
|
ht.Helper()
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ func (e *Execution) ProtectNetwork(t testingT, networks ...string) {
|
||||||
|
|
||||||
// ProtectNetworks protects existing networks from being cleaned up at the end
|
// ProtectNetworks protects existing networks from being cleaned up at the end
|
||||||
// of test runs
|
// of test runs
|
||||||
func ProtectNetworks(t testingT, testEnv *Execution) {
|
func ProtectNetworks(t assert.TestingT, testEnv *Execution) {
|
||||||
if ht, ok := t.(test.HelperT); ok {
|
if ht, ok := t.(test.HelperT); ok {
|
||||||
ht.Helper()
|
ht.Helper()
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ func getExistingNetworks(t assert.TestingT, testEnv *Execution) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProtectPlugin adds the specified plugin(s) to be protected in case of clean
|
// ProtectPlugin adds the specified plugin(s) to be protected in case of clean
|
||||||
func (e *Execution) ProtectPlugin(t testingT, plugins ...string) {
|
func (e *Execution) ProtectPlugin(t assert.TestingT, plugins ...string) {
|
||||||
if ht, ok := t.(test.HelperT); ok {
|
if ht, ok := t.(test.HelperT); ok {
|
||||||
ht.Helper()
|
ht.Helper()
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ func (e *Execution) ProtectPlugin(t testingT, plugins ...string) {
|
||||||
|
|
||||||
// ProtectPlugins protects existing plugins from being cleaned up at the end of
|
// ProtectPlugins protects existing plugins from being cleaned up at the end of
|
||||||
// test runs
|
// test runs
|
||||||
func ProtectPlugins(t testingT, testEnv *Execution) {
|
func ProtectPlugins(t assert.TestingT, testEnv *Execution) {
|
||||||
if ht, ok := t.(test.HelperT); ok {
|
if ht, ok := t.(test.HelperT); ok {
|
||||||
ht.Helper()
|
ht.Helper()
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ func getExistingPlugins(t assert.TestingT, testEnv *Execution) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProtectVolume adds the specified volume(s) to be protected in case of clean
|
// ProtectVolume adds the specified volume(s) to be protected in case of clean
|
||||||
func (e *Execution) ProtectVolume(t testingT, volumes ...string) {
|
func (e *Execution) ProtectVolume(t assert.TestingT, volumes ...string) {
|
||||||
if ht, ok := t.(test.HelperT); ok {
|
if ht, ok := t.(test.HelperT); ok {
|
||||||
ht.Helper()
|
ht.Helper()
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ func (e *Execution) ProtectVolume(t testingT, volumes ...string) {
|
||||||
|
|
||||||
// ProtectVolumes protects existing volumes from being cleaned up at the end of
|
// ProtectVolumes protects existing volumes from being cleaned up at the end of
|
||||||
// test runs
|
// test runs
|
||||||
func ProtectVolumes(t testingT, testEnv *Execution) {
|
func ProtectVolumes(t assert.TestingT, testEnv *Execution) {
|
||||||
if ht, ok := t.(test.HelperT); ok {
|
if ht, ok := t.(test.HelperT); ok {
|
||||||
ht.Helper()
|
ht.Helper()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue