You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Stuart Hendren <no...@github.com> on 2014/08/11 22:48:46 UTC

[jclouds] Adding test for single port firewall rule (#477)

see issue https://issues.apache.org/jira/browse/JCLOUDS-661
You can merge this Pull Request by running:

  git pull https://github.com/stuarthendren/jclouds dev

Or you can view, comment on it, or merge it online at:

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

-- Commit Summary --

  * Adding test for single port firewall rule

-- File Changes --

    M compute/src/test/java/org/jclouds/compute/extensions/internal/BaseSecurityGroupExtensionLiveTest.java (31)

-- Patch Links --

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

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-6-pull-requests #10](https://jclouds.ci.cloudbees.com/job/jclouds-java-6-pull-requests/10/) FAILURE
Looks like there's a problem with this pull request

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1084](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1084/) SUCCESS
This pull request looks good

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Stuart Hendren <no...@github.com>.
I have (now) run the live tests and fixed the test, I didn't realize there was a dependency between the test methods. 

However, I do get a problem with the tests - org.jclouds.googlecomputeengine.compute.GoogleComputeEngineServiceLiveTest
It seems to require the file path of the .pem as the credential and the others the RSA  text, but maybe I'm doing something wrong? 

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1089](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1089/) SUCCESS
This pull request looks good

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Andrew Phillips <no...@github.com>.
Committed to [master](https://git-wip-us.apache.org/repos/asf?p=jclouds.git;a=commit;h=f3778b6cbded6c01acfe7a4fa1379afcede3f524). Thanks, all! Now to get the actual code in ;-)

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1501](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1501/) ABORTED

[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Andrew Phillips <no...@github.com>.
> jclouds-java-6-pull-requests #10 FAILURE

Expected

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-6-pull-requests #18](https://jclouds.ci.cloudbees.com/job/jclouds-java-6-pull-requests/18/) FAILURE
Looks like there's a problem with this pull request

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #1081](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/1081/) UNSTABLE
Looks like there's a problem with this pull request

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Andrew Phillips <no...@github.com>.
>  
> -      assertEquals(Iterables.getOnlyElement(newGroup.getIpPermissions()), perm,
> -              "Expecting IpPermission " + perm + " but group was " + newGroup);
> +      singlePortBuilder.ipProtocol(IpProtocol.UDP);
> +      singlePortBuilder.fromPort(41);
> +      singlePortBuilder.toPort(41);
> +      singlePortBuilder.cidrBlock("1.1.1.1");
> +
> +      IpPermission singlePortIpPermission = singlePortBuilder.build();
> +
> +      Set<IpPermission> expectedPermissions = ImmutableSet.of(portRangeIpPermission, singlePortIpPermission);
> +
> +      SecurityGroup newGroup = securityGroupExtension.get().addIpPermission(singlePortIpPermission, group);
> +
> +      assertTrue(difference(expectedPermissions, newGroup.getIpPermissions()).isEmpty(), "Expecting IpPermissions "

Almost trivial comment, but do we need `difference` here? Does [`assertEquals`](http://testng.org/javadoc/org/testng/Assert.html#assertEquals(java.util.Set, java.util.Set)) not work? E.g.
```
assertEquals(expectedPermissions, newGroup.getIpPermissions());
```
? That should also create the appropriate failure message automatically.

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Andrew Phillips <no...@github.com>.
> So I have run the live tests in google-compute-engine and the test I changed 
> (BaseSecurityGroupExtensionLiveTest) passes.

That's all I was after - sorry, I wasn't clear. I assume it passes _after_ you've applied your fix to actually support single-port ranges...

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-6-pull-requests #13](https://jclouds.ci.cloudbees.com/job/jclouds-java-6-pull-requests/13/) FAILURE
Looks like there's a problem with this pull request

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Chris Custine <no...@github.com>.
Backported to [Apache 1.8.x](https://git-wip-us.apache.org/repos/asf?p=jclouds.git;h=6fa3651)

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Chris Custine <no...@github.com>.
+1 
I merged jclouds/jclouds-labs-google#37 and tested this PR along with jclouds/jclouds-labs-google#39 and all tests pass now so everything looks good to me at this point. I'll let @demobox have final say on this one.

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Chris Custine <no...@github.com>.
Yeah this PR will allow all variations of live tests to run: https://github.com/jclouds/jclouds-labs-google/pull/37 as well as several other issues you will get later when running live tests.

I am going merge that one to test my Apache commit workflow here shortly, and I will also check with this PR and update here later.

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Andrew Phillips <no...@github.com>.
> jclouds-pull-requests #1081 UNSTABLE

Spurious [test failure](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/org.apache.jclouds$jclouds-compute/1081/testReport/junit/org.jclouds.compute.util/ConcurrentOpenSocketFinderTest/testChecksSocketsConcurrently/)

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Stuart Hendren <no...@github.com>.
> Ah, interesting! Wasn't aware of that either - sorry to induce that coupling. If you prefer, we can also 
> split it out into a separate test again, but it seems OK as it is currently? What do you prefer?

Yeah I think the test is fine as it is. It covers the single port case and it adds some variation in the other parameters too.

> I should ask: are the tests passing (with your patch to support single port ranges applied) at the 
> moment, or still failing?

So I have run the live tests in google-compute-engine and the test I changed (BaseSecurityGroupExtensionLiveTest) passes. However, as explained above another test (GoogleComputeEngineServiceLiveTest) fails due to the key being text and not a file path. Which I assume was the case already.

However, I haven't run the live tests for all the other providers - I don't have accounts with most of those. I'm not sure what your set up for that is? Does the CloudBees run live over all the providers or does it just run the unit tests?

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Andrew Phillips <no...@github.com>.
> @@ -149,6 +149,37 @@ public void testAddIpPermission() {
>        assertEquals(Iterables.getOnlyElement(newGroup.getIpPermissions()), perm,
>                "Expecting IpPermission " + perm + " but group was " + newGroup);
>     }
> +
> +   @Test(groups = { "integration", "live" }, singleThreaded = true, dependsOnMethods = "testGetSecurityGroupById")

Fine with having this as a separate method, but I think we could also fold this in as a second "create/check" in `testAddIpPermission`, which would avoid a lot of the boilerplate.

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Andrew Phillips <no...@github.com>.
> I didn't realize there was a dependency between the test methods.

Ah, interesting! Wasn't aware of that either, sorry.

> It seems to require the file path of the .pem as the credential and the others the RSA text

I seem to recall a recent change that allowed both. @ccustine I think it was one of yours..?

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Andrew Phillips <no...@github.com>.
> I am going merge that one to test my Apache commit workflow here shortly, and I will also check with 
> this PR and update here later.

Thanks, @ccustine!

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Andrew Phillips <no...@github.com>.
Thanks for the changes, @stuarthendren! Just one trivial comment that we can also happily ignore. I just wanted to verify that you've run the live test and it passes with your changes to support one-port ranges?

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1507](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1507/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Stuart Hendren <no...@github.com>.
Yes, it fails with the test change and without my code change.
It passes with the test change and my code change. TDD

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

Re: [jclouds] Adding test for single port firewall rule (#477)

Posted by Andrew Phillips <no...@github.com>.
> +      assertTrue(optGroup.isPresent());
> +
> +      SecurityGroup group = optGroup.get();
> +
> +      IpPermission.Builder builder = IpPermission.builder();
> +
> +      builder.ipProtocol(IpProtocol.TCP);
> +      builder.fromPort(22);
> +      builder.toPort(22);
> +      builder.cidrBlock("0.0.0.0/0");
> +
> +      IpPermission perm = builder.build();
> +
> +      SecurityGroup newGroup = securityGroupExtension.get().addIpPermission(perm, group);
> +
> +      assertEquals(Iterables.getOnlyElement(newGroup.getIpPermissions()), perm, "Expecting IpPermission " + perm

I know this is copied from the previous test, but should this not rather be `"...but perms were " + newGroup.getIpPermissions()`?

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