summaryrefslogtreecommitdiffstats
path: root/htesting/test_helpers.go
diff options
context:
space:
mode:
Diffstat (limited to 'htesting/test_helpers.go')
-rw-r--r--htesting/test_helpers.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/htesting/test_helpers.go b/htesting/test_helpers.go
index 9a1fe86ef..20722f092 100644
--- a/htesting/test_helpers.go
+++ b/htesting/test_helpers.go
@@ -25,6 +25,18 @@ import (
"github.com/spf13/afero"
)
+// IsTest reports whether we're running as a test.
+var IsTest bool
+
+func init() {
+ for _, arg := range os.Args {
+ if strings.HasPrefix(arg, "-test.") {
+ IsTest = true
+ break
+ }
+ }
+}
+
// CreateTempDir creates a temp dir in the given filesystem and
// returns the dirnam and a func that removes it when done.
func CreateTempDir(fs afero.Fs, prefix string) (string, func(), error) {