mirror of https://github.com/apache/jclouds.git
live tests bug fixes
This commit is contained in:
parent
ea206d4036
commit
7e4029136e
|
@ -129,7 +129,7 @@ public class NovaComputeServiceLiveTest extends ComputeBase {
|
||||||
.family(OsFamily.UBUNTU).description("ffoo").build()));
|
.family(OsFamily.UBUNTU).description("ffoo").build()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expectedExceptions = JSchException.class, expectedExceptionsMessageRegExp = "Auth fail", timeOut = 60000)
|
@Test(expectedExceptions = JSchException.class, expectedExceptionsMessageRegExp = "Auth fail", timeOut = 120000)
|
||||||
void testScriptExecutionWithWrongCredentials() throws Throwable, RunScriptOnNodesException, URISyntaxException, InterruptedException {
|
void testScriptExecutionWithWrongCredentials() throws Throwable, RunScriptOnNodesException, URISyntaxException, InterruptedException {
|
||||||
NodeMetadata node = getDefaultNodeImmediately(group);
|
NodeMetadata node = getDefaultNodeImmediately(group);
|
||||||
String address = awaitForPublicAddressAssigned(node.getId());
|
String address = awaitForPublicAddressAssigned(node.getId());
|
||||||
|
@ -242,7 +242,7 @@ public class NovaComputeServiceLiveTest extends ComputeBase {
|
||||||
return templateBuilder.build();
|
return templateBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(timeOut = 60000)
|
@Test(timeOut = 120000)
|
||||||
public void testGetNodeMetadata() throws Exception {
|
public void testGetNodeMetadata() throws Exception {
|
||||||
Set<NodeMetadata> nodes = Sets.newHashSet(getDefaultNodeImmediately(group));
|
Set<NodeMetadata> nodes = Sets.newHashSet(getDefaultNodeImmediately(group));
|
||||||
awaitForPublicAddressAssigned(nodes.iterator().next().getId());
|
awaitForPublicAddressAssigned(nodes.iterator().next().getId());
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class ClientBase {
|
||||||
return createDefaultServer(defaultName);
|
return createDefaultServer(defaultName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Server createDefaultServer(String serverName) {
|
protected Server createDefaultServer(String serverName) {
|
||||||
String imageRef = client.getImage(testImageId).getURI().toASCIIString();
|
String imageRef = client.getImage(testImageId).getURI().toASCIIString();
|
||||||
String flavorRef = client.getFlavor(1).getURI().toASCIIString();
|
String flavorRef = client.getFlavor(1).getURI().toASCIIString();
|
||||||
|
|
||||||
|
|
|
@ -1,382 +1,380 @@
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
* Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
|
||||||
*
|
*
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
* ====================================================================
|
* ====================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jclouds.openstack.nova.live.novaclient;
|
package org.jclouds.openstack.nova.live.novaclient;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import org.jclouds.domain.Credentials;
|
import org.jclouds.domain.Credentials;
|
||||||
import org.jclouds.http.HttpResponseException;
|
import org.jclouds.http.HttpResponseException;
|
||||||
import org.jclouds.io.Payload;
|
import org.jclouds.io.Payload;
|
||||||
import org.jclouds.net.IPSocket;
|
import org.jclouds.net.IPSocket;
|
||||||
import org.jclouds.openstack.nova.domain.*;
|
import org.jclouds.openstack.nova.domain.*;
|
||||||
import org.jclouds.openstack.nova.options.RebuildServerOptions;
|
import org.jclouds.openstack.nova.options.RebuildServerOptions;
|
||||||
import org.jclouds.ssh.SshClient;
|
import org.jclouds.ssh.SshClient;
|
||||||
import org.jclouds.util.Strings2;
|
import org.jclouds.util.Strings2;
|
||||||
import org.testng.annotations.AfterTest;
|
import org.testng.annotations.AfterTest;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.jclouds.openstack.nova.options.ListOptions.Builder.withDetails;
|
import static org.jclouds.openstack.nova.options.ListOptions.Builder.withDetails;
|
||||||
import static org.testng.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests behavior of {@code NovaClient}
|
* Tests behavior of {@code NovaClient}
|
||||||
*
|
*
|
||||||
* @author Adrian Cole
|
* @author Adrian Cole
|
||||||
*/
|
*/
|
||||||
// disabled [Web Hosting #129069
|
// disabled [Web Hosting #129069
|
||||||
@Test(groups = "live", sequential = true)
|
@Test(groups = "live", sequential = true)
|
||||||
public class NovaClientLiveTest extends ClientBase {
|
public class NovaClientLiveTest extends ClientBase {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListServers() throws Exception {
|
public void testListServers() throws Exception {
|
||||||
Set<Server> response = client.listServers();
|
Set<Server> response = client.listServers();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
long initialContainerCount = response.size();
|
long initialContainerCount = response.size();
|
||||||
assertTrue(initialContainerCount >= 0);
|
assertTrue(initialContainerCount >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListServersDetail() throws Exception {
|
public void testListServersDetail() throws Exception {
|
||||||
Set<Server> response = client.listServers(withDetails());
|
Set<Server> response = client.listServers(withDetails());
|
||||||
assert null != response;
|
assert null != response;
|
||||||
long initialContainerCount = response.size();
|
long initialContainerCount = response.size();
|
||||||
assertTrue(initialContainerCount >= 0);
|
assertTrue(initialContainerCount >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListImages() throws Exception {
|
public void testListImages() throws Exception {
|
||||||
Set<Image> response = client.listImages();
|
Set<Image> response = client.listImages();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
long imageCount = response.size();
|
long imageCount = response.size();
|
||||||
assertTrue(imageCount >= 1);
|
assertTrue(imageCount >= 1);
|
||||||
for (Image image : response) {
|
for (Image image : response) {
|
||||||
assertTrue(image.getId() >= 0);
|
assertTrue(image.getId() >= 0);
|
||||||
assert null != image.getName() : image;
|
assert null != image.getName() : image;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListImagesDetail() throws Exception {
|
public void testListImagesDetail() throws Exception {
|
||||||
Set<Image> response = client.listImages(withDetails());
|
Set<Image> response = client.listImages(withDetails());
|
||||||
assert null != response;
|
assert null != response;
|
||||||
long imageCount = response.size();
|
long imageCount = response.size();
|
||||||
assertTrue(imageCount >= 0);
|
assertTrue(imageCount >= 0);
|
||||||
for (Image image : response) {
|
for (Image image : response) {
|
||||||
assertTrue(image.getId() >= 1);
|
assertTrue(image.getId() >= 1);
|
||||||
assert null != image.getName() : image;
|
assert null != image.getName() : image;
|
||||||
assert null != image.getStatus() : image;
|
assert null != image.getStatus() : image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetImagesDetail() throws Exception {
|
public void testGetImagesDetail() throws Exception {
|
||||||
Set<Image> response = client.listImages(withDetails());
|
Set<Image> response = client.listImages(withDetails());
|
||||||
assert null != response;
|
assert null != response;
|
||||||
long imageCount = response.size();
|
long imageCount = response.size();
|
||||||
assertTrue(imageCount >= 0);
|
assertTrue(imageCount >= 0);
|
||||||
for (Image image : response) {
|
for (Image image : response) {
|
||||||
try {
|
try {
|
||||||
Image newDetails = client.getImage(image.getId());
|
Image newDetails = client.getImage(image.getId());
|
||||||
assertEquals(image, newDetails);
|
assertEquals(image, newDetails);
|
||||||
} catch (HttpResponseException e) {// Ticket #9867
|
} catch (HttpResponseException e) {// Ticket #9867
|
||||||
if (e.getResponse().getStatusCode() != 400)
|
if (e.getResponse().getStatusCode() != 400)
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetImageDetailsNotFound() throws Exception {
|
public void testGetImageDetailsNotFound() throws Exception {
|
||||||
assert client.getImage(12312987) == null;
|
assert client.getImage(12312987) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetServerDetailsNotFound() throws Exception {
|
public void testGetServerDetailsNotFound() throws Exception {
|
||||||
assert client.getServer(12312987) == null;
|
assert client.getServer(12312987) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetServersDetail() throws Exception {
|
public void testGetServersDetail() throws Exception {
|
||||||
Set<Server> response = client.listServers(withDetails());
|
Set<Server> response = client.listServers(withDetails());
|
||||||
assert null != response;
|
assert null != response;
|
||||||
assertTrue(response.size() >= 0);
|
assertTrue(response.size() >= 0);
|
||||||
for (Server server : response) {
|
for (Server server : response) {
|
||||||
Server newDetails = client.getServer(server.getId());
|
Server newDetails = client.getServer(server.getId());
|
||||||
System.out.println("====");
|
System.out.println("====");
|
||||||
|
|
||||||
System.out.println(server);
|
System.out.println(server);
|
||||||
System.out.println(newDetails);
|
System.out.println(newDetails);
|
||||||
System.out.println("====");
|
System.out.println("====");
|
||||||
}
|
}
|
||||||
for (Server server : response) {
|
for (Server server : response) {
|
||||||
Server newDetails = client.getServer(server.getId());
|
Server newDetails = client.getServer(server.getId());
|
||||||
assertEquals(server, newDetails);
|
assertEquals(server, newDetails);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListFlavors() throws Exception {
|
public void testListFlavors() throws Exception {
|
||||||
Set<Flavor> response = client.listFlavors();
|
Set<Flavor> response = client.listFlavors();
|
||||||
assert null != response;
|
assert null != response;
|
||||||
long flavorCount = response.size();
|
long flavorCount = response.size();
|
||||||
assertTrue(flavorCount >= 1);
|
assertTrue(flavorCount >= 1);
|
||||||
for (Flavor flavor : response) {
|
for (Flavor flavor : response) {
|
||||||
assertTrue(flavor.getId() >= 0);
|
assertTrue(flavor.getId() >= 0);
|
||||||
assert null != flavor.getName() : flavor;
|
assert null != flavor.getName() : flavor;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListFlavorsDetail() throws Exception {
|
public void testListFlavorsDetail() throws Exception {
|
||||||
Set<Flavor> response = client.listFlavors(withDetails());
|
Set<Flavor> response = client.listFlavors(withDetails());
|
||||||
assert null != response;
|
assert null != response;
|
||||||
long flavorCount = response.size();
|
long flavorCount = response.size();
|
||||||
assertTrue(flavorCount >= 0);
|
assertTrue(flavorCount >= 0);
|
||||||
for (Flavor flavor : response) {
|
for (Flavor flavor : response) {
|
||||||
assertTrue(flavor.getId() >= 1);
|
assertTrue(flavor.getId() >= 1);
|
||||||
assert null != flavor.getName() : flavor;
|
assert null != flavor.getName() : flavor;
|
||||||
assert null != flavor.getDisk() : flavor;
|
assert null != flavor.getDisk() : flavor;
|
||||||
assert null != flavor.getRam() : flavor;
|
assert null != flavor.getRam() : flavor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetFlavorsDetail() throws Exception {
|
public void testGetFlavorsDetail() throws Exception {
|
||||||
Set<Flavor> response = client.listFlavors(withDetails());
|
Set<Flavor> response = client.listFlavors(withDetails());
|
||||||
assert null != response;
|
assert null != response;
|
||||||
long flavorCount = response.size();
|
long flavorCount = response.size();
|
||||||
assertTrue(flavorCount >= 0);
|
assertTrue(flavorCount >= 0);
|
||||||
for (Flavor flavor : response) {
|
for (Flavor flavor : response) {
|
||||||
Flavor newDetails = client.getFlavor(flavor.getId());
|
Flavor newDetails = client.getFlavor(flavor.getId());
|
||||||
assertEquals(flavor, newDetails);
|
assertEquals(flavor, newDetails);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetFlavorDetailsNotFound() throws Exception {
|
public void testGetFlavorDetailsNotFound() throws Exception {
|
||||||
assert client.getFlavor(12312987) == null;
|
assert client.getFlavor(12312987) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test(enabled = true)
|
@Test(enabled = true)
|
||||||
public void testCreateServer() throws Exception {
|
public void testCreateServer() throws Exception {
|
||||||
Server server = getDefaultServerImmediately();
|
Server server = createDefaultServer(serverPrefix + "for_create");
|
||||||
assertNotNull(server.getAdminPass());
|
assertNotNull(server.getAdminPass());
|
||||||
assertEquals(server.getStatus(), ServerStatus.BUILD);
|
int serverId = server.getId();
|
||||||
int serverId = server.getId();
|
@SuppressWarnings("unused")
|
||||||
@SuppressWarnings("unused")
|
String adminPass = server.getAdminPass();
|
||||||
String adminPass = server.getAdminPass();
|
blockUntilServerActive(serverId);
|
||||||
blockUntilServerActive(serverId);
|
blockUntilPublicAddress(serverId);
|
||||||
blockUntilPublicAddress(serverId);
|
client.getServer(serverId).getAddresses().getPublicAddresses().iterator().next().getAddress();
|
||||||
client.getServer(serverId).getAddresses().getPublicAddresses().iterator().next().getAddress();
|
}
|
||||||
}
|
|
||||||
|
private void blockUntilPublicAddress(int serverId) throws InterruptedException {
|
||||||
private void blockUntilPublicAddress(int serverId) throws InterruptedException {
|
while (client.getServer(serverId).getAddresses().getPublicAddresses().isEmpty()) {
|
||||||
while (client.getServer(serverId).getAddresses().getPublicAddresses().isEmpty()) {
|
System.out.println("Awaiting public address");
|
||||||
System.out.println("Awaiting public address");
|
Thread.sleep(1000);
|
||||||
Thread.sleep(1000);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private void blockUntilServerActive(int serverId) throws InterruptedException {
|
||||||
private void blockUntilServerActive(int serverId) throws InterruptedException {
|
Server currentDetails;
|
||||||
Server currentDetails;
|
for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.ACTIVE; currentDetails = client
|
||||||
for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.ACTIVE; currentDetails = client
|
.getServer(serverId)) {
|
||||||
.getServer(serverId)) {
|
System.out.printf("blocking on status active%n%s%n", currentDetails);
|
||||||
System.out.printf("blocking on status active%n%s%n", currentDetails);
|
Thread.sleep(5 * 1000);
|
||||||
Thread.sleep(5 * 1000);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private void blockUntilServerVerifyResize(int serverId) throws InterruptedException {
|
||||||
private void blockUntilServerVerifyResize(int serverId) throws InterruptedException {
|
Server currentDetails;
|
||||||
Server currentDetails;
|
for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.VERIFY_RESIZE; currentDetails = client
|
||||||
for (currentDetails = client.getServer(serverId); currentDetails.getStatus() != ServerStatus.VERIFY_RESIZE; currentDetails = client
|
.getServer(serverId)) {
|
||||||
.getServer(serverId)) {
|
System.out.printf("blocking on status verify resize%n%s%n", currentDetails);
|
||||||
System.out.printf("blocking on status verify resize%n%s%n", currentDetails);
|
Thread.sleep(5 * 1000);
|
||||||
Thread.sleep(5 * 1000);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private void blockUntilImageActive(int createdImageId) throws InterruptedException {
|
||||||
private void blockUntilImageActive(int createdImageId) throws InterruptedException {
|
Image currentDetails;
|
||||||
Image currentDetails;
|
for (currentDetails = client.getImage(createdImageId); currentDetails.getStatus() != ImageStatus.ACTIVE; currentDetails = client
|
||||||
for (currentDetails = client.getImage(createdImageId); currentDetails.getStatus() != ImageStatus.ACTIVE; currentDetails = client
|
.getImage(createdImageId)) {
|
||||||
.getImage(createdImageId)) {
|
System.out.printf("blocking on status active%n%s%n", currentDetails);
|
||||||
System.out.printf("blocking on status active%n%s%n", currentDetails);
|
Thread.sleep(5 * 1000);
|
||||||
Thread.sleep(5 * 1000);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Test(enabled = true, timeOut = 300000)
|
||||||
@Test(enabled = true, timeOut = 300000)
|
public void testServerDetails() throws Exception {
|
||||||
public void testServerDetails() throws Exception {
|
Server server = getDefaultServerImmediately();
|
||||||
Server server = getDefaultServerImmediately();
|
assertNotNull(server.getHostId(), "Host id: ");
|
||||||
assertNotNull(server.getHostId(), "Host id: ");
|
assertNotNull(server.getAddresses());
|
||||||
assertEquals(server.getStatus(), ServerStatus.ACTIVE);
|
// check metadata
|
||||||
assertNotNull(server.getAddresses());
|
assertEquals(server.getMetadata(), metadata);
|
||||||
// check metadata
|
assertTrue(server.getImageRef().endsWith(String.valueOf(testImageId)));
|
||||||
assertEquals(server.getMetadata(), metadata);
|
// listAddresses tests..
|
||||||
assertTrue(server.getImageRef().endsWith(String.valueOf(testImageId)));
|
assertEquals(client.getAddresses(server.getId()), server.getAddresses());
|
||||||
// listAddresses tests..
|
assertEquals(server.getAddresses().getPublicAddresses().size(), 1);
|
||||||
assertEquals(client.getAddresses(server.getId()), server.getAddresses());
|
assertEquals(client.listPublicAddresses(server.getId()), server.getAddresses().getPublicAddresses());
|
||||||
assertEquals(server.getAddresses().getPublicAddresses().size(), 1);
|
assertEquals(server.getAddresses().getPrivateAddresses().size(), 1);
|
||||||
assertEquals(client.listPublicAddresses(server.getId()), server.getAddresses().getPublicAddresses());
|
assertEquals(client.listPrivateAddresses(server.getId()), server.getAddresses().getPrivateAddresses());
|
||||||
assertEquals(server.getAddresses().getPrivateAddresses().size(), 1);
|
assertPassword(server, server.getAdminPass());
|
||||||
assertEquals(client.listPrivateAddresses(server.getId()), server.getAddresses().getPrivateAddresses());
|
assertTrue(server.getFlavorRef().endsWith("1"));
|
||||||
assertPassword(server, server.getAdminPass());
|
assert server.getProgress() >= 0 : "newDetails.getProgress()" + server.getProgress();
|
||||||
assertTrue(server.getFlavorRef().endsWith("1"));
|
}
|
||||||
assert server.getProgress() >= 0 : "newDetails.getProgress()" + server.getProgress();
|
|
||||||
}
|
|
||||||
|
private void assertPassword(Server server, String pass) throws IOException {
|
||||||
|
IPSocket socket = new IPSocket(Iterables.get(server.getAddresses().getPublicAddresses(), 0).getAddress(), 22);
|
||||||
private void assertPassword(Server server, String pass) throws IOException {
|
//socketTester.apply(socket);
|
||||||
IPSocket socket = new IPSocket(Iterables.get(server.getAddresses().getPublicAddresses(), 0).getAddress(), 22);
|
|
||||||
//socketTester.apply(socket);
|
SshClient client = sshFactory.create(socket, new Credentials("root", keyPair.get("private")));
|
||||||
|
try {
|
||||||
SshClient client = sshFactory.create(socket, new Credentials("root", keyPair.get("private")));
|
client.connect();
|
||||||
try {
|
Payload etcPasswd = client.get("/etc/jclouds.txt");
|
||||||
client.connect();
|
String etcPasswdContents = Strings2.toStringAndClose(etcPasswd.getInput());
|
||||||
Payload etcPasswd = client.get("/etc/jclouds.txt");
|
assertEquals("rackspace", etcPasswdContents.trim());
|
||||||
String etcPasswdContents = Strings2.toStringAndClose(etcPasswd.getInput());
|
} finally {
|
||||||
assertEquals("rackspace", etcPasswdContents.trim());
|
if (client != null)
|
||||||
} finally {
|
client.disconnect();
|
||||||
if (client != null)
|
}
|
||||||
client.disconnect();
|
}
|
||||||
}
|
|
||||||
}
|
@Test(enabled = true, timeOut = 5 * 60 * 1000)
|
||||||
|
public void testRenameServer() throws Exception {
|
||||||
@Test(enabled = true, timeOut = 5 * 60 * 1000)
|
Server server = getDefaultServerImmediately();
|
||||||
public void testRenameServer() throws Exception {
|
int serverId = server.getId();
|
||||||
Server server = getDefaultServerImmediately();
|
String oldName = server.getName();
|
||||||
int serverId = server.getId();
|
client.renameServer(serverId, oldName + "new");
|
||||||
String oldName = server.getName();
|
blockUntilServerActive(serverId);
|
||||||
client.renameServer(serverId, oldName + "new");
|
assertEquals(oldName + "new", client.getServer(serverId).getName());
|
||||||
blockUntilServerActive(serverId);
|
}
|
||||||
assertEquals(oldName + "new", client.getServer(serverId).getName());
|
|
||||||
}
|
@Test(enabled = true, timeOut = 5 * 60 * 1000)
|
||||||
|
public void testChangePassword() throws Exception {
|
||||||
@Test(enabled = true, timeOut = 5 * 60 * 1000)
|
int serverId = getDefaultServerImmediately().getId();
|
||||||
public void testChangePassword() throws Exception {
|
blockUntilServerActive(serverId);
|
||||||
int serverId = getDefaultServerImmediately().getId();
|
client.changeAdminPass(serverId, "elmo");
|
||||||
blockUntilServerActive(serverId);
|
assertPassword(client.getServer(serverId), "elmo");
|
||||||
client.changeAdminPass(serverId, "elmo");
|
|
||||||
assertPassword(client.getServer(serverId), "elmo");
|
}
|
||||||
|
|
||||||
}
|
@Test(enabled = true, timeOut = 10 * 600 * 1000)
|
||||||
|
public void testCreateImage() throws Exception {
|
||||||
@Test(enabled = true, timeOut = 10 * 600 * 1000)
|
Server server = getDefaultServerImmediately();
|
||||||
public void testCreateImage() throws Exception {
|
Image image = getDefaultImageImmediately(server);
|
||||||
Server server = getDefaultServerImmediately();
|
blockUntilImageActive(image.getId());
|
||||||
Image image = getDefaultImageImmediately(server);
|
assertEquals("hoofie", image.getName());
|
||||||
blockUntilImageActive(image.getId());
|
assertEquals(image.getServerRef(), "");
|
||||||
assertEquals("hoofie", image.getName());
|
}
|
||||||
assertEquals(image.getServerRef(), "");
|
|
||||||
}
|
|
||||||
|
@Test(enabled = true, timeOut = 10 * 60 * 1000)
|
||||||
|
public void testRebuildServer() throws Exception {
|
||||||
@Test(enabled = true, timeOut = 10 * 60 * 1000)
|
Server server = getDefaultServerImmediately();
|
||||||
public void testRebuildServer() throws Exception {
|
Image image = getDefaultImageImmediately(server);
|
||||||
Server server = getDefaultServerImmediately();
|
client.rebuildServer(server.getId(), new RebuildServerOptions().withImage(String.valueOf(image.getId())));
|
||||||
Image image = getDefaultImageImmediately(server);
|
blockUntilServerActive(server.getId());
|
||||||
client.rebuildServer(server.getId(), new RebuildServerOptions().withImage(String.valueOf(image.getId())));
|
// issue Web Hosting #119580 createdImageId comes back incorrect after rebuild
|
||||||
blockUntilServerActive(server.getId());
|
assertEquals(image.getURI(), client.getServer(server.getId()).getImageRef());
|
||||||
// issue Web Hosting #119580 createdImageId comes back incorrect after rebuild
|
}
|
||||||
assertEquals(image.getURI(), client.getServer(server.getId()).getImageRef());
|
|
||||||
}
|
@Test(enabled = true, timeOut = 10 * 60 * 1000)
|
||||||
|
public void testRebootHard() throws Exception {
|
||||||
@Test(enabled = true, timeOut = 10 * 60 * 1000)
|
Server server = getDefaultServerImmediately();
|
||||||
public void testRebootHard() throws Exception {
|
client.rebootServer(server.getId(), RebootType.HARD);
|
||||||
Server server = getDefaultServerImmediately();
|
blockUntilServerActive(server.getId());
|
||||||
client.rebootServer(server.getId(), RebootType.HARD);
|
//TODO check
|
||||||
blockUntilServerActive(server.getId());
|
}
|
||||||
//TODO check
|
|
||||||
}
|
@Test(enabled = true, timeOut = 10 * 60 * 1000)
|
||||||
|
public void testRebootSoft() throws Exception {
|
||||||
@Test(enabled = true, timeOut = 10 * 60 * 1000)
|
Server server = getDefaultServerImmediately();
|
||||||
public void testRebootSoft() throws Exception {
|
client.rebootServer(server.getId(), RebootType.SOFT);
|
||||||
Server server = getDefaultServerImmediately();
|
blockUntilServerActive(server.getId());
|
||||||
client.rebootServer(server.getId(), RebootType.SOFT);
|
//TODO check
|
||||||
blockUntilServerActive(server.getId());
|
}
|
||||||
//TODO check
|
|
||||||
}
|
@Test(enabled = false, timeOut = 60000, dependsOnMethods = "testRebootSoft")
|
||||||
|
public void testRevertResize() throws Exception {
|
||||||
@Test(enabled = false, timeOut = 60000, dependsOnMethods = "testRebootSoft")
|
Server server = getDefaultServerImmediately();
|
||||||
public void testRevertResize() throws Exception {
|
int serverId = server.getId();
|
||||||
Server server = getDefaultServerImmediately();
|
client.resizeServer(serverId, 2);
|
||||||
int serverId = server.getId();
|
blockUntilServerVerifyResize(serverId);
|
||||||
client.resizeServer(serverId, 2);
|
client.revertResizeServer(serverId);
|
||||||
blockUntilServerVerifyResize(serverId);
|
blockUntilServerActive(serverId);
|
||||||
client.revertResizeServer(serverId);
|
assertEquals(1, client.getServer(serverId).getFlavorRef());
|
||||||
blockUntilServerActive(serverId);
|
}
|
||||||
assertEquals(1, client.getServer(serverId).getFlavorRef());
|
|
||||||
}
|
@Test(enabled = false, timeOut = 10 * 60 * 1000)
|
||||||
|
public void testConfirmResize() throws Exception {
|
||||||
@Test(enabled = false, timeOut = 10 * 60 * 1000)
|
Server server = getDefaultServerImmediately();
|
||||||
public void testConfirmResize() throws Exception {
|
int serverId = server.getId();
|
||||||
Server server = getDefaultServerImmediately();
|
client.resizeServer(serverId, 2);
|
||||||
int serverId = server.getId();
|
blockUntilServerVerifyResize(serverId);
|
||||||
client.resizeServer(serverId, 2);
|
client.confirmResizeServer(serverId);
|
||||||
blockUntilServerVerifyResize(serverId);
|
blockUntilServerActive(serverId);
|
||||||
client.confirmResizeServer(serverId);
|
assertEquals(2, client.getServer(serverId).getFlavorRef());
|
||||||
blockUntilServerActive(serverId);
|
}
|
||||||
assertEquals(2, client.getServer(serverId).getFlavorRef());
|
|
||||||
}
|
@Test(enabled = true, timeOut = 60000)
|
||||||
|
void deleteServer2() throws Exception {
|
||||||
@Test(enabled = true, timeOut = 60000)
|
Server server = getDefaultServerImmediately();
|
||||||
void deleteServer2() throws Exception {
|
int serverId = server.getId();
|
||||||
Server server = getDefaultServerImmediately();
|
client.deleteServer(serverId);
|
||||||
int serverId = server.getId();
|
waitServerDeleted(serverId);
|
||||||
client.deleteServer(serverId);
|
}
|
||||||
waitServerDeleted(serverId);
|
|
||||||
}
|
@Test(enabled = true, timeOut = 60000)
|
||||||
|
void testDeleteImage() throws Exception {
|
||||||
@Test(enabled = true, timeOut = 60000)
|
Image image = getDefaultImageImmediately(getDefaultServerImmediately());
|
||||||
void testDeleteImage() throws Exception {
|
client.deleteImage(image.getId());
|
||||||
Image image = getDefaultImageImmediately(getDefaultServerImmediately());
|
assert client.getImage(image.getId()) == null;
|
||||||
client.deleteImage(image.getId());
|
}
|
||||||
assert client.getImage(image.getId()) == null;
|
|
||||||
}
|
@Test(enabled = true, timeOut = 60000)
|
||||||
|
void deleteServer1() throws Exception {
|
||||||
@Test(enabled = true, timeOut = 60000)
|
Server server = getDefaultServerImmediately();
|
||||||
void deleteServer1() throws Exception {
|
int serverId = server.getId();
|
||||||
Server server = getDefaultServerImmediately();
|
client.deleteServer(serverId);
|
||||||
int serverId = server.getId();
|
waitServerDeleted(serverId);
|
||||||
client.deleteServer(serverId);
|
}
|
||||||
waitServerDeleted(serverId);
|
|
||||||
}
|
@Test
|
||||||
|
public void testDeleteAllCreatedServers() {
|
||||||
@Test
|
for (Server server : client.listServers()) {
|
||||||
public void testDeleteAllCreatedServers() {
|
if (server.getName().startsWith(serverPrefix)) {
|
||||||
for (Server server : client.listServers()) {
|
client.deleteServer(server.getId());
|
||||||
if (server.getName().startsWith(serverPrefix)) {
|
System.out.println("Deleted server: " + server);
|
||||||
client.deleteServer(server.getId());
|
}
|
||||||
System.out.println("Deleted server: " + server);
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
@AfterTest
|
||||||
|
void deleteServersOnEnd() {
|
||||||
@AfterTest
|
testDeleteAllCreatedServers();
|
||||||
void deleteServersOnEnd() {
|
}
|
||||||
testDeleteAllCreatedServers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue