From c64470e0b17d6a61b93523bedda2df959ffbcc6e Mon Sep 17 00:00:00 2001 From: Zack Shoylev Date: Fri, 30 Jan 2015 14:36:10 -0600 Subject: [PATCH] Fixes flavor and template tests to be more robust. --- .../nova/v2_0/features/FlavorApiLiveTest.java | 13 +++++++------ .../internal/BaseTemplateBuilderLiveTest.java | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java index a76fd800fd..70c32b1f1e 100644 --- a/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java +++ b/apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/FlavorApiLiveTest.java @@ -67,12 +67,13 @@ public class FlavorApiLiveTest extends BaseNovaApiLiveTest { assertNotNull(response); assertFalse(response.isEmpty()); for (Flavor flavor : response) { - assertNotNull(flavor.getId()); - assertNotNull(flavor.getName()); - assertNotNull(flavor.getLinks()); - assertTrue(flavor.getRam() > 0); - assertTrue(flavor.getDisk() > 0); - assertTrue(flavor.getVcpus() > 0); + assertNotNull(flavor.getId()); + assertNotNull(flavor.getName()); + assertNotNull(flavor.getLinks()); + assertTrue(flavor.getRam() > 0); + // Some flavors can potentially have 0 system disk sizes. + assertTrue(flavor.getDisk() >= 0); + assertTrue(flavor.getVcpus() > 0); } } } diff --git a/compute/src/test/java/org/jclouds/compute/internal/BaseTemplateBuilderLiveTest.java b/compute/src/test/java/org/jclouds/compute/internal/BaseTemplateBuilderLiveTest.java index 15ad5a42c8..356568c31e 100644 --- a/compute/src/test/java/org/jclouds/compute/internal/BaseTemplateBuilderLiveTest.java +++ b/compute/src/test/java/org/jclouds/compute/internal/BaseTemplateBuilderLiveTest.java @@ -82,7 +82,7 @@ public abstract class BaseTemplateBuilderLiveTest extends BaseComputeServiceCont @Test public void testDefaultTemplateBuilder() throws IOException { Template defaultTemplate = view.getComputeService().templateBuilder().build(); - assert defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[012].[10][04]") : defaultTemplate + assert defaultTemplate.getImage().getOperatingSystem().getVersion().matches("\\d\\d\\.\\d\\d") : defaultTemplate .getImage().getOperatingSystem().getVersion(); assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true); assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);