mirror of https://github.com/apache/jclouds.git
updating live test to work with other nova installations
This commit is contained in:
parent
b6df1a5833
commit
ec2a83197d
|
@ -1,3 +1,21 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.openstack.nova.v1_1.features;
|
||||
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
|
|
|
@ -96,7 +96,7 @@ public class FloatingIPClientLiveTest extends BaseNovaClientLiveTest {
|
|||
for (String regionId : context.getApi().getConfiguredRegions()) {
|
||||
FloatingIPClient client = context.getApi().getFloatingIPClientForRegion(regionId);
|
||||
ServerClient serverClient = context.getApi().getServerClientForRegion(regionId);
|
||||
Server server = serverClient.createServer("test", "121", "100");
|
||||
Server server = serverClient.createServer("test", imageIdForRegion(regionId), flavorRefForRegion(regionId));
|
||||
blockUntilServerActive(server.getId(), serverClient);
|
||||
FloatingIP floatingIP = client.allocate();
|
||||
assertNotNull(floatingIP);
|
||||
|
@ -111,6 +111,16 @@ public class FloatingIPClientLiveTest extends BaseNovaClientLiveTest {
|
|||
}
|
||||
}
|
||||
|
||||
private String imageIdForRegion(String regionId) {
|
||||
ImageClient imageClient = context.getApi().getImageClientForRegion(regionId);
|
||||
return Iterables.getLast(imageClient.listImages()).getId();
|
||||
}
|
||||
|
||||
private String flavorRefForRegion(String regionId) {
|
||||
FlavorClient flavorClient = context.getApi().getFlavorClientForRegion(regionId);
|
||||
return Iterables.getLast(flavorClient.listFlavors()).getId();
|
||||
}
|
||||
|
||||
private void blockUntilServerActive(String serverId, ServerClient client) throws InterruptedException {
|
||||
Server currentDetails = null;
|
||||
for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.ACTIVE; currentDetails = client
|
||||
|
|
Loading…
Reference in New Issue