jclouds-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zack Shoylev <notificati...@github.com>
Subject Re: [jclouds] add os-hypervisors extension (#819)
Date Fri, 24 Jul 2015 21:39:09 GMT
> +import org.jclouds.http.HttpRequest;
> +import org.jclouds.http.HttpResponse;
> +import org.jclouds.openstack.nova.v2_0.NovaApi;
> +import org.jclouds.openstack.nova.v2_0.domain.regionscoped.Hypervisor;
> +import org.jclouds.openstack.nova.v2_0.domain.regionscoped.HypervisorDetails;
> +import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
> +import org.testng.annotations.Test;
> +
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertFalse;
> +import static org.testng.Assert.assertTrue;
> +
> +@Test(groups = "unit", testName = "HypervisorApiExpectTest")
> +public class HypervisorApiExpectTest extends BaseNovaApiExpectTest {
> +
> +   public void testWhenNamespaceInExtensionsListHypervisorPresent() throws Exception
{

?Hmm yes, I like the pattern actually. I want to run it through some tests, but looks good.
If it works ok, we might have to refactor some other mock tests to use it as well.

________________________________
From: arvindn05 <notifications@github.com>
Sent: Thursday, July 23, 2015 3:51 AM
To: jclouds/jclouds
Cc: Zack Shoylev
Subject: Re: [jclouds] add os-hypervisors extension (#819)


In apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/HypervisorApiExpectTest.java<https://github.com/jclouds/jclouds/pull/819#discussion_r35301354>:

> +import org.jclouds.http.HttpRequest;
> +import org.jclouds.http.HttpResponse;
> +import org.jclouds.openstack.nova.v2_0.NovaApi;
> +import org.jclouds.openstack.nova.v2_0.domain.regionscoped.Hypervisor;
> +import org.jclouds.openstack.nova.v2_0.domain.regionscoped.HypervisorDetails;
> +import org.jclouds.openstack.nova.v2_0.internal.BaseNovaApiExpectTest;
> +import org.testng.annotations.Test;
> +
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertFalse;
> +import static org.testng.Assert.assertTrue;
> +
> +@Test(groups = "unit", testName = "HypervisorApiExpectTest")
> +public class HypervisorApiExpectTest extends BaseNovaApiExpectTest {
> +
> +   public void testWhenNamespaceInExtensionsListHypervisorPresent() throws Exception
{


figured out the issue. It was because of me using keystoneAuthResponse.json. Somehow the mock
tests only work with access.json

Also tried to make use of beforemethod and aftermethod annotations to do some of the setup.
since the tests run in parallel, i could not use them directly. so had to get creative to
reduce code duplication.
if you like this pattern maybe future tests can use it...

-
Reply to this email directly or view it on GitHub<https://github.com/jclouds/jclouds/pull/819/files#r35301354>.


---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/819/files#r35468469
Mime
View raw message