Commit 18f1486e authored by Davanum Srinivas's avatar Davanum Srinivas

Skip TestRoutes when there are no vm(s)

TestRoutes assumes that there is at least one vm in the OpenStack it is connecting to. So let's limit this test to run properly only when we are running in a VM or one was created already outside of the test harness
parent b5387eff
...@@ -40,9 +40,17 @@ func TestRoutes(t *testing.T) { ...@@ -40,9 +40,17 @@ func TestRoutes(t *testing.T) {
t.Fatalf("Failed to construct/authenticate OpenStack: %s", err) t.Fatalf("Failed to construct/authenticate OpenStack: %s", err)
} }
vms := getServers(os)
_, err = os.InstanceID()
if err != nil || len(vms) == 0 {
t.Skipf("Please run this test in an OpenStack vm or create at least one VM in OpenStack before you run this test.")
}
// We know we have at least one vm.
servername := vms[0].Name
// Pick the first router and server to try a test with // Pick the first router and server to try a test with
os.routeOpts.RouterID = getRouters(os)[0].ID os.routeOpts.RouterID = getRouters(os)[0].ID
servername := getServers(os)[0].Name
r, ok := os.Routes() r, ok := os.Routes()
if !ok { if !ok {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment