You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Andrea Turli <no...@github.com> on 2015/08/04 13:11:12 UTC

[jclouds] [SoftLayer] fix some failing LiveTests (#838)

- fix VirtualGuestBlockDeviceTemplateGroupApiLiveTest
- fix SoftLayerComputeServiceLiveTest
You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds/pull/838

-- Commit Summary --

  * [SoftLayer] fix some failing LiveTests

-- File Changes --

    M providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/DatacenterToLocation.java (4)
    M providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/OperatingSystemToImage.java (2)
    M providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToHardware.java (16)
    M providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToImage.java (25)
    M providers/softlayer/src/main/java/org/jclouds/softlayer/compute/functions/VirtualGuestToNodeMetadata.java (11)
    M providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerComputeServiceContextLiveTest.java (3)
    M providers/softlayer/src/test/java/org/jclouds/softlayer/compute/SoftLayerComputeServiceLiveTest.java (4)
    M providers/softlayer/src/test/java/org/jclouds/softlayer/compute/functions/OperatingSystemToImageTest.java (2)
    M providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestApiLiveTest.java (8)
    M providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestBlockDeviceTemplateGroupApiLiveTest.java (1)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/838.patch
https://github.com/jclouds/jclouds/pull/838.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/838

Re: [jclouds] [SoftLayer] fix some failing LiveTests (#838)

Posted by Andrea Turli <no...@github.com>.
thanks @nacx, comments addressed

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/838#issuecomment-129854249

Re: [jclouds] [SoftLayer] fix some failing LiveTests (#838)

Posted by Ignasi Barrera <no...@github.com>.
>  
>     @BeforeClass(groups = {"integration", "live"})
>     @Override
>     public void setup() {
>        super.setup();
>        virtualGuestApi = api.getVirtualGuestApi();
> +      datacenter = Iterables.get(api.getDatacenterApi().listDatacenters(), 0);
> +      if (datacenter == null) Assert.fail();

Use `assertNotNull` with a meaningful message.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/838/files#r36682363

Re: [jclouds] [SoftLayer] fix some failing LiveTests (#838)

Posted by Ignasi Barrera <no...@github.com>.
> @@ -61,13 +62,15 @@ public void testLaunchClusterWithMinDisk() throws RunNodesException {
>                        new SshjSshClientModule()))
>                .build(ComputeServiceContext.class);
>  
> +      for (ComputeMetadata computeMetadata : context.getComputeService().listNodes()) {
> +         System.out.println(computeMetadata);

Use `getAnonymousLogger()` instead if you want to print feedback when running tests.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/838/files#r36745898

Re: [jclouds] [SoftLayer] fix some failing LiveTests (#838)

Posted by Andrea Turli <no...@github.com>.
Merged at [master](http://git-wip-us.apache.org/repos/asf/jclouds/commit/1163b94c)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/838#issuecomment-129953297

Re: [jclouds] [SoftLayer] fix some failing LiveTests (#838)

Posted by Ignasi Barrera <no...@github.com>.
>  
>     @BeforeClass(groups = {"integration", "live"})
>     @Override
>     public void setup() {
>        super.setup();
>        virtualGuestApi = api.getVirtualGuestApi();
> +      datacenter = Iterables.get(api.getDatacenterApi().listDatacenters(), 0);
> +      assertNull(datacenter, "Datacenter must not be null");

Wrong assertion? :see_no_evil: 

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/838/files#r36746085

Re: [jclouds] [SoftLayer] fix some failing LiveTests (#838)

Posted by Ignasi Barrera <no...@github.com>.
> @@ -52,7 +53,10 @@ public boolean apply(VirtualGuestBlockDevice input) {
>                           .transform(new Function<VirtualGuestBlockDevice, Volume>() {
>                              @Override
>                              public Volume apply(VirtualGuestBlockDevice item) {
> -                               float volumeSize = item.getVirtualDiskImage().getCapacity();
> +                               float volumeSize = -1;
> +                               if (item.getVirtualDiskImage() != null) {
> +                                  volumeSize = item.getVirtualDiskImage().getCapacity();
> +                               }

Would it make sense to return volumes with size -1?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/838/files#r36682081

Re: [jclouds] [SoftLayer] fix some failing LiveTests (#838)

Posted by Andrea Turli <no...@github.com>.
Closed #838.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/838#event-379347047

Re: [jclouds] [SoftLayer] fix some failing LiveTests (#838)

Posted by Ignasi Barrera <no...@github.com>.
> @@ -89,6 +93,13 @@ public NodeMetadata apply(VirtualGuest from) {
>           builder.publicAddresses(ImmutableSet.of(from.getPrimaryIpAddress()));
>        if (from.getPrimaryBackendIpAddress() != null)
>           builder.privateAddresses(ImmutableSet.of(from.getPrimaryBackendIpAddress()));
> +      // TODO simplify once we move domain classes to AutoValue
> +      if (from.getOperatingSystem() != null && from.getOperatingSystem().getPasswords() != null && !from.getOperatingSystem().getPasswords().isEmpty()) {
> +         Password password = Iterables.getOnlyElement(from.getOperatingSystem().getPasswords());
> +         if (password != null) {

This will never be null, as the `getOnlyElement` will fail if it is empty or has more than one element.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/838/files#r36682282

Re: [jclouds] [SoftLayer] fix some failing LiveTests (#838)

Posted by Andrea Turli <no...@github.com>.
backport to [1.9.x](http://git-wip-us.apache.org/repos/asf/jclouds/commit/cc1217b5)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/838#issuecomment-129956125

Re: [jclouds] [SoftLayer] fix some failing LiveTests (#838)

Posted by Ignasi Barrera <no...@github.com>.
Just a couple minors. Apart from that lgtm! Thanks @andreaturli!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/838#issuecomment-129879552