summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlavio Castelli <fcastelli@suse.com>2018-02-19 16:35:45 +0100
committerFlavio Castelli <fcastelli@suse.com>2018-02-19 16:35:45 +0100
commitbccfcf90d60aafdf986be9c97fd57cd1e940684d (patch)
tree63c8a83a47875e66d22fdeccd2ecf4026158969a
parent25bb6410572caf2daa51b85b6d5de5fac609f710 (diff)
downloadterraform-provider-libvirt-bccfcf90d60aafdf986be9c97fd57cd1e940684d.tar
terraform-provider-libvirt-bccfcf90d60aafdf986be9c97fd57cd1e940684d.tar.gz
Fix broken tests on Travis
Some tests on travis are failing because there's no libvirt daemon running. Marking these tests as acceptance tests.
-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()