Skip to content

Commit 4f20cfc

Browse files
committed
libct/int: use testing.TB for utils
...so that they can be used for benchmarks, too. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent 5190d61 commit 4f20cfc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

libcontainer/integration/template_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type tParam struct {
3232
// and the default setup for devices.
3333
//
3434
// If p is nil, a default container is created.
35-
func newTemplateConfig(t *testing.T, p *tParam) *configs.Config {
35+
func newTemplateConfig(t testing.TB, p *tParam) *configs.Config {
3636
var allowedDevices []*devices.Rule
3737
for _, device := range specconv.AllowedDevices {
3838
allowedDevices = append(allowedDevices, &device.Rule)

libcontainer/integration/utils_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ func ok(t testing.TB, err error) {
8585
}
8686
}
8787

88-
func waitProcess(p *libcontainer.Process, t *testing.T) {
88+
func waitProcess(p *libcontainer.Process, t testing.TB) {
8989
t.Helper()
9090
status, err := p.Wait()
9191
if err != nil {
@@ -99,7 +99,7 @@ func waitProcess(p *libcontainer.Process, t *testing.T) {
9999

100100
// newRootfs creates a new tmp directory and copies the busybox root
101101
// filesystem to it.
102-
func newRootfs(t *testing.T) string {
102+
func newRootfs(t testing.TB) string {
103103
t.Helper()
104104
dir := t.TempDir()
105105
if err := copyBusybox(dir); err != nil {
@@ -165,7 +165,7 @@ func copyBusybox(dest string) error {
165165
return nil
166166
}
167167

168-
func newContainer(t *testing.T, config *configs.Config) (*libcontainer.Container, error) {
168+
func newContainer(t testing.TB, config *configs.Config) (*libcontainer.Container, error) {
169169
name := strings.ReplaceAll(t.Name(), "/", "_") + strconv.FormatInt(-int64(time.Now().Nanosecond()), 35)
170170
root := t.TempDir()
171171

@@ -176,7 +176,7 @@ func newContainer(t *testing.T, config *configs.Config) (*libcontainer.Container
176176
//
177177
// buffers are returned containing the STDOUT and STDERR output for the run
178178
// along with the exit code and any go error
179-
func runContainer(t *testing.T, config *configs.Config, args ...string) (buffers *stdBuffers, exitCode int, err error) {
179+
func runContainer(t testing.TB, config *configs.Config, args ...string) (buffers *stdBuffers, exitCode int, err error) {
180180
container, err := newContainer(t, config)
181181
if err != nil {
182182
return nil, -1, err
@@ -214,7 +214,7 @@ func runContainer(t *testing.T, config *configs.Config, args ...string) (buffers
214214

215215
// runContainerOk is a wrapper for runContainer, simplifying its use for cases
216216
// when the run is expected to succeed and return exit code of 0.
217-
func runContainerOk(t *testing.T, config *configs.Config, args ...string) *stdBuffers {
217+
func runContainerOk(t testing.TB, config *configs.Config, args ...string) *stdBuffers {
218218
buffers, exitCode, err := runContainer(t, config, args...)
219219

220220
t.Helper()

0 commit comments

Comments
 (0)