Updated Branches: refs/heads/master cf6cfc6ad -> 5a7554bbc
FGCP: increase timeout for nonBlock test, cleanups Project: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/commit/5a7554bb Tree: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/tree/5a7554bb Diff: http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/diff/5a7554bb Branch: refs/heads/master Commit: 5a7554bbcc2bca4ce6930e55ac2bde1319052b91 Parents: 65a99a5 Author: Dies Koper <[email protected]> Authored: Wed May 22 15:29:36 2013 +1000 Committer: Andrew Gaul <[email protected]> Committed: Thu May 23 16:21:51 2013 -0700 ---------------------------------------------------------------------- .../handlers/FGCPBackoffLimitedRetryHandler.java | 27 +++ .../compute/FGCPBaseComputeServiceLiveTest.java | 162 ++++++--------- 2 files changed, 91 insertions(+), 98 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/5a7554bb/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/handlers/FGCPBackoffLimitedRetryHandler.java ---------------------------------------------------------------------- diff --git a/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/handlers/FGCPBackoffLimitedRetryHandler.java b/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/handlers/FGCPBackoffLimitedRetryHandler.java new file mode 100644 index 0000000..cfd4c34 --- /dev/null +++ b/fgcp/src/main/java/org/jclouds/fujitsu/fgcp/handlers/FGCPBackoffLimitedRetryHandler.java @@ -0,0 +1,27 @@ +/* + * 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.jclouds.fujitsu.fgcp.handlers; + +import org.jclouds.http.handlers.BackoffLimitedRetryHandler; + +public class FGCPBackoffLimitedRetryHandler extends BackoffLimitedRetryHandler { + + public void imposeBackoffExponentialDelay(long period, int pow, int failureCount, int max, String commandDescription) { + imposeBackoffExponentialDelay(period, period * 100l, pow, failureCount, max, commandDescription); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-jclouds-labs/blob/5a7554bb/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/compute/FGCPBaseComputeServiceLiveTest.java ---------------------------------------------------------------------- diff --git a/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/compute/FGCPBaseComputeServiceLiveTest.java b/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/compute/FGCPBaseComputeServiceLiveTest.java index d7dbd2e..cf0865b 100644 --- a/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/compute/FGCPBaseComputeServiceLiveTest.java +++ b/fgcp/src/test/java/org/jclouds/fujitsu/fgcp/compute/FGCPBaseComputeServiceLiveTest.java @@ -16,23 +16,68 @@ */ package org.jclouds.fujitsu.fgcp.compute; +import static com.google.common.collect.Iterables.get; +import static com.google.common.collect.Iterables.getOnlyElement; +import static java.lang.String.format; +import static java.util.logging.Logger.getAnonymousLogger; +import static org.jclouds.compute.options.RunScriptOptions.Builder.nameTask; +import static org.jclouds.compute.options.RunScriptOptions.Builder.wrapInInitScript; +import static org.jclouds.compute.options.TemplateOptions.Builder.inboundPorts; +import static org.jclouds.compute.options.TemplateOptions.Builder.runAsRoot; +import static org.jclouds.compute.predicates.NodePredicates.inGroup; +import static org.jclouds.compute.predicates.NodePredicates.runningInGroup; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.util.Map.Entry; +import java.util.List; import java.util.Properties; +import java.util.Set; +import java.util.concurrent.Callable; +import java.util.concurrent.TimeUnit; +import java.util.logging.Level; import org.jclouds.Constants; +import org.jclouds.compute.ComputeServiceContext; +import org.jclouds.compute.ComputeTestUtils; +import org.jclouds.compute.JettyStatements; +import org.jclouds.compute.RunNodesException; import org.jclouds.compute.domain.ExecResponse; import org.jclouds.compute.domain.NodeMetadata; +import org.jclouds.compute.domain.OperatingSystem; import org.jclouds.compute.internal.BaseComputeServiceLiveTest; +import org.jclouds.compute.options.TemplateOptions; +import org.jclouds.domain.LoginCredentials; import org.jclouds.rest.AuthorizationException; +import org.jclouds.scriptbuilder.statements.login.AdminAccess; import org.jclouds.sshj.config.SshjSshClientModule; import org.testng.annotations.Test; +import com.google.common.base.Charsets; +import com.google.common.base.Stopwatch; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.common.io.Files; +import com.google.common.io.Resources; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.common.util.concurrent.ListeningExecutorService; +import com.google.common.util.concurrent.MoreExecutors; import com.google.inject.Module; public abstract class FGCPBaseComputeServiceLiveTest extends BaseComputeServiceLiveTest { + public FGCPBaseComputeServiceLiveTest() { + // create operation must complete before start request is sent, taking a + // few minutes + nonBlockDurationSeconds = 300; // 5 min. + } + @Override protected Properties setupProperties() { Properties overrides = super.setupProperties(); @@ -52,7 +97,7 @@ public abstract class FGCPBaseComputeServiceLiveTest extends overrides.setProperty(Constants.PROPERTY_PROXY_FOR_SOCKETS, "false"); } - + // enables peer verification using the CAs bundled with the JRE (or // value of javax.net.ssl.trustStore if set) overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "false"); @@ -66,9 +111,9 @@ public abstract class FGCPBaseComputeServiceLiveTest extends } @Override + // fatal handshake is not returned as AuthorizationException; should it? @Test(enabled = false, expectedExceptions = AuthorizationException.class) public void testCorrectAuthException() throws Exception { - // http://code.google.com/p/jclouds/issues/detail?id=1060 } // fgcp does not support metadata @@ -80,6 +125,7 @@ public abstract class FGCPBaseComputeServiceLiveTest extends } // node name can't be retrieved through the API and is therefore null + @Override protected void checkResponseEqualsHostname(ExecResponse execResponse, NodeMetadata node) { assert node.getHostname() == null : node + " with hostname: " @@ -87,119 +133,39 @@ public abstract class FGCPBaseComputeServiceLiveTest extends } // tags are not (yet) supported for fgcp + @Override protected void checkTagsInNodeEquals(NodeMetadata node, ImmutableSet<String> tags) { assert node.getTags().isEmpty() : String.format( "node tags found %s (%s) in node %s", node.getTags(), tags, node); } - /* - * public void testCreateAndRunAService() throws Exception { - * super.testCreateAndRunAService(); } - */ + // using user/pwd based auth to ssh to nodes instead + @Override + protected void setupKeyPairForTest() { + } - // this test requires network access to the VM it creates: + // these tests require network access to the VMs they create: // before running it, start an SSL/VPN connection to the last updated vsys' // DMZ. - // may also need to configure SNAT and FW rules to allow the VM to + // May also need to configure SNAT and FW rules to allow the VM to // communicate out (53/tcp-udp for DNS, 80/tcp for yum). +/* @Override + @Test(enabled = true, dependsOnMethods = { "testCompareSizes" }) public void testAScriptExecutionAfterBootWithBasicTemplate() throws Exception { super.testAScriptExecutionAfterBootWithBasicTemplate(); } - @Override - @Test(enabled = false) - public void testOptionToNotBlock() throws Exception { - // start call returns before node reaches running state, but - // test may be failing due to the system being in a 're-configuring' - // state while destroying nodes of a previous test. - // http://code.google.com/p/jclouds/issues/detail?id=1066 - /* - org.jclouds.compute.RunNodesException: error running 1 node group(fgcp-aublock) location(UZXC0GRT-IZKDVGIL5-N-SECURE1) image(IMG_3c9820_71OW9NZC268) size(islanda-cbrm_140) options({inboundPorts=[], blockUntilRunning=false}) - Execution failures: - - 1) ExecutionException on fgcp-aublock-787: - java.util.concurrent.ExecutionException: java.lang.IllegalStateException: The status of Instance[UZXC0GRT-IZKDVGIL5] is [RECONFIG_ING]. - at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:289) - at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:276) - at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:111) - at org.jclouds.concurrent.FutureIterables$1.run(FutureIterables.java:134) - at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) - at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) - at java.lang.Thread.run(Unknown Source) - Caused by: java.lang.IllegalStateException: The status of Instance[UZXC0GRT-IZKDVGIL5] is [RECONFIG_ING]. - at org.jclouds.fujitsu.fgcp.xml.FGCPJAXBParser.fromXML(FGCPJAXBParser.java:75) - at org.jclouds.http.functions.ParseXMLWithJAXB.apply(ParseXMLWithJAXB.java:91) - at org.jclouds.http.functions.ParseXMLWithJAXB.apply(ParseXMLWithJAXB.java:86) - at org.jclouds.http.functions.ParseXMLWithJAXB.apply(ParseXMLWithJAXB.java:73) - at org.jclouds.http.functions.ParseXMLWithJAXB.apply(ParseXMLWithJAXB.java:54) - at com.google.common.base.Functions$FunctionComposition.apply(Functions.java:209) - at com.google.common.util.concurrent.Futures$3.apply(Futures.java:380) - at com.google.common.util.concurrent.Futures$ChainingListenableFuture.run(Futures.java:522) - at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) - at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) - at java.lang.Thread.run(Unknown Source) - at org.jclouds.concurrent.config.DescribingExecutorService.submit(DescribingExecutorService.java:89) - at org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet.createNodeInGroupWithNameAndTemplate(CreateNodesWithGroupEncodedIntoNameThenAddToSet.java:170) - at org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet.execute(CreateNodesWithGroupEncodedIntoNameThenAddToSet.java:125) - at org.jclouds.compute.internal.BaseComputeService.createNodesInGroup(BaseComputeService.java:213) - at org.jclouds.compute.internal.BaseComputeService.createNodesInGroup(BaseComputeService.java:229) - at org.jclouds.compute.internal.BaseComputeServiceLiveTest.testOptionToNotBlock(BaseComputeServiceLiveTest.java:803) - */ - } - -/* @Override - @Test(enabled = false) - public void testCreateTwoNodesWithRunScript() { + @Test(enabled = true) + public void testCreateAndRunAService() throws Exception { + super.testCreateAndRunAService(); } - @Override - @Test(enabled = false) - public void testCreateAnotherNodeWithANewContextToEnsureSharedMemIsntRequired() { - } - - @Override - @Test(enabled = false) - public void testGet() { + @Test(enabled = true, dependsOnMethods = "testCompareSizes") + public void testConcurrentUseOfComputeServiceToCreateNodes() throws Exception { + super.testConcurrentUseOfComputeServiceToCreateNodes(); } */ -// @Override -// @Test(enabled = false) -// public void testConcurrentUseOfComputeServiceToCreateNodes() throws Exception { - // http://code.google.com/p/jclouds/issues/detail?id=1066 - /* - 1) ExecutionException on twin0-f6a: - java.util.concurrent.ExecutionException: org.jclouds.http.HttpResponseException: Error parsing input - {statusCode=200, message=OK, headers={Date=[Sun, 26 Aug 2012 01:22:50 GMT], Transfer-Encoding=[chunked], Set-Cookie=[JSESSIONID=8A07404DF0405E46B3A748C3763B0D9F; Path=/ovisspxy; Secure], Connection=[close]}, payload=[content=true, contentMetadata=[contentDisposition=null, contentEncoding=null, contentLanguage=null, contentLength=null, contentMD5=null, contentType=text/xml;charset=UTF-8, expires=null], written=false]} - at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:289) - at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:276) - at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:111) - at org.jclouds.concurrent.FutureIterables$1.run(FutureIterables.java:134) - at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) - at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) - at java.lang.Thread.run(Unknown Source) - Caused by: org.jclouds.http.HttpResponseException: Error parsing input - {statusCode=200, message=OK, headers={Date=[Sun, 26 Aug 2012 01:22:50 GMT], Transfer-Encoding=[chunked], Set-Cookie=[JSESSIONID=8A07404DF0405E46B3A748C3763B0D9F; Path=/ovisspxy; Secure], Connection=[close]}, payload=[content=true, contentMetadata=[contentDisposition=null, contentEncoding=null, contentLanguage=null, contentLength=null, contentMD5=null, contentType=text/xml;charset=UTF-8, expires=null], written=false]} - at org.jclouds.http.functions.ParseXMLWithJAXB.apply(ParseXMLWithJAXB.java:78) - at org.jclouds.http.functions.ParseXMLWithJAXB.apply(ParseXMLWithJAXB.java:1) - at com.google.common.base.Functions$FunctionComposition.apply(Functions.java:209) - at com.google.common.util.concurrent.Futures$3.apply(Futures.java:380) - at com.google.common.util.concurrent.Futures$ChainingListenableFuture.run(Futures.java:522) - at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) - at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) - at java.lang.Thread.run(Unknown Source) - at org.jclouds.concurrent.config.DescribingExecutorService.submit(DescribingExecutorService.java:89) - at org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet.createNodeInGroupWithNameAndTemplate(CreateNodesWithGroupEncodedIntoNameThenAddToSet.java:170) - at org.jclouds.compute.strategy.impl.CreateNodesWithGroupEncodedIntoNameThenAddToSet.execute(CreateNodesWithGroupEncodedIntoNameThenAddToSet.java:125) - at org.jclouds.compute.internal.BaseComputeService.createNodesInGroup(BaseComputeService.java:213) - at org.jclouds.compute.internal.BaseComputeService.createNodesInGroup(BaseComputeService.java:229) - at org.jclouds.compute.internal.BaseComputeServiceLiveTest$1.call(BaseComputeServiceLiveTest.java:442) - at org.jclouds.compute.internal.BaseComputeServiceLiveTest$1.call(BaseComputeServiceLiveTest.java:1) - ... 3 more - Caused by: org.jclouds.http.HttpException: The status of Instance[UZXC0GRT-9Q988189J] is [RECONFIG_ING]. - at org.jclouds.fujitsu.fgcp.xml.FGCPJAXBParser.fromXML(FGCPJAXBParser.java:81) - at org.jclouds.http.functions.ParseXMLWithJAXB.apply(ParseXMLWithJAXB.java:91) -*/ -// } + }
