Files
nomad/testutil/file.go
Michael Schurter ef24e40b39 identity: support jwt expiration and rotation (#18262)
Implements expirations and renewals for alternate workload identity tokens.
2023-09-08 14:50:34 -07:00

21 lines
492 B
Go

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package testutil
import (
"os"
"path/filepath"
testing "github.com/mitchellh/go-testing-interface"
"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.T, path ...string) []byte {
contents, err := os.ReadFile(filepath.Join(path...))
must.NoError(t, err)
return contents
}