mirror of
https://github.com/wahyd4/cert-manager.git
synced 2026-08-08 20:58:17 +10:00
Prefer RUNFILES_DIR if it is set
Signed-off-by: James Munnelly <jmunnelly@apple.com>
This commit is contained in:
@@ -41,17 +41,15 @@ func PathForCRD(t *testing.T, name string) string {
|
||||
}
|
||||
|
||||
func CRDDirectory(t *testing.T) string {
|
||||
runfiles := os.Getenv("RUNFILES_DIR")
|
||||
bazelDir := BazelBinDir
|
||||
if runfiles == "" && bazelDir == "" {
|
||||
t.Fatalf("integration tests can only run within 'bazel test' environment or have BAZEL_BIN_DIR set")
|
||||
}
|
||||
var path string
|
||||
if bazelDir != "" {
|
||||
path = filepath.Join(bazelDir, "deploy", "crds")
|
||||
} else {
|
||||
path := filepath.Join(bazelDir, "deploy", "crds")
|
||||
|
||||
// prefer RUNFILES_DIR if set
|
||||
runfiles := os.Getenv("RUNFILES_DIR")
|
||||
if runfiles != "" {
|
||||
path = filepath.Join(runfiles, "com_github_jetstack_cert_manager", "deploy", "crds")
|
||||
}
|
||||
|
||||
info, err := os.Stat(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user