test: Remove use of "mitchellh/go-testing-interface" for stdlib. (#25640)

The stdlib testing package now includes this interface, so we can
remove our dependency on the external library.
This commit is contained in:
James Rasell
2025-04-14 07:43:49 +01:00
committed by GitHub
parent d293684d3d
commit 85c30dfd1e
16 changed files with 44 additions and 47 deletions

View File

@@ -4,19 +4,19 @@
package tasklifecycle
import (
"testing"
"time"
"github.com/hashicorp/nomad/nomad/structs"
"github.com/hashicorp/nomad/testutil"
testing "github.com/mitchellh/go-testing-interface"
)
func RequireTaskBlocked(t testing.T, c *Coordinator, task *structs.Task) {
func RequireTaskBlocked(t testing.TB, c *Coordinator, task *structs.Task) {
ch := c.StartConditionForTask(task)
requireChannelBlocking(t, ch, task.Name)
}
func RequireTaskAllowed(t testing.T, c *Coordinator, task *structs.Task) {
func RequireTaskAllowed(t testing.TB, c *Coordinator, task *structs.Task) {
ch := c.StartConditionForTask(task)
requireChannelPassing(t, ch, task.Name)
}
@@ -33,7 +33,7 @@ func WaitNotInitUntil(c *Coordinator, until time.Duration, errorFunc func()) {
})
}
func requireChannelPassing(t testing.T, ch <-chan struct{}, name string) {
func requireChannelPassing(t testing.TB, ch <-chan struct{}, name string) {
testutil.WaitForResult(func() (bool, error) {
return !isChannelBlocking(ch), nil
}, func(_ error) {
@@ -41,7 +41,7 @@ func requireChannelPassing(t testing.T, ch <-chan struct{}, name string) {
})
}
func requireChannelBlocking(t testing.T, ch <-chan struct{}, name string) {
func requireChannelBlocking(t testing.TB, ch <-chan struct{}, name string) {
testutil.WaitForResult(func() (bool, error) {
return isChannelBlocking(ch), nil
}, func(_ error) {