Return-Path: X-Original-To: apmail-brooklyn-commits-archive@minotaur.apache.org Delivered-To: apmail-brooklyn-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7F6D2109CE for ; Sun, 1 Jun 2014 20:15:47 +0000 (UTC) Received: (qmail 37864 invoked by uid 500); 1 Jun 2014 20:15:47 -0000 Delivered-To: apmail-brooklyn-commits-archive@brooklyn.apache.org Received: (qmail 37840 invoked by uid 500); 1 Jun 2014 20:15:47 -0000 Mailing-List: contact commits-help@brooklyn.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.incubator.apache.org Delivered-To: mailing list commits@brooklyn.incubator.apache.org Received: (qmail 37833 invoked by uid 99); 1 Jun 2014 20:15:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jun 2014 20:15:47 +0000 X-ASF-Spam-Status: No, hits=-2000.7 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 01 Jun 2014 20:15:45 +0000 Received: (qmail 36047 invoked by uid 99); 1 Jun 2014 20:15:17 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 01 Jun 2014 20:15:17 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 41338839EF4; Sun, 1 Jun 2014 20:15:17 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: richard@apache.org To: commits@brooklyn.incubator.apache.org Date: Sun, 01 Jun 2014 20:15:30 -0000 Message-Id: <7da05792633746a79091d69c9cf651b7@git.apache.org> In-Reply-To: <188f281f68b54c0fbb9fe68af052a96e@git.apache.org> References: <188f281f68b54c0fbb9fe68af052a96e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: =?utf-8?q?=5B15/25=5D_git_commit=3A_More_testing_nginx-rebind_does?= =?utf-8?q?n=E2=80=99t_lose_members?= X-Virus-Checked: Checked by ClamAV on apache.org More testing nginx-rebind doesn’t lose members Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/f768fd5b Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/f768fd5b Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/f768fd5b Branch: refs/heads/master Commit: f768fd5bfc0599de4b81f246a4af3d4d375cee44 Parents: 57e670c Author: Aled Sage Authored: Wed May 28 19:16:32 2014 +0100 Committer: Aled Sage Committed: Fri May 30 10:24:39 2014 +0100 ---------------------------------------------------------------------- .../proxy/nginx/NginxRebindIntegrationTest.java | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/f768fd5b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java index 8064483..19bca33 100644 --- a/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java +++ b/software/webapp/src/test/java/brooklyn/entity/proxy/nginx/NginxRebindIntegrationTest.java @@ -8,6 +8,7 @@ import static org.testng.Assert.assertEquals; import java.io.File; import java.net.URL; import java.util.List; +import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -18,6 +19,7 @@ import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; +import brooklyn.entity.Entity; import brooklyn.entity.Group; import brooklyn.entity.basic.ApplicationBuilder; import brooklyn.entity.basic.BasicGroup; @@ -31,12 +33,14 @@ import brooklyn.entity.webapp.jboss.JBoss7Server; import brooklyn.location.basic.LocalhostMachineProvisioningLocation; import brooklyn.management.ManagementContext; import brooklyn.management.internal.LocalManagementContext; +import brooklyn.test.Asserts; import brooklyn.test.WebAppMonitor; import brooklyn.test.entity.TestApplication; import brooklyn.util.internal.TimeExtras; import com.google.common.base.Predicates; import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.io.Files; @@ -163,7 +167,9 @@ public class NginxRebindIntegrationTest { origApp.start(ImmutableList.of(localhostProvisioningLocation)); String rootUrl = origNginx.getAttribute(NginxController.ROOT_URL); - + JBoss7Server origJboss = (JBoss7Server) Iterables.getOnlyElement(origServerPool.getMembers()); + assertEquals(origNginx.getAttribute(NginxController.SERVER_POOL_TARGETS).keySet(), ImmutableSet.of(origJboss)); + assertHttpStatusCodeEventuallyEquals(rootUrl, 200); WebAppMonitor monitor = newWebAppMonitor(rootUrl, 200); final String origConfigFile = origNginx.getConfigFile(); @@ -172,9 +178,17 @@ public class NginxRebindIntegrationTest { newApp = rebind(); ManagementContext newManagementContext = newApp.getManagementContext(); final NginxController newNginx = (NginxController) Iterables.find(newApp.getChildren(), Predicates.instanceOf(NginxController.class)); - DynamicCluster newServerPool = (DynamicCluster) newManagementContext.getEntityManager().getEntity(origServerPool.getId()); - JBoss7Server newJboss = (JBoss7Server) Iterables.getOnlyElement(newServerPool.getMembers()); + final DynamicCluster newServerPool = (DynamicCluster) newManagementContext.getEntityManager().getEntity(origServerPool.getId()); + final JBoss7Server newJboss = (JBoss7Server) Iterables.getOnlyElement(newServerPool.getMembers()); + // Expect continually to have same nginx members; should not lose them temporarily! + Asserts.succeedsContinually(new Runnable() { + public void run() { + Map newNginxMemebers = newNginx.getAttribute(NginxController.SERVER_POOL_TARGETS); + assertEquals(newNginxMemebers.keySet(), ImmutableSet.of(newJboss)); + }}); + + assertAttributeEqualsEventually(newNginx, SoftwareProcess.SERVICE_UP, true); assertHttpStatusCodeEventuallyEquals(rootUrl, 200);