summaryrefslogtreecommitdiffstats
path: root/htesting
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-10-17 11:54:55 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-10-18 12:13:13 +0200
commitba35e69856900b6fc92681aa841cdcaefbb4b121 (patch)
treeb9ffc699a99b2d6d947e1d53c383a1352ce93980 /htesting
parentc7957c90e83ff2b2cc958bd61486a244f0fd8891 (diff)
Add a cross process build lock and use it in the archetype content builder
Fixes #9048
Diffstat (limited to 'htesting')
-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) {