nacx requested changes on this pull request.
I've debugged the failure and it turns to be a test concurrency issue with the
two tests that verify the behavior of the SG cache. If you apply this patch to
make sure both tests don't use the same security group, tests should pass:
```diff
diff --git
a/compute/src/test/java/org/jclouds/compute/extensions/internal/BaseSecurityGroupExtensionLiveTest.java
b/compute/src/test/java/org/jclouds/compute/extensions/internal/BaseSecurityGroupExtensionLiveTest.java
index 2aa7e66c87..5c39bcb783 100644
---
a/compute/src/test/java/org/jclouds/compute/extensions/internal/BaseSecurityGroupExtensionLiveTest.java
+++
b/compute/src/test/java/org/jclouds/compute/extensions/internal/BaseSecurityGroupExtensionLiveTest.java
@@ -406,17 +406,18 @@ public abstract class BaseSecurityGroupExtensionLiveTest
extends BaseComputeServ
@Test(groups = {"integration", "live"}, singleThreaded = true)
public void testSecurityGroupCacheInvalidatedWhenDeletedExternally() throws
Exception {
+ String testSecurityGroupName = secGroupNameToDelete + "-externally";
ComputeService computeService = view.getComputeService();
Optional<SecurityGroupExtension> securityGroupExtension =
computeService.getSecurityGroupExtension();
assertTrue(securityGroupExtension.isPresent(), "security extension was
not present");
final SecurityGroupExtension security = securityGroupExtension.get();
- final SecurityGroup seedGroup =
security.createSecurityGroup(secGroupNameToDelete,
getNodeTemplate().getLocation());
+ final SecurityGroup seedGroup =
security.createSecurityGroup(testSecurityGroupName,
getNodeTemplate().getLocation());
deleteSecurityGroupFromAnotherView(seedGroup);
boolean deleted = security.removeSecurityGroup(seedGroup.getId());
assertFalse(deleted, "SG deleted externally so should've failed
deletion");
- final SecurityGroup recreatedGroup =
security.createSecurityGroup(secGroupNameToDelete,
getNodeTemplate().getLocation());
+ final SecurityGroup recreatedGroup =
security.createSecurityGroup(testSecurityGroupName,
getNodeTemplate().getLocation());
// Makes sure the security group exists and is re-created and is not
just returned from cache
security.addIpPermission(IpPermission.builder()
```
> + return ImmutableSet.of();
+ }
+ return
getSecurityGroupApi(region).listSecurityGroups().concat().transform(neutronSecurityGroupToSecurityGroup.create(location)).toSet();
+ }
+
+ @Override
+ public Set<SecurityGroup> listSecurityGroupsForNode(String id) {
+ RegionAndId regionAndId = RegionAndId.fromSlashEncoded(checkNotNull(id,
"id"));
+ String region = regionAndId.getRegion();
+
+ SecurityGroupApi securityGroupApi = getSecurityGroupApi(region);
+
+ final
FluentIterable<org.jclouds.openstack.neutron.v2.domain.SecurityGroup> allGroups
= securityGroupApi.listSecurityGroups().concat();
+ Location location = locationIndex.get().get(region);
+ return ImmutableSet.copyOf(transform(filter(allGroups, notNull()),
neutronSecurityGroupToSecurityGroup.create(location)));
+ }
This implementation is still wrong. You have to filter ONLY the security groups
associated with the given node. You're returning all existing ones.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/1175#pullrequestreview-92833226