mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
The stdlib testing package now includes this interface, so we can remove our dependency on the external library.
21 lines
451 B
Go
21 lines
451 B
Go
// Copyright (c) HashiCorp, Inc.
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package testutil
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/shoenig/test/must"
|
|
)
|
|
|
|
// MustReadFile returns the contents of the specified file or fails the test.
|
|
// Multiple arguments are joined with filepath.Join.
|
|
func MustReadFile(t testing.TB, path ...string) []byte {
|
|
contents, err := os.ReadFile(filepath.Join(path...))
|
|
must.NoError(t, err)
|
|
return contents
|
|
}
|