summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--integration/execution_test.go7
-rw-r--r--integration/utils.go14
2 files changed, 16 insertions, 5 deletions
diff --git a/integration/execution_test.go b/integration/execution_test.go
index 82fa2b9..3492fa3 100644
--- a/integration/execution_test.go
+++ b/integration/execution_test.go
@@ -22,16 +22,13 @@ func TestExecuteDUT(t *testing.T) {
t.Skip("Environment variable '" + ENV_NATIVE_SIM_FIRMWARE + "' not set")
}
- dir, err := os.MkdirTemp("", "iot-contact-go-*")
- if err != nil {
- t.Skip("Could not create temporary directory")
- }
+ dir := tempdir(t)
defer os.RemoveAll(dir)
cmd := exec.Command(firmware)
cmd.Dir = dir
- err = cmd.Start()
+ err := cmd.Start()
if err != nil {
t.Fatalf("Could not start native sim firmware: %v", err)
}
diff --git a/integration/utils.go b/integration/utils.go
new file mode 100644
index 0000000..12e1f62
--- /dev/null
+++ b/integration/utils.go
@@ -0,0 +1,14 @@
+package integration
+
+import (
+ "os"
+ "testing"
+)
+
+func tempdir(t *testing.T) string {
+ dir, err := os.MkdirTemp("", "iot-contact-go-integration-test-*")
+ if err != nil {
+ t.Skip("Could not create temporary directory for integration test.")
+ }
+ return dir
+}