> + public final void testTagFilteringWorks() {
> + InstanceInZone instanceInZone = new InstanceInZone(instance, "zoneId");
> + NodeMetadata nodeMetadata = groupGroupNodeParser.apply(instanceInZone);
> + assertEquals(nodeMetadata.getId(), "id/test-0");
> + assertEquals(nodeMetadata.getTags(), ImmutableSet.<String>of("aTag"
> + // "Group-port-42" filtered out as a firewall tag.
> + ));
> + }
> +
> + @Test
> + public final void testInstanceWithGroupNull() {
> + InstanceInZone instanceInZone = new InstanceInZone(instance, "zoneId");
> + NodeMetadata nodeMetadata = groupNullNodeParser.apply(instanceInZone);
> + assertEquals(nodeMetadata.getId(), "id/test-0");
> + assertEquals(nodeMetadata.getTags(), ImmutableSet.<String>of("aTag",
> "Group-port-42"));
> + }
This test setup still seems _very_ complicated, but if that's really the
easiest way to test it, then so be it ;-) Just one question: from the code, it
looks like we have three test cases:
1. Group null - no filtering applied
2. Group non-null and `firewallTagNamingConvention.get(group)` _is_ a firewall
tag - needs to be filtered
3. Group non-null and `firewallTagNamingConvention.get(group)` is _not_ a
firewall tag - shoudl not be filtered
I can see that cases 1. and 2. ("Group-port-42" is removed) are covered. Does
"aTag" cover case 3., or are we missing that?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/26/files#r13522461