From a2bdfdb706ca85f040418ebf741dbab3723c11b5 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 25 Jul 2011 10:47:35 -0700 Subject: [PATCH 1/3] better error on gogrid test --- .../jclouds/gogrid/compute/GoGridComputeServiceLiveTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/providers/gogrid/src/test/java/org/jclouds/gogrid/compute/GoGridComputeServiceLiveTest.java b/providers/gogrid/src/test/java/org/jclouds/gogrid/compute/GoGridComputeServiceLiveTest.java index fca45c3830..5b648d666d 100644 --- a/providers/gogrid/src/test/java/org/jclouds/gogrid/compute/GoGridComputeServiceLiveTest.java +++ b/providers/gogrid/src/test/java/org/jclouds/gogrid/compute/GoGridComputeServiceLiveTest.java @@ -43,6 +43,6 @@ public class GoGridComputeServiceLiveTest extends BaseComputeServiceLiveTest { protected void checkResponseEqualsHostname(ExecResponse execResponse, NodeMetadata node1) { // hostname is not completely predictable based on node metadata - assert execResponse.getOutput().trim().startsWith(node1.getName()); + assert execResponse.getOutput().trim().startsWith(node1.getName()) : execResponse + ": " + node1; } } From d75589ecc505c278ba3bfaed8aed01dc61d6665b Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 25 Jul 2011 13:47:11 -0700 Subject: [PATCH 2/3] toned down logging and corrected logback version --- apis/nova/pom.xml | 2 +- .../callables/RunScriptOnNodeAsInitScriptUsingSsh.java | 9 ++++++--- .../compute/domain/internal/TemplateBuilderImpl.java | 4 ++-- .../compute/domain/internal/TemplateBuilderImplTest.java | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apis/nova/pom.xml b/apis/nova/pom.xml index dea1e7b827..09889d464d 100644 --- a/apis/nova/pom.xml +++ b/apis/nova/pom.xml @@ -91,7 +91,7 @@ ch.qos.logback logback-classic - 0.9.28 + 0.9.29 test diff --git a/compute/src/main/java/org/jclouds/compute/callables/RunScriptOnNodeAsInitScriptUsingSsh.java b/compute/src/main/java/org/jclouds/compute/callables/RunScriptOnNodeAsInitScriptUsingSsh.java index 729b1e8db2..a079411d49 100644 --- a/compute/src/main/java/org/jclouds/compute/callables/RunScriptOnNodeAsInitScriptUsingSsh.java +++ b/compute/src/main/java/org/jclouds/compute/callables/RunScriptOnNodeAsInitScriptUsingSsh.java @@ -137,7 +137,10 @@ public class RunScriptOnNodeAsInitScriptUsingSsh implements RunScriptOnNode { ssh.put(initFile, init.render(OsFamily.UNIX)); } catch (SshException e) { // If there's a problem with the sftp configuration, we can try via ssh exec - logger.warn(e, "<< (%s) problem using sftp [%s], attempting via sshexec", ssh.toString(), e.getMessage()); + if (logger.isTraceEnabled()) + logger.warn(e, "<< (%s) problem using sftp [%s], attempting via sshexec", ssh.toString(), e.getMessage()); + else + logger.warn("<< (%s) problem using sftp [%s], attempting via sshexec", ssh.toString(), e.getMessage()); ssh.disconnect(); ssh.connect(); ssh.exec("rm " + initFile); @@ -206,8 +209,8 @@ public class RunScriptOnNodeAsInitScriptUsingSsh implements RunScriptOnNode { @Override public String toString() { - return Objects.toStringHelper(this).add("node", node).add("name", init.getInstanceName()).add("runAsRoot", - runAsRoot).toString(); + return Objects.toStringHelper(this).add("node", node).add("name", init.getInstanceName()) + .add("runAsRoot", runAsRoot).toString(); } @Override diff --git a/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java b/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java index 40d23b0a51..2e1bf6d689 100644 --- a/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java +++ b/compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java @@ -570,7 +570,7 @@ public class TemplateBuilderImpl implements TemplateBuilder { } Hardware hardware = resolveSize(hardwareSorter(), supportedImages); Image image = resolveImage(hardware, supportedImages); - logger.debug("<< matched image(%s)", image); + logger.debug("<< matched image(%s)", image.getId()); return new TemplateImpl(image, hardware, location, options); } @@ -614,7 +614,7 @@ public class TemplateBuilderImpl implements TemplateBuilder { logger.warn(exception, "hardware profiles %s\nimage ids %s", hardwarel, transform(images, imageToId)); throw exception; } - logger.debug("<< matched hardware(%s)", hardware); + logger.debug("<< matched hardware(%s)", hardware.getId()); return hardware; } diff --git a/compute/src/test/java/org/jclouds/compute/domain/internal/TemplateBuilderImplTest.java b/compute/src/test/java/org/jclouds/compute/domain/internal/TemplateBuilderImplTest.java index 641a0d1c37..7a7eb62366 100644 --- a/compute/src/test/java/org/jclouds/compute/domain/internal/TemplateBuilderImplTest.java +++ b/compute/src/test/java/org/jclouds/compute/domain/internal/TemplateBuilderImplTest.java @@ -139,6 +139,7 @@ public class TemplateBuilderImplTest { expect(image2.getLocation()).andReturn(defaultLocation).atLeastOnce(); expect(image.getOperatingSystem()).andReturn(os).atLeastOnce(); expect(image2.getOperatingSystem()).andReturn(os2).atLeastOnce(); + expect(image.getId()).andReturn("1"); expect(os.getArch()).andReturn("X86_32").atLeastOnce(); expect(os2.getArch()).andReturn("X86_64").atLeastOnce(); From 1a9d17470395ee96918834498e912e7cf6607aee Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Tue, 26 Jul 2011 22:16:32 -0700 Subject: [PATCH 3/3] fixed Bluelock tests --- .../BluelockVCloudDirectorComputeServiceLiveTest.java | 8 +++++++- .../BluelockVCloudEnterpriseComputeServiceLiveTest.java | 8 +++++++- .../BluelockVCloudZone01ComputeServiceLiveTest.java | 7 +++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/providers/bluelock-vcdirector/src/test/java/org/jclouds/vcloud/bluelock/compute/BluelockVCloudDirectorComputeServiceLiveTest.java b/providers/bluelock-vcdirector/src/test/java/org/jclouds/vcloud/bluelock/compute/BluelockVCloudDirectorComputeServiceLiveTest.java index 00dc577a1a..6961bb1b62 100644 --- a/providers/bluelock-vcdirector/src/test/java/org/jclouds/vcloud/bluelock/compute/BluelockVCloudDirectorComputeServiceLiveTest.java +++ b/providers/bluelock-vcdirector/src/test/java/org/jclouds/vcloud/bluelock/compute/BluelockVCloudDirectorComputeServiceLiveTest.java @@ -21,7 +21,9 @@ package org.jclouds.vcloud.bluelock.compute; import static org.jclouds.compute.util.ComputeServiceUtils.getCores; import static org.testng.Assert.assertEquals; +import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.Image; +import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.TemplateBuilder; @@ -66,5 +68,9 @@ public class BluelockVCloudDirectorComputeServiceLiveTest extends VCloudComputeS assert image.getDefaultCredentials().credential != null : image; return template; } - + + protected void checkResponseEqualsHostname(ExecResponse execResponse, NodeMetadata node1) { + // hostname is not completely predictable based on node metadata + assert execResponse.getOutput().trim().equals("Ubuntu1004") : execResponse + ": " + node1; + } } diff --git a/providers/bluelock-vcloud-vcenterprise/src/test/java/org/jclouds/bluelock/vcloud/vcenterprise/compute/BluelockVCloudEnterpriseComputeServiceLiveTest.java b/providers/bluelock-vcloud-vcenterprise/src/test/java/org/jclouds/bluelock/vcloud/vcenterprise/compute/BluelockVCloudEnterpriseComputeServiceLiveTest.java index 4a5bef6593..6fed45edb3 100644 --- a/providers/bluelock-vcloud-vcenterprise/src/test/java/org/jclouds/bluelock/vcloud/vcenterprise/compute/BluelockVCloudEnterpriseComputeServiceLiveTest.java +++ b/providers/bluelock-vcloud-vcenterprise/src/test/java/org/jclouds/bluelock/vcloud/vcenterprise/compute/BluelockVCloudEnterpriseComputeServiceLiveTest.java @@ -21,7 +21,9 @@ package org.jclouds.bluelock.vcloud.vcenterprise.compute; import static org.jclouds.compute.util.ComputeServiceUtils.getCores; import static org.testng.Assert.assertEquals; +import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.Image; +import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.TemplateBuilder; @@ -66,5 +68,9 @@ public class BluelockVCloudEnterpriseComputeServiceLiveTest extends VCloudComput assert image.getDefaultCredentials().credential != null : image; return template; } - + + protected void checkResponseEqualsHostname(ExecResponse execResponse, NodeMetadata node1) { + // hostname is not completely predictable based on node metadata + assert execResponse.getOutput().trim().equals("Ubuntu1004") : execResponse + ": " + node1; + } } diff --git a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/compute/BluelockVCloudZone01ComputeServiceLiveTest.java b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/compute/BluelockVCloudZone01ComputeServiceLiveTest.java index edc603e0dd..26cfbbd81b 100644 --- a/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/compute/BluelockVCloudZone01ComputeServiceLiveTest.java +++ b/providers/bluelock-vcloud-zone01/src/test/java/org/jclouds/bluelock/vcloud/zone01/compute/BluelockVCloudZone01ComputeServiceLiveTest.java @@ -21,7 +21,9 @@ package org.jclouds.bluelock.vcloud.zone01.compute; import static org.jclouds.compute.util.ComputeServiceUtils.getCores; import static org.testng.Assert.assertEquals; +import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.Image; +import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.OsFamily; import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.TemplateBuilder; @@ -66,5 +68,10 @@ public class BluelockVCloudZone01ComputeServiceLiveTest extends VCloudComputeSer assert image.getDefaultCredentials().credential != null : image; return template; } + + protected void checkResponseEqualsHostname(ExecResponse execResponse, NodeMetadata node1) { + // hostname is not completely predictable based on node metadata + assert execResponse.getOutput().trim().equals("Ubuntu1004") : execResponse + ": " + node1; + } }