Unverified Commit 7488d1c9 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #59571 from dims/skip-test-routes-when-there-are-no-vms

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Skip TestRoutes when there are no vm(s) **What this PR does / why we need it**: 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 **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: Please see https://github.com/dims/openstack-cloud-controller-manager/issues/73 for some more context **Release note**: ```release-note NONE ```
parents fdeaa8c6 18f1486e
...@@ -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