From c2669da89c79ff62cfb0082b040274494e59170f Mon Sep 17 00:00:00 2001 From: Aled Sage Date: Tue, 4 Oct 2016 16:54:44 +0100 Subject: [PATCH 1/2] Extract AbstractJcloudsStubbedUnitTest Extracted from JcloudsReachableAddressStubbedTest, and makes StubbedComputeServiceRegistry configurable for whether it should delegate at all to the cloud provider (or stub everything). Also updates JcloudsSshMachineLocation, so we only call computeContext().getContext().utils().injector().getInstance(RunScriptOnNode.Factory) if we really need to. This change only affects deprecated code paths. --- .../jclouds/JcloudsSshMachineLocation.java | 27 ++- .../AbstractJcloudsStubbedUnitTest.java | 107 +++++++++ .../StubbedComputeServiceRegistry.java | 60 ++++- .../jclouds/UnsupportedComputeService.java | 222 ++++++++++++++++++ .../JcloudsReachableAddressStubbedTest.java | 131 ++++------- 5 files changed, 444 insertions(+), 103 deletions(-) create mode 100644 locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/AbstractJcloudsStubbedUnitTest.java create mode 100644 locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/UnsupportedComputeService.java diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsSshMachineLocation.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsSshMachineLocation.java index 3ef596a681..0ec99e5236 100644 --- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsSshMachineLocation.java +++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsSshMachineLocation.java @@ -132,8 +132,6 @@ public class JcloudsSshMachineLocation extends SshMachineLocation implements Jcl private transient Optional _image; - private RunScriptOnNode.Factory runScriptFactory; - public JcloudsSshMachineLocation() { } @@ -152,8 +150,6 @@ public JcloudsSshMachineLocation(Map flags, JcloudsLocation jcloudsParent, public void init() { if (jcloudsParent != null) { super.init(); - ComputeServiceContext context = jcloudsParent.getComputeService().getContext(); - runScriptFactory = context.utils().injector().getInstance(RunScriptOnNode.Factory.class); } else { // TODO Need to fix the rebind-detection, and not call init() on rebind. // This will all change when locations become entities. @@ -167,13 +163,10 @@ public void init() { public void rebind() { super.rebind(); - if (jcloudsParent != null) { + if (jcloudsParent == null) { // can be null on rebind, if location has been "orphaned" somehow - ComputeServiceContext context = jcloudsParent.getComputeService().getContext(); - runScriptFactory = context.utils().injector().getInstance(RunScriptOnNode.Factory.class); - } else { - LOG.warn("Location {} does not have parent; cannot retrieve jclouds compute-service or " - + "run-script factory; later operations may fail (continuing)", this); + LOG.warn("Location {} does not have parent; cannot retrieve jclouds compute-service; " + + "later operations may fail (continuing)", this); } clearDeprecatedProperties(); } @@ -443,12 +436,20 @@ public ListenableFuture submitRunScript(Statement script) { */ @Deprecated public ListenableFuture submitRunScript(Statement script, RunScriptOptions options) { + JcloudsLocation jcloudsParent = getParent(); Optional node = getOptionalNode(); - if (node.isPresent()) { - return runScriptFactory.submit(node.get(), script, options); - } else { + + if (!node.isPresent()) { throw new IllegalStateException("Node "+nodeId+" not present in "+getParent()); } + if (jcloudsParent == null) { + throw new IllegalStateException("No jclouds parent location for "+this+"; cannot retrieve jclouds script-runner"); + } + + ComputeServiceContext context = jcloudsParent.getComputeService().getContext(); + RunScriptOnNode.Factory runScriptFactory = context.utils().injector().getInstance(RunScriptOnNode.Factory.class); + + return runScriptFactory.submit(node.get(), script, options); } /** diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/AbstractJcloudsStubbedUnitTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/AbstractJcloudsStubbedUnitTest.java new file mode 100644 index 0000000000..71111d1625 --- /dev/null +++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/AbstractJcloudsStubbedUnitTest.java @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.brooklyn.location.jclouds; + +import java.util.Map; + +import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; +import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; +import org.apache.brooklyn.location.jclouds.StubbedComputeServiceRegistry.NodeCreator; +import org.apache.brooklyn.location.ssh.SshMachineLocation; +import org.apache.brooklyn.location.winrm.WinRmMachineLocation; +import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool; +import org.apache.brooklyn.util.core.internal.winrm.RecordingWinRmTool; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; + +import com.google.common.base.Predicates; +import com.google.common.collect.ImmutableMap; + +/** + * Stubs out all comms with the cloud provider. + * + * Expects sub-classes to call {@link #initNodeCreatorAndJcloudsLocation(NodeCreator, Map)} before + * the test methods are called. + */ +public abstract class AbstractJcloudsStubbedUnitTest extends AbstractJcloudsLiveTest { + + @SuppressWarnings("unused") + private static final Logger LOG = LoggerFactory.getLogger(AbstractJcloudsStubbedUnitTest.class); + + // TODO These values are hard-coded into the JcloudsStubTemplateBuilder, so best not to mess! + public static final String LOCATION_SPEC = "jclouds:aws-ec2:us-east-1"; + + protected NodeCreator nodeCreator; + protected ComputeServiceRegistry computeServiceRegistry; + + @BeforeMethod(alwaysRun=true) + @Override + public void setUp() throws Exception { + super.setUp(); + RecordingSshTool.clear(); + RecordingWinRmTool.clear(); + } + + @AfterMethod(alwaysRun=true) + @Override + public void tearDown() throws Exception { + try { + super.tearDown(); + } finally { + RecordingSshTool.clear(); + RecordingWinRmTool.clear(); + } + } + + @Override + protected LocalManagementContext newManagementContext() { + return LocalManagementContextForTests.builder(true).build(); + } + + /** + * Expect sub-classes to call this - either in their {@link BeforeMethod} or at the very + * start of the test method (to allow custom config per test). + */ + protected void initNodeCreatorAndJcloudsLocation(NodeCreator nodeCreator, Map jcloudsLocationConfig) throws Exception { + this.nodeCreator = nodeCreator; + this.computeServiceRegistry = new StubbedComputeServiceRegistry(nodeCreator, false); + + this.jcloudsLocation = (JcloudsLocation)managementContext.getLocationRegistry().getLocationManaged( + getLocationSpec(), + ImmutableMap.builder() + .put(JcloudsLocationConfig.COMPUTE_SERVICE_REGISTRY, computeServiceRegistry) + .put(JcloudsLocationConfig.TEMPLATE_BUILDER, JcloudsStubTemplateBuilder.create()) + .put(JcloudsLocationConfig.ACCESS_IDENTITY, "stub-identity") + .put(JcloudsLocationConfig.ACCESS_CREDENTIAL, "stub-credential") + .put(SshMachineLocation.SSH_TOOL_CLASS, RecordingSshTool.class.getName()) + .put(WinRmMachineLocation.WINRM_TOOL_CLASS, RecordingWinRmTool.class.getName()) + .put(JcloudsLocation.POLL_FOR_FIRST_REACHABLE_ADDRESS_PREDICATE, Predicates.alwaysTrue()) + .putAll(jcloudsLocationConfig) + .build()); + } + + /** + * For overriding. + */ + protected String getLocationSpec() { + return LOCATION_SPEC; + } +} diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/StubbedComputeServiceRegistry.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/StubbedComputeServiceRegistry.java index 1d18a5f02a..99cd321cfd 100644 --- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/StubbedComputeServiceRegistry.java +++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/StubbedComputeServiceRegistry.java @@ -78,10 +78,10 @@ protected NodeMetadata newNode(String group, Template template) { } } - static class StubbedComputeService extends DelegatingComputeService { + static class MinimalComputeService extends DelegatingComputeService { private final NodeCreator nodeCreator; - public StubbedComputeService(ComputeService delegate, NodeCreator nodeCreator) { + public MinimalComputeService(ComputeService delegate, NodeCreator nodeCreator) { super(delegate); this.nodeCreator = nodeCreator; } @@ -111,19 +111,69 @@ public Set destroyNodesMatching(Predicate } } + static class StubbedComputeService extends UnsupportedComputeService { + private final NodeCreator nodeCreator; + + public StubbedComputeService(NodeCreator nodeCreator) { + this.nodeCreator = nodeCreator; + } + @Override + public Set createNodesInGroup(String group, int count, Template template) throws RunNodesException { + return nodeCreator.createNodesInGroup(group, count, template); + } + @Override + public void destroyNode(String id) { + nodeCreator.destroyNode(id); + } + @Override + public Set listNodesDetailsMatching(Predicate filter) { + return nodeCreator.listNodesDetailsMatching(filter); + } + @Override + public Set createNodesInGroup(String group, int count) { + throw new UnsupportedOperationException(); + } + @Override + public Set createNodesInGroup(String group, int count, TemplateOptions templateOptions) { + throw new UnsupportedOperationException(); + } + @Override + public Set destroyNodesMatching(Predicate filter) { + throw new UnsupportedOperationException(); + } + } + private final NodeCreator nodeCreator; - + private final boolean allowCloudQueries; + public StubbedComputeServiceRegistry(NodeMetadata node) throws Exception { this(new SingleNodeCreator(node)); } public StubbedComputeServiceRegistry(NodeCreator nodeCreator) throws Exception { + this(nodeCreator, true); + } + + public StubbedComputeServiceRegistry(NodeCreator nodeCreator, boolean allowCloudQueries) throws Exception { this.nodeCreator = nodeCreator; + this.allowCloudQueries = allowCloudQueries; } + /** + * If using {@link #allowCloudQueries}, then we'll go through the jclouds code to instantiate + * a delegate {@link ComputeService}. That takes about a second (because of everything guice + * does), so is unpleasant to do in unit tests. + * + * Better is to create the {@link StubbedComputeServiceRegistry} with that disabled, which will + * throw an exception if any unexpected method is called on {@link ComputeService}. + */ @Override public ComputeService findComputeService(ConfigBag conf, boolean allowReuse) { - ComputeService delegate = ComputeServiceRegistryImpl.INSTANCE.findComputeService(conf, allowReuse); - return new StubbedComputeService(delegate, nodeCreator); + if (allowCloudQueries) { + ComputeService delegate = ComputeServiceRegistryImpl.INSTANCE.findComputeService(conf, allowReuse); + return new MinimalComputeService(delegate, nodeCreator); + } else { + return new StubbedComputeService(nodeCreator); + } } } diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/UnsupportedComputeService.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/UnsupportedComputeService.java new file mode 100644 index 0000000000..6bd89a689b --- /dev/null +++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/UnsupportedComputeService.java @@ -0,0 +1,222 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.brooklyn.location.jclouds; + +import java.util.Map; +import java.util.Set; + +import org.jclouds.compute.ComputeService; +import org.jclouds.compute.ComputeServiceContext; +import org.jclouds.compute.RunNodesException; +import org.jclouds.compute.RunScriptOnNodesException; +import org.jclouds.compute.domain.ComputeMetadata; +import org.jclouds.compute.domain.ExecResponse; +import org.jclouds.compute.domain.Hardware; +import org.jclouds.compute.domain.Image; +import org.jclouds.compute.domain.NodeMetadata; +import org.jclouds.compute.domain.Template; +import org.jclouds.compute.domain.TemplateBuilder; +import org.jclouds.compute.extensions.ImageExtension; +import org.jclouds.compute.extensions.SecurityGroupExtension; +import org.jclouds.compute.options.RunScriptOptions; +import org.jclouds.compute.options.TemplateOptions; +import org.jclouds.domain.Location; +import org.jclouds.scriptbuilder.domain.Statement; + +import com.google.common.base.Optional; +import com.google.common.base.Predicate; +import com.google.common.util.concurrent.ListenableFuture; + +public class UnsupportedComputeService implements ComputeService { + + @Override + public ComputeServiceContext getContext() { + throw new UnsupportedOperationException(); + } + + @Override + public TemplateBuilder templateBuilder() { + throw new UnsupportedOperationException(); + } + + @Override + public TemplateOptions templateOptions() { + throw new UnsupportedOperationException(); + } + + @Override + public Set listHardwareProfiles() { + throw new UnsupportedOperationException(); + } + + @Override + public Set listImages() { + throw new UnsupportedOperationException(); + } + + @Override + public Image getImage(String id) { + throw new UnsupportedOperationException(); + } + + @Override + public Set listNodes() { + throw new UnsupportedOperationException(); + } + + @Override + public Set listNodesByIds(Iterable ids) { + throw new UnsupportedOperationException(); + } + + @Override + public Set listAssignableLocations() { + throw new UnsupportedOperationException(); + } + + @Override + public Set createNodesInGroup(String group, int count, Template template) throws RunNodesException { + throw new UnsupportedOperationException(); + } + + @Override + public Set createNodesInGroup(String group, int count, TemplateOptions templateOptions) + throws RunNodesException { + throw new UnsupportedOperationException(); + } + + @Override + public Set createNodesInGroup(String group, int count) throws RunNodesException { + throw new UnsupportedOperationException(); + } + + @Override + public void resumeNode(String id) { + throw new UnsupportedOperationException(); + } + + @Override + public Set resumeNodesMatching(Predicate filter) { + throw new UnsupportedOperationException(); + } + + @Override + public void suspendNode(String id) { + throw new UnsupportedOperationException(); + } + + @Override + public Set suspendNodesMatching(Predicate filter) { + throw new UnsupportedOperationException(); + } + + @Override + public void destroyNode(String id) { + throw new UnsupportedOperationException(); + } + + @Override + public Set destroyNodesMatching(Predicate filter) { + throw new UnsupportedOperationException(); + } + + @Override + public void rebootNode(String id) { + throw new UnsupportedOperationException(); + } + + @Override + public Set rebootNodesMatching(Predicate filter) { + throw new UnsupportedOperationException(); + } + + @Override + public NodeMetadata getNodeMetadata(String id) { + throw new UnsupportedOperationException(); + } + + @Override + public Set listNodesDetailsMatching(Predicate filter) { + throw new UnsupportedOperationException(); + } + + @Override + public Map runScriptOnNodesMatching(Predicate filter, String runScript) + throws RunScriptOnNodesException { + throw new UnsupportedOperationException(); + } + + @Override + public Map runScriptOnNodesMatching(Predicate filter, Statement runScript) + throws RunScriptOnNodesException { + throw new UnsupportedOperationException(); + } + + @Override + public Map runScriptOnNodesMatching(Predicate filter, + String runScript, RunScriptOptions options) throws RunScriptOnNodesException { + throw new UnsupportedOperationException(); + } + + @Override + public Map runScriptOnNodesMatching(Predicate filter, + Statement runScript, RunScriptOptions options) throws RunScriptOnNodesException { + throw new UnsupportedOperationException(); + } + + @Override + public ExecResponse runScriptOnNode(String id, Statement runScript, RunScriptOptions options) { + throw new UnsupportedOperationException(); + } + + @Override + public ListenableFuture submitScriptOnNode(String id, String runScript, RunScriptOptions options) { + throw new UnsupportedOperationException(); + } + + @Override + public ListenableFuture submitScriptOnNode(String id, Statement runScript, RunScriptOptions options) { + throw new UnsupportedOperationException(); + } + + @Override + public ExecResponse runScriptOnNode(String id, Statement runScript) { + throw new UnsupportedOperationException(); + } + + @Override + public ExecResponse runScriptOnNode(String id, String runScript, RunScriptOptions options) { + throw new UnsupportedOperationException(); + } + + @Override + public ExecResponse runScriptOnNode(String id, String runScript) { + throw new UnsupportedOperationException(); + } + + @Override + public Optional getImageExtension() { + throw new UnsupportedOperationException(); + } + + @Override + public Optional getSecurityGroupExtension() { + throw new UnsupportedOperationException(); + } +} diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/networking/JcloudsReachableAddressStubbedTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/networking/JcloudsReachableAddressStubbedTest.java index 9a5f16866e..8171921aaf 100644 --- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/networking/JcloudsReachableAddressStubbedTest.java +++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/networking/JcloudsReachableAddressStubbedTest.java @@ -28,19 +28,14 @@ import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.location.access.PortForwardManager; import org.apache.brooklyn.core.location.access.PortForwardManagerImpl; -import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; -import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; -import org.apache.brooklyn.location.jclouds.AbstractJcloudsLiveTest; -import org.apache.brooklyn.location.jclouds.ComputeServiceRegistry; +import org.apache.brooklyn.location.jclouds.AbstractJcloudsStubbedUnitTest; import org.apache.brooklyn.location.jclouds.JcloudsLocation; import org.apache.brooklyn.location.jclouds.JcloudsLocationConfig; import org.apache.brooklyn.location.jclouds.JcloudsSshMachineLocation; -import org.apache.brooklyn.location.jclouds.JcloudsStubTemplateBuilder; import org.apache.brooklyn.location.jclouds.JcloudsWinRmMachineLocation; -import org.apache.brooklyn.location.jclouds.StubbedComputeServiceRegistry; import org.apache.brooklyn.location.jclouds.StubbedComputeServiceRegistry.AbstractNodeCreator; -import org.apache.brooklyn.location.jclouds.networking.JcloudsPortForwardingStubbedLiveTest.RecordingJcloudsPortForwarderExtension; -import org.apache.brooklyn.location.ssh.SshMachineLocation; +import org.apache.brooklyn.location.jclouds.StubbedComputeServiceRegistry.SingleNodeCreator; +import org.apache.brooklyn.location.jclouds.networking.JcloudsPortForwardingStubbedTest.RecordingJcloudsPortForwarderExtension; import org.apache.brooklyn.location.winrm.WinRmMachineLocation; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool; @@ -54,11 +49,9 @@ import org.jclouds.compute.domain.NodeMetadata.Status; import org.jclouds.compute.domain.NodeMetadataBuilder; import org.jclouds.compute.domain.OsFamily; -import org.jclouds.compute.domain.Template; import org.jclouds.domain.LoginCredentials; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -69,13 +62,9 @@ import com.google.common.net.HostAndPort; /** - * The VM creation is stubbed out, but it still requires live access (i.e. real account credentials) - * to generate the template etc. - * * Simulates the creation of a VM that has multiple IPs. Checks that we choose the right address. - * */ -public class JcloudsReachableAddressStubbedTest extends AbstractJcloudsLiveTest { +public class JcloudsReachableAddressStubbedTest extends AbstractJcloudsStubbedUnitTest { // TODO Aim is to test the various situations/permutations, where we pass in different config. // More tests still need to be added. @@ -83,9 +72,6 @@ public class JcloudsReachableAddressStubbedTest extends AbstractJcloudsLiveTest @SuppressWarnings("unused") private static final Logger LOG = LoggerFactory.getLogger(JcloudsReachableAddressStubbedTest.class); - protected StubbedComputeServiceRegistry.NodeCreator nodeCreator; - protected ComputeServiceRegistry computeServiceRegistry; - protected String reachableIp; protected AddressChooser addressChooser; protected CustomResponseGeneratorImpl customResponseGenerator; @@ -93,66 +79,22 @@ public class JcloudsReachableAddressStubbedTest extends AbstractJcloudsLiveTest @BeforeMethod(alwaysRun=true) @Override public void setUp() throws Exception { + super.setUp(); reachableIp = null; // expect test method to set this addressChooser = new AddressChooser(); customResponseGenerator = new CustomResponseGeneratorImpl(); - RecordingSshTool.clear(); - RecordingWinRmTool.clear(); - super.setUp(); } - @AfterMethod(alwaysRun=true) - @Override - public void tearDown() throws Exception { - try { - super.tearDown(); - } finally { - RecordingSshTool.clear(); - RecordingWinRmTool.clear(); - } - } - - @Override - protected LocalManagementContext newManagementContext() { - return LocalManagementContextForTests.builder(true).build(); - } - protected AbstractNodeCreator newNodeCreator(final List publicAddresses, final List privateAddresses) { - return new AbstractNodeCreator() { - int nextIpSuffix = 2; - @Override - protected NodeMetadata newNode(String group, Template template) { - int ipSuffix = nextIpSuffix++; - NodeMetadata result = new NodeMetadataBuilder() - .id("myid-"+ipSuffix) - .credentials(LoginCredentials.builder().identity("myuser").credential("mypassword").build()) - .loginPort(22) - .status(Status.RUNNING) - .publicAddresses(publicAddresses) - .privateAddresses(privateAddresses) - .build(); - return result; - } - }; - } - - public String getLocationSpec() { - return "jclouds:aws-ec2"; - } - - protected void initNodeCreatorAndJcloudsLocation(List publicAddresses, List privateAddresses, Map jcloudsLocationConfig) throws Exception { - nodeCreator = newNodeCreator(publicAddresses, privateAddresses); - computeServiceRegistry = new StubbedComputeServiceRegistry(nodeCreator); - - jcloudsLocation = (JcloudsLocation)managementContext.getLocationRegistry().getLocationManaged( - getLocationSpec(), - ImmutableMap.builder() - .put(JcloudsLocationConfig.COMPUTE_SERVICE_REGISTRY, computeServiceRegistry) - .put(JcloudsLocationConfig.TEMPLATE_BUILDER, JcloudsStubTemplateBuilder.create()) - .put(JcloudsLocationConfig.ACCESS_IDENTITY, "stub-identity") - .put(JcloudsLocationConfig.ACCESS_CREDENTIAL, "stub-credential") - .putAll(jcloudsLocationConfig) - .build()); + NodeMetadata node = new NodeMetadataBuilder() + .id("myid-1") + .credentials(LoginCredentials.builder().identity("myuser").credential("mypassword").build()) + .loginPort(22) + .status(Status.RUNNING) + .publicAddresses(publicAddresses) + .privateAddresses(privateAddresses) + .build(); + return new SingleNodeCreator(node); } /** @@ -161,8 +103,10 @@ protected void initNodeCreatorAndJcloudsLocation(List publicAddresses, L */ @Test public void testMachineUsesVanillaPublicAddress() throws Exception { - initNodeCreatorAndJcloudsLocation(ImmutableList.of("1.1.1.1"), ImmutableList.of("2.1.1.1"), ImmutableMap.of()); + List publicAddresses = ImmutableList.of("1.1.1.1"); + List privateAddresses = ImmutableList.of("2.1.1.1"); reachableIp = "1.1.1.1"; + initNodeCreatorAndJcloudsLocation(newNodeCreator(publicAddresses, privateAddresses), ImmutableMap.of()); JcloudsSshMachineLocation machine = newMachine(ImmutableMap.,Object>builder() .put(JcloudsLocationConfig.WAIT_FOR_SSHABLE, Asserts.DEFAULT_LONG_TIMEOUT.toString()) @@ -182,8 +126,10 @@ public void testMachineUsesVanillaPublicAddress() throws Exception { */ @Test public void testWindowsMachineUsesVanillaPublicAddress() throws Exception { - initNodeCreatorAndJcloudsLocation(ImmutableList.of("1.1.1.1"), ImmutableList.of("2.1.1.1"), ImmutableMap.of()); + List publicAddresses = ImmutableList.of("1.1.1.1"); + List privateAddresses = ImmutableList.of("2.1.1.1"); reachableIp = "1.1.1.1"; + initNodeCreatorAndJcloudsLocation(newNodeCreator(publicAddresses, privateAddresses), ImmutableMap.of()); JcloudsWinRmMachineLocation machine = newWinrmMachine(ImmutableMap.,Object>builder() .put(JcloudsLocationConfig.WAIT_FOR_WINRM_AVAILABLE, Asserts.DEFAULT_LONG_TIMEOUT.toString()) @@ -204,8 +150,10 @@ public void testWindowsMachineUsesVanillaPublicAddress() throws Exception { */ @Test public void testMachineUsesVanillaPrivateAddress() throws Exception { - initNodeCreatorAndJcloudsLocation(ImmutableList.of("1.1.1.1"), ImmutableList.of("2.1.1.1"), ImmutableMap.of()); + List publicAddresses = ImmutableList.of("1.1.1.1"); + List privateAddresses = ImmutableList.of("2.1.1.1"); reachableIp = "2.1.1.1"; + initNodeCreatorAndJcloudsLocation(newNodeCreator(publicAddresses, privateAddresses), ImmutableMap.of()); JcloudsSshMachineLocation machine = newMachine(ImmutableMap.,Object>builder() .put(JcloudsLocationConfig.WAIT_FOR_SSHABLE, Asserts.DEFAULT_LONG_TIMEOUT.toString()) @@ -226,8 +174,10 @@ public void testMachineUsesVanillaPrivateAddress() throws Exception { */ @Test public void testMachineUsesReachablePublicAddress() throws Exception { - initNodeCreatorAndJcloudsLocation(ImmutableList.of("1.1.1.1", "1.1.1.2", "1.1.1.2"), ImmutableList.of("2.1.1.1"), ImmutableMap.of()); + List publicAddresses = ImmutableList.of("1.1.1.1", "1.1.1.2", "1.1.1.3"); + List privateAddresses = ImmutableList.of("2.1.1.1"); reachableIp = "1.1.1.2"; + initNodeCreatorAndJcloudsLocation(newNodeCreator(publicAddresses, privateAddresses), ImmutableMap.of()); JcloudsSshMachineLocation machine = newMachine(ImmutableMap.,Object>builder() .put(JcloudsLocationConfig.WAIT_FOR_SSHABLE, Asserts.DEFAULT_LONG_TIMEOUT.toString()) @@ -248,8 +198,10 @@ public void testMachineUsesReachablePublicAddress() throws Exception { */ @Test public void testMachineUsesReachablePrivateAddress() throws Exception { - initNodeCreatorAndJcloudsLocation(ImmutableList.of("1.1.1.1"), ImmutableList.of("2.1.1.1", "2.1.1.2", "2.1.1.2"), ImmutableMap.of()); + List publicAddresses = ImmutableList.of("1.1.1.1"); + List privateAddresses = ImmutableList.of("2.1.1.1", "2.1.1.2", "2.1.1.3"); reachableIp = "2.1.1.2"; + initNodeCreatorAndJcloudsLocation(newNodeCreator(publicAddresses, privateAddresses), ImmutableMap.of()); JcloudsSshMachineLocation machine = newMachine(ImmutableMap.,Object>builder() .put(JcloudsLocationConfig.WAIT_FOR_SSHABLE, Asserts.DEFAULT_LONG_TIMEOUT.toString()) @@ -270,8 +222,10 @@ public void testMachineUsesReachablePrivateAddress() throws Exception { */ @Test public void testNoWaitFroSshable() throws Exception { - initNodeCreatorAndJcloudsLocation(ImmutableList.of("1.1.1.1", "1.1.1.2", "1.1.1.2"), ImmutableList.of("2.1.1.1"), ImmutableMap.of()); + List publicAddresses = ImmutableList.of("1.1.1.1", "1.1.1.2", "1.1.1.3"); + List privateAddresses = ImmutableList.of("2.1.1.1"); reachableIp = null; + initNodeCreatorAndJcloudsLocation(newNodeCreator(publicAddresses, privateAddresses), ImmutableMap.of()); JcloudsSshMachineLocation machine = newMachine(ImmutableMap.,Object>builder() .put(JcloudsLocationConfig.WAIT_FOR_SSHABLE, "false") @@ -291,8 +245,10 @@ public void testNoWaitFroSshable() throws Exception { */ @Test public void testNoPollForFirstReachable() throws Exception { - initNodeCreatorAndJcloudsLocation(ImmutableList.of("1.1.1.1", "1.1.1.2", "1.1.1.2"), ImmutableList.of("2.1.1.1"), ImmutableMap.of()); + List publicAddresses = ImmutableList.of("1.1.1.1", "1.1.1.2", "1.1.1.3"); + List privateAddresses = ImmutableList.of("2.1.1.1"); reachableIp = null; + initNodeCreatorAndJcloudsLocation(newNodeCreator(publicAddresses, privateAddresses), ImmutableMap.of()); JcloudsSshMachineLocation machine = newMachine(ImmutableMap.,Object>builder() .put(JcloudsLocationConfig.WAIT_FOR_SSHABLE, Asserts.DEFAULT_LONG_TIMEOUT.toString()) @@ -308,8 +264,10 @@ public void testNoPollForFirstReachable() throws Exception { @Test public void testReachabilityChecksWithPortForwarding() throws Exception { - initNodeCreatorAndJcloudsLocation(ImmutableList.of("1.1.1.1"), ImmutableList.of("2.1.1.1"), ImmutableMap.of()); + List publicAddresses = ImmutableList.of("1.1.1.1"); + List privateAddresses = ImmutableList.of("2.1.1.1"); reachableIp = "1.2.3.4"; + initNodeCreatorAndJcloudsLocation(newNodeCreator(publicAddresses, privateAddresses), ImmutableMap.of()); PortForwardManager pfm = new PortForwardManagerImpl(); RecordingJcloudsPortForwarderExtension portForwarder = new RecordingJcloudsPortForwarderExtension(pfm); @@ -337,8 +295,10 @@ public void testReachabilityChecksWithPortForwarding() throws Exception { */ @Test public void testWindowsReachabilityChecksWithPortForwarding() throws Exception { - initNodeCreatorAndJcloudsLocation(ImmutableList.of("1.1.1.1"), ImmutableList.of("2.1.1.1"), ImmutableMap.of()); + List publicAddresses = ImmutableList.of("1.1.1.1"); + List privateAddresses = ImmutableList.of("2.1.1.1"); reachableIp = "1.2.3.4"; + initNodeCreatorAndJcloudsLocation(newNodeCreator(publicAddresses, privateAddresses), ImmutableMap.of()); PortForwardManager pfm = new PortForwardManagerImpl(); RecordingJcloudsPortForwarderExtension portForwarder = new RecordingJcloudsPortForwarderExtension(pfm); @@ -362,15 +322,17 @@ public void testWindowsReachabilityChecksWithPortForwarding() throws Exception { @Test public void testMachineUsesFirstPublicAddress() throws Exception { - initNodeCreatorAndJcloudsLocation(ImmutableList.of("10.10.10.1", "10.10.10.2"), ImmutableList.of("1.1.1.1", "1.1.1.2", "1.1.1.2"), ImmutableMap.of()); - reachableIp = "10.10.10.1"; + List publicAddresses = ImmutableList.of("1.1.1.1", "1.1.1.2"); + List privateAddresses = ImmutableList.of("2.1.1.1", "2.1.1.2", "2.1.1.3"); + reachableIp = null; + initNodeCreatorAndJcloudsLocation(newNodeCreator(publicAddresses, privateAddresses), ImmutableMap.of()); JcloudsSshMachineLocation machine = newMachine(ImmutableMap.,Object>builder() .put(JcloudsLocationConfig.WAIT_FOR_SSHABLE, Asserts.DEFAULT_LONG_TIMEOUT.toString()) .put(JcloudsLocation.POLL_FOR_FIRST_REACHABLE_ADDRESS, false) .build()); - assertEquals(machine.getAddress().getHostAddress(), reachableIp); + assertEquals(machine.getAddress().getHostAddress(), "1.1.1.1"); } protected JcloudsSshMachineLocation newMachine() throws Exception { @@ -379,7 +341,6 @@ protected JcloudsSshMachineLocation newMachine() throws Exception { protected JcloudsSshMachineLocation newMachine(Map, ?> additionalConfig) throws Exception { return obtainMachine(ImmutableMap.,Object>builder() - .put(SshMachineLocation.SSH_TOOL_CLASS, RecordingSshTool.class.getName()) .put(JcloudsLocation.POLL_FOR_FIRST_REACHABLE_ADDRESS_PREDICATE, addressChooser) .putAll(additionalConfig) .build()); From 4210077b33344f63075c6f1524f408b9d9ce99cd Mon Sep 17 00:00:00 2001 From: Aled Sage Date: Tue, 4 Oct 2016 16:55:19 +0100 Subject: [PATCH 2/2] Convert jclouds live-sanity tests to unit tests --- ...ByonLocationResolverStubbedRebindTest.java | 5 +-- ...cloudsByonLocationResolverStubbedTest.java | 11 ++++-- ...JcloudsSshMachineLocationStubbedTest.java} | 24 +++++-------- ... => JcloudsPortForwardingStubbedTest.java} | 34 ++++++++++--------- 4 files changed, 38 insertions(+), 36 deletions(-) rename locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/{JcloudsSshMachineLocationStubbedLiveTest.java => JcloudsSshMachineLocationStubbedTest.java} (88%) rename locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/networking/{JcloudsPortForwardingStubbedLiveTest.java => JcloudsPortForwardingStubbedTest.java} (90%) diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolverStubbedRebindTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolverStubbedRebindTest.java index d4c75059a5..26da5e9d1c 100644 --- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolverStubbedRebindTest.java +++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolverStubbedRebindTest.java @@ -60,7 +60,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; -public class JcloudsByonLocationResolverStubbedRebindTest extends AbstractJcloudsStubbedLiveTest { +public class JcloudsByonLocationResolverStubbedRebindTest extends AbstractJcloudsStubbedUnitTest { private static final Logger LOG = LoggerFactory.getLogger(JcloudsByonLocationResolverStubbedRebindTest.class); @@ -92,6 +92,8 @@ public void setUp() throws Exception { LOG.info("Test "+getClass()+" persisting to "+mementoDir); super.setUp(); + + initNodeCreatorAndJcloudsLocation(newNodeCreator(), ImmutableMap.of()); } @AfterMethod(alwaysRun=true) @@ -110,7 +112,6 @@ public void tearDown() throws Exception { origManagementContext = null; } - @Override protected NodeCreator newNodeCreator() { return new NodeCreatorForRebinding(); } diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolverStubbedTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolverStubbedTest.java index 45cd0d1ddb..e70db2c05a 100644 --- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolverStubbedTest.java +++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsByonLocationResolverStubbedTest.java @@ -41,6 +41,7 @@ import org.jclouds.domain.LoginCredentials; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.google.common.base.Predicate; @@ -49,7 +50,7 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; -public class JcloudsByonLocationResolverStubbedTest extends AbstractJcloudsStubbedLiveTest { +public class JcloudsByonLocationResolverStubbedTest extends AbstractJcloudsStubbedUnitTest { @SuppressWarnings("unused") private static final Logger log = LoggerFactory.getLogger(JcloudsByonLocationResolverStubbedTest.class); @@ -57,6 +58,13 @@ public class JcloudsByonLocationResolverStubbedTest extends AbstractJcloudsStubb private final String nodeId = "mynodeid"; private final String nodePublicAddress = "173.194.32.123"; private final String nodePrivateAddress = "172.168.10.11"; + + @BeforeMethod(alwaysRun=true) + @Override + public void setUp() throws Exception { + super.setUp(); + initNodeCreatorAndJcloudsLocation(newNodeCreator(), ImmutableMap.of()); + } protected LocalManagementContext newManagementContext() { // This really is stubbed; no live access to the cloud @@ -68,7 +76,6 @@ protected LocalManagementContext newManagementContext() { } - @Override protected NodeCreator newNodeCreator() { return new AbstractNodeCreator() { @Override diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsSshMachineLocationStubbedLiveTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsSshMachineLocationStubbedTest.java similarity index 88% rename from locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsSshMachineLocationStubbedLiveTest.java rename to locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsSshMachineLocationStubbedTest.java index be29cdc64d..30fd0d3ae2 100644 --- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsSshMachineLocationStubbedLiveTest.java +++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/JcloudsSshMachineLocationStubbedTest.java @@ -21,7 +21,6 @@ import static org.testng.Assert.assertEquals; import java.util.List; -import java.util.Map; import org.apache.brooklyn.location.jclouds.StubbedComputeServiceRegistry.AbstractNodeCreator; import org.apache.brooklyn.location.jclouds.StubbedComputeServiceRegistry.NodeCreator; @@ -45,7 +44,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -public class JcloudsSshMachineLocationStubbedLiveTest extends AbstractJcloudsStubbedLiveTest { +public class JcloudsSshMachineLocationStubbedTest extends AbstractJcloudsStubbedUnitTest { @SuppressWarnings("unused") private static final Logger log = LoggerFactory.getLogger(JcloudsImageChoiceStubbedLiveTest.class); @@ -55,12 +54,12 @@ public class JcloudsSshMachineLocationStubbedLiveTest extends AbstractJcloudsStu @BeforeMethod(alwaysRun=true) public void setUp() throws Exception { + super.setUp(); privateAddresses = ImmutableList.of("172.168.10.11"); publicAddresses = ImmutableList.of("173.194.32.123"); - super.setUp(); + initNodeCreatorAndJcloudsLocation(newNodeCreator(), ImmutableMap.of()); } - @Override protected NodeCreator newNodeCreator() { return new AbstractNodeCreator() { @Override protected NodeMetadata newNode(String group, Template template) { @@ -77,14 +76,7 @@ protected NodeCreator newNodeCreator() { }; } - protected Map jcloudsLocationConfig(Map defaults) { - return ImmutableMap.builder() - .putAll(defaults) - .put(JcloudsLocationConfig.IMAGE_ID, "CENTOS_5_64") - .build(); - } - - @Test(groups={"Live", "Live-sanity"}) + @Test public void testWithNoPrivateAddress() throws Exception { privateAddresses = ImmutableList.of(); JcloudsSshMachineLocation machine = obtainMachine(); @@ -94,7 +86,7 @@ public void testWithNoPrivateAddress() throws Exception { assertEquals(machine.getSubnetHostname(), publicAddresses.get(0)); } - @Test(groups={"Live", "Live-sanity"}) + @Test public void testWithPrivateAddress() throws Exception { JcloudsSshMachineLocation machine = obtainMachine(); assertEquals(machine.getPrivateAddresses(), privateAddresses); @@ -103,7 +95,7 @@ public void testWithPrivateAddress() throws Exception { assertEquals(machine.getSubnetHostname(), privateAddresses.get(0)); } - @Test(groups={"Live", "Live-sanity"}) + @Test public void testSshConfigPassedToMachine() throws Exception { JcloudsSshMachineLocation machine = obtainMachine(ImmutableMap.of( SshMachineLocation.LOCAL_TEMP_DIR.getName(), "/my/local/temp/dir", @@ -114,11 +106,11 @@ public void testSshConfigPassedToMachine() throws Exception { assertEquals(machine.config().get(SshTool.PROP_SSH_TRIES), Integer.valueOf(123)); } - @Test(groups={"Live", "Live-sanity"}) + @Test public void testWinrmConfigPassedToMachine() throws Exception { JcloudsWinRmMachineLocation machine = obtainWinrmMachine(ImmutableMap.of( JcloudsLocation.OS_FAMILY_OVERRIDE.getName(), OsFamily.WINDOWS, - JcloudsLocation.WAIT_FOR_WINRM_AVAILABLE.getName(), "false", +// JcloudsLocation.WAIT_FOR_WINRM_AVAILABLE.getName(), "false", WinRmMachineLocation.COPY_FILE_CHUNK_SIZE_BYTES.getName(), 123, WinRmTool.PROP_EXEC_TRIES.getName(), 456)); assertEquals(machine.config().get(WinRmMachineLocation.COPY_FILE_CHUNK_SIZE_BYTES), Integer.valueOf(123)); diff --git a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/networking/JcloudsPortForwardingStubbedLiveTest.java b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/networking/JcloudsPortForwardingStubbedTest.java similarity index 90% rename from locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/networking/JcloudsPortForwardingStubbedLiveTest.java rename to locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/networking/JcloudsPortForwardingStubbedTest.java index 9783acf78f..4ca676568a 100644 --- a/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/networking/JcloudsPortForwardingStubbedLiveTest.java +++ b/locations/jclouds/src/test/java/org/apache/brooklyn/location/jclouds/networking/JcloudsPortForwardingStubbedTest.java @@ -26,7 +26,7 @@ import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.location.access.PortForwardManager; import org.apache.brooklyn.core.location.access.PortForwardManagerImpl; -import org.apache.brooklyn.location.jclouds.AbstractJcloudsStubbedLiveTest; +import org.apache.brooklyn.location.jclouds.AbstractJcloudsStubbedUnitTest; import org.apache.brooklyn.location.jclouds.JcloudsLocation; import org.apache.brooklyn.location.jclouds.JcloudsSshMachineLocation; import org.apache.brooklyn.location.jclouds.StubbedComputeServiceRegistry.AbstractNodeCreator; @@ -39,6 +39,7 @@ import org.jclouds.domain.LoginCredentials; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.google.common.base.Optional; @@ -48,17 +49,12 @@ import com.google.common.net.HostAndPort; /** - * The VM creation is stubbed out, but it still requires live access (i.e. real account credentials) - * to generate the template etc. - * - * We supply a ComputeServiceRegistry that delegates to the real instance for everything except - * VM creation and deletion. For those operations, it delegates to a NodeCreator that - * returns a dummy NodeMetadata, recording all calls made to it. + * Confirm that port-forwarding is registered and configured correctly. */ -public class JcloudsPortForwardingStubbedLiveTest extends AbstractJcloudsStubbedLiveTest { +public class JcloudsPortForwardingStubbedTest extends AbstractJcloudsStubbedUnitTest { @SuppressWarnings("unused") - private static final Logger LOG = LoggerFactory.getLogger(JcloudsPortForwardingStubbedLiveTest.class); + private static final Logger LOG = LoggerFactory.getLogger(JcloudsPortForwardingStubbedTest.class); static class RecordingJcloudsPortForwarderExtension implements JcloudsPortForwarderExtension { final PortForwardManager pfm; @@ -81,7 +77,13 @@ static class RecordingJcloudsPortForwarderExtension implements JcloudsPortForwar } } + @BeforeMethod(alwaysRun=true) @Override + public void setUp() throws Exception { + super.setUp(); + initNodeCreatorAndJcloudsLocation(newNodeCreator(), ImmutableMap.of()); + } + protected AbstractNodeCreator newNodeCreator() { return new AbstractNodeCreator() { int nextIpSuffix = 2; @@ -105,8 +107,8 @@ protected AbstractNodeCreator getNodeCreator() { return (AbstractNodeCreator) nodeCreator; } - @Test(groups = {"Live", "Live-sanity"}) - protected void testPortForwardingCallsForwarder() throws Exception { + @Test + public void testPortForwardingCallsForwarder() throws Exception { PortForwardManager pfm = new PortForwardManagerImpl(); RecordingJcloudsPortForwarderExtension portForwarder = new RecordingJcloudsPortForwarderExtension(pfm); @@ -116,7 +118,7 @@ protected void testPortForwardingCallsForwarder() throws Exception { NodeMetadata created = getNodeCreator().created.get(0); assertEquals(getNodeCreator().created.size(), 1, "created="+getNodeCreator().created+"; machine="+machine); - assertEquals(machine.getNode(), created); + assertEquals(machine.getOptionalNode().get(), created); assertEquals(portForwarder.opens.size(), 1, "opens="+portForwarder.opens+"; machine="+machine); assertEquals(portForwarder.opens.get(0).get(0), created); assertEquals(portForwarder.opens.get(0).get(1), 22); @@ -135,8 +137,8 @@ protected void testPortForwardingCallsForwarder() throws Exception { assertEquals(portForwarder.closes.get(0).get(3), Protocol.TCP); } - @Test(groups = {"Live", "Live-sanity"}) - protected void testDeregistersWithPortForwardManagerOnRelease() throws Exception { + @Test + public void testDeregistersWithPortForwardManagerOnRelease() throws Exception { PortForwardManager pfm = new PortForwardManagerImpl(); RecordingJcloudsPortForwarderExtension portForwarder = new RecordingJcloudsPortForwarderExtension(pfm); @@ -164,8 +166,8 @@ protected void testDeregistersWithPortForwardManagerOnRelease() throws Exception assertEquals(portForwarder.closes.get(0).get(3), Protocol.TCP); } - @Test(groups = {"Live", "Live-sanity"}) - protected void testReleaseVmDoesNotImpactOtherVms() throws Exception { + @Test + public void testReleaseVmDoesNotImpactOtherVms() throws Exception { PortForwardManager pfm = new PortForwardManagerImpl(); RecordingJcloudsPortForwarderExtension portForwarder = new RecordingJcloudsPortForwarderExtension(pfm);