aboutsummaryrefslogtreecommitdiff
path: root/libvirt
diff options
context:
space:
mode:
Diffstat (limited to 'libvirt')
-rw-r--r--libvirt/provider_test.go6
-rw-r--r--libvirt/utils_libvirt_test.go18
2 files changed, 24 insertions, 0 deletions
diff --git a/libvirt/provider_test.go b/libvirt/provider_test.go
index 75f4d418..629f4306 100644
--- a/libvirt/provider_test.go
+++ b/libvirt/provider_test.go
@@ -2,6 +2,7 @@ package libvirt
import (
"os"
+ "strings"
"testing"
"github.com/hashicorp/terraform/helper/schema"
@@ -35,3 +36,8 @@ func testAccPreCheck(t *testing.T) {
t.Fatal("LIBVIRT_DEFAULT_URI must be set for acceptance tests")
}
}
+
+func testAccEnabled() bool {
+ v := os.Getenv("TF_ACC")
+ return v == "1" || strings.ToLower(v) == "true"
+}
diff --git a/libvirt/utils_libvirt_test.go b/libvirt/utils_libvirt_test.go
index e735d105..abaaea30 100644
--- a/libvirt/utils_libvirt_test.go
+++ b/libvirt/utils_libvirt_test.go
@@ -47,6 +47,10 @@ func connect(t *testing.T) *libvirt.Connect {
}
func TestGetHostArchitecture(t *testing.T) {
+ if !testAccEnabled() {
+ t.Logf("Acceptance tests skipped unless env 'TF_ACC' set")
+ return
+ }
conn := connect(t)
defer conn.Close()
@@ -65,6 +69,10 @@ func TestGetHostArchitecture(t *testing.T) {
}
func TestGetCanonicalMachineName(t *testing.T) {
+ if !testAccEnabled() {
+ t.Logf("Acceptance tests skipped unless env 'TF_ACC' set")
+ return
+ }
conn := connect(t)
defer conn.Close()
@@ -88,6 +96,11 @@ func TestGetCanonicalMachineName(t *testing.T) {
}
func TestGetOriginalMachineName(t *testing.T) {
+ if !testAccEnabled() {
+ t.Logf("Acceptance tests skipped unless env 'TF_ACC' set")
+ return
+ }
+
conn := connect(t)
defer conn.Close()
arch := "x86_64"
@@ -115,6 +128,11 @@ func TestGetOriginalMachineName(t *testing.T) {
}
func TestGetHostCapabilties(t *testing.T) {
+ if !testAccEnabled() {
+ t.Logf("Acceptance tests skipped unless env 'TF_ACC' set")
+ return
+ }
+
start := time.Now()
conn := connect(t)
defer conn.Close()