ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alejan...@apache.org
Subject ambari git commit: AMBARI-18565. Deprecate old UpgradeCatalog Unit Tests (alejandro)
Date Tue, 11 Oct 2016 23:28:52 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk f725e33ec -> 1d54fefbb


AMBARI-18565. Deprecate old UpgradeCatalog Unit Tests (alejandro)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1d54fefb
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1d54fefb
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1d54fefb

Branch: refs/heads/trunk
Commit: 1d54fefbbf419d3fe6ebc9abd8257b854b7e0cf5
Parents: f725e33
Author: Alejandro Fernandez <afernandez@hortonworks.com>
Authored: Thu Oct 6 16:25:05 2016 -0700
Committer: Alejandro Fernandez <afernandez@hortonworks.com>
Committed: Tue Oct 11 16:33:59 2016 -0700

----------------------------------------------------------------------
 ...rnTimelineServerStatePreservingCheckTest.java |  3 +++
 .../server/security/SecurityFilterTest.java      | 19 +++++++++++++++----
 .../state/cluster/ClusterDeadlockTest.java       | 15 ++++++++-------
 .../server/testing/DeadlockWarningThread.java    | 13 ++++++++++---
 .../server/upgrade/UpgradeCatalog150Test.java    |  7 ++++++-
 .../server/upgrade/UpgradeCatalog151Test.java    |  3 +++
 .../server/upgrade/UpgradeCatalog160Test.java    |  3 +++
 .../server/upgrade/UpgradeCatalog161Test.java    |  3 +++
 .../server/upgrade/UpgradeCatalog170Test.java    |  3 +++
 9 files changed, 54 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1d54fefb/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java
index 7469bbc..613e47f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java
@@ -35,6 +35,7 @@ import org.apache.ambari.server.state.stack.PrerequisiteCheck;
 import org.apache.ambari.server.state.stack.UpgradePack.PrerequisiteCheckConfig;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.Mockito;
 
@@ -42,7 +43,9 @@ import com.google.inject.Provider;
 
 /**
  * Tests for {@link YarnTimelineServerStatePreservingCheckTest}
+ * @Deprecated
  */
+@Ignore
 public class YarnTimelineServerStatePreservingCheckTest {
   private final Clusters m_clusters = Mockito.mock(Clusters.class);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d54fefb/ambari-server/src/test/java/org/apache/ambari/server/security/SecurityFilterTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/SecurityFilterTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/security/SecurityFilterTest.java
index 49eefed..c59e868 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/security/SecurityFilterTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/security/SecurityFilterTest.java
@@ -21,17 +21,21 @@ package org.apache.ambari.server.security;
 import java.io.IOException;
 
 
-
+import com.google.inject.Binder;
+import com.google.inject.Module;
 import org.apache.ambari.server.configuration.Configuration;
-import org.apache.ambari.server.orm.InMemoryDefaultTestModule;
+import org.apache.ambari.server.state.stack.OsFamily;
 import org.junit.Before;
 import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.mock.web.MockFilterChain;
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.mock.web.MockHttpServletResponse;
 
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertNull;
+import static org.easymock.EasyMock.createNiceMock;
 
 import com.google.inject.Guice;
 import com.google.inject.Injector;
@@ -42,10 +46,10 @@ public class SecurityFilterTest {
 
   @Before
   public void setUp() throws IOException {
-    injector = Guice.createInjector(new InMemoryDefaultTestModule());
+    injector = Guice.createInjector(new MockModule());
     SecurityFilter.init(injector.getInstance(Configuration.class));
   }
-  
+
   @Test
   public void mustFilterNonHttpsRequests() throws Exception {
     SecurityFilter filter = new SecurityFilter();
@@ -107,4 +111,11 @@ public class SecurityFilterTest {
     request.setScheme("https");
     return request;
   }
+
+  private class MockModule implements Module {
+    @Override
+    public void configure(Binder binder) {
+      binder.bind(OsFamily.class).toInstance(createNiceMock(OsFamily.class));
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d54fefb/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java
index ec01b80..434948c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java
@@ -63,14 +63,16 @@ import com.google.inject.Injector;
 import com.google.inject.Module;
 import com.google.inject.persist.PersistService;
 import com.google.inject.util.Modules;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Tests AMBARI-9368 and AMBARI-9761 which produced a deadlock during read and
  * writes of some of the impl classes.
  */
 public class ClusterDeadlockTest {
-  private static final int NUMBER_OF_HOSTS = 100;
-  private static final int NUMBER_OF_THREADS = 3;
+  private static final int NUMBER_OF_HOSTS = 40;
+  private static final int NUMBER_OF_THREADS = 5;
 
   private final AtomicInteger hostNameCounter = new AtomicInteger(0);
 
@@ -274,8 +276,7 @@ public class ClusterDeadlockTest {
       schWriterThread.start();
     }
     
-    DeadlockWarningThread wt = new DeadlockWarningThread(threads);
-    
+    DeadlockWarningThread wt = new DeadlockWarningThread(threads, 20, 1000);
     while (true) {
       if(!wt.isAlive()) {
           break;
@@ -328,7 +329,7 @@ public class ClusterDeadlockTest {
   private final class ClusterDesiredConfigsReaderThread extends Thread {
     @Override
     public void run() {
-      for (int i =0; i<1500; i++) {
+      for (int i =0; i<1000; i++) {
         cluster.getDesiredConfigs();
       }
     }
@@ -343,7 +344,7 @@ public class ClusterDeadlockTest {
 
     @Override
     public void run() {
-      for (int i =0; i<500; i++) {
+      for (int i =0; i<300; i++) {
         config.persist(false);
       }
     }
@@ -361,7 +362,7 @@ public class ClusterDeadlockTest {
     @Override
     public void run() {
       try {
-        for (int i = 0; i < 1500; i++) {
+        for (int i = 0; i < 1000; i++) {
           cluster.convertToResponse();
           Thread.sleep(10);
         }

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d54fefb/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockWarningThread.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockWarningThread.java
b/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockWarningThread.java
index 589aee1..a184899 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockWarningThread.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockWarningThread.java
@@ -34,7 +34,8 @@ import java.util.List;
 public class DeadlockWarningThread extends Thread {
 
   private final List<String> errorMessages;
-  private static final int MAX_STACK_DEPTH = 30;
+  private int MAX_STACK_DEPTH = 30;
+  private int SLEEP_TIME_MS = 3000;
   private Collection<Thread> monitoredThreads = null;
   private boolean deadlocked = false;
   private static final ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
@@ -47,12 +48,18 @@ public class DeadlockWarningThread extends Thread {
     return deadlocked;
   }
 
-  public DeadlockWarningThread(Collection<Thread> monitoredThreads) {
+  public DeadlockWarningThread(Collection<Thread> monitoredThreads, int maxStackDepth,
int sleepTimeMS) {
     this.errorMessages = new ArrayList<String>();
     this.monitoredThreads = monitoredThreads;
+    this.MAX_STACK_DEPTH = maxStackDepth;
+    this.SLEEP_TIME_MS = sleepTimeMS;
     start();
   }
 
+  public DeadlockWarningThread(Collection<Thread> monitoredThreads) {
+    this(monitoredThreads, 30, 3000);
+  }
+
   public String getThreadsStacktraces(Collection<Long> ids) {
     StringBuilder errBuilder = new StringBuilder();
       for (long id : ids) {
@@ -73,7 +80,7 @@ public class DeadlockWarningThread extends Thread {
   public void run() {
     while (true) {
       try {
-        Thread.sleep(3000);
+        Thread.sleep(SLEEP_TIME_MS);
       } catch (InterruptedException ex) {
       }
       long[] ids = mbean.findMonitorDeadlockedThreads();

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d54fefb/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog150Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog150Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog150Test.java
index 4647815..eebda98 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog150Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog150Test.java
@@ -44,15 +44,20 @@ import org.apache.ambari.server.state.HostComponentAdminState;
 import org.apache.ambari.server.state.StackId;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import com.google.inject.Guice;
 import com.google.inject.Injector;
 import com.google.inject.persist.PersistService;
 
-import java.util.ArrayList;
 import java.util.Collections;
 
+/**
+ * UpgradeCatalog150 tests.
+ * @Deprecated
+ */
+@Ignore
 public class UpgradeCatalog150Test {
   private Injector injector;
   private final String CLUSTER_NAME = "c1";

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d54fefb/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog151Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog151Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog151Test.java
index b47f411..3b82625 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog151Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog151Test.java
@@ -28,6 +28,7 @@ import org.apache.ambari.server.orm.dao.MetainfoDAO;
 import org.apache.ambari.server.state.stack.OsFamily;
 import org.easymock.EasyMock;
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import java.lang.reflect.Field;
@@ -41,7 +42,9 @@ import static org.easymock.EasyMock.verify;
 
 /**
  * UpgradeCatalog151 tests.
+ * @Deprecated
  */
+@Ignore
 public class UpgradeCatalog151Test {
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d54fefb/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog160Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog160Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog160Test.java
index 303fa3a..754999b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog160Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog160Test.java
@@ -44,6 +44,7 @@ import org.apache.ambari.server.orm.DBAccessor;
 import org.apache.ambari.server.state.stack.OsFamily;
 import org.easymock.Capture;
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import com.google.inject.Binder;
@@ -53,7 +54,9 @@ import com.google.inject.Module;
 
 /**
  * UpgradeCatalog160 unit tests.
+ * @Deprecated
  */
+@Ignore
 public class UpgradeCatalog160Test {
 
   @Test

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d54fefb/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog161Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog161Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog161Test.java
index a3b41b8..a87a376 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog161Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog161Test.java
@@ -55,6 +55,7 @@ import org.apache.ambari.server.state.State;
 import org.apache.ambari.server.state.stack.OsFamily;
 import org.easymock.Capture;
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import com.google.inject.Binder;
@@ -65,7 +66,9 @@ import com.google.inject.Provider;
 
 /**
  * UpgradeCatalog161 unit tests.
+ * @Deprecated
  */
+@Ignore
 public class UpgradeCatalog161Test {
 
   @Test

http://git-wip-us.apache.org/repos/asf/ambari/blob/1d54fefb/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
index 10e4993..d13b40e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog170Test.java
@@ -124,6 +124,7 @@ import org.easymock.IAnswer;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import com.google.inject.Binder;
@@ -135,7 +136,9 @@ import com.google.inject.persist.PersistService;
 
 /**
  * UpgradeCatalog170 unit tests.
+ * @Deprecated
  */
+@Ignore
 public class UpgradeCatalog170Test {
 
   private Injector injector;


Mime
View raw message