Files
nomad/testutil/file.go
James Rasell 85c30dfd1e 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.
2025-04-14 07:43:49 +01:00

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
}