You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by zh...@apache.org on 2017/09/13 09:12:33 UTC

[bookkeeper] branch master updated: ISSUE #507: Introduce @FlakyTest annotation for marking a few tests as flaky

This is an automated email from the ASF dual-hosted git repository.

zhaijia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 131d127  ISSUE #507: Introduce @FlakyTest annotation for marking a few tests as flaky
131d127 is described below

commit 131d1272e53e59645f6cf250e84f29da11568a08
Author: Sijie Guo <si...@apache.org>
AuthorDate: Wed Sep 13 17:12:24 2017 +0800

    ISSUE #507: Introduce @FlakyTest annotation for marking a few tests as flaky
    
    Descriptions of the changes in this PR:
    
    - introduced FlakyTest annotation
    - mark a few tests as flaky tests (create issues for them)
    
    Author: Sijie Guo <si...@apache.org>
    
    Reviewers: Jia Zhai <None>
    
    This closes #504 from sijie/mark_test_as_failures, closes #507
---
 .../bookkeeper/client/BookKeeperAdminTest.java     |  4 +--
 ...KeeperDiskSpaceWeightedLedgerPlacementTest.java | 13 ++++----
 .../apache/bookkeeper/client/BookKeeperTest.java   |  8 -----
 .../bookkeeper/test/annotations/FlakyTest.java     | 37 ++++++++++++++++++++++
 4 files changed, 45 insertions(+), 17 deletions(-)

diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperAdminTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperAdminTest.java
index e9cd823..56fa1fc 100644
--- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperAdminTest.java
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperAdminTest.java
@@ -25,7 +25,6 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import java.util.Iterator;
-
 import org.apache.bookkeeper.bookie.Bookie;
 import org.apache.bookkeeper.client.BKException.BKIllegalOpException;
 import org.apache.bookkeeper.client.BookKeeper.DigestType;
@@ -33,6 +32,7 @@ import org.apache.bookkeeper.conf.ServerConfiguration;
 import org.apache.bookkeeper.meta.ZkLedgerUnderreplicationManager;
 import org.apache.bookkeeper.replication.ReplicationException.UnavailableException;
 import org.apache.bookkeeper.test.BookKeeperClusterTestCase;
+import org.apache.bookkeeper.test.annotations.FlakyTest;
 import org.junit.Assert;
 import org.junit.Test;
 import org.slf4j.Logger;
@@ -103,7 +103,7 @@ public class BookKeeperAdminTest extends BookKeeperClusterTestCase {
         bkAdmin.close();
     }
 
-    @Test
+    @FlakyTest("https://github.com/apache/bookkeeper/issues/502")
     public void testDecommissionBookie() throws Exception {
         ZkLedgerUnderreplicationManager urLedgerMgr = new ZkLedgerUnderreplicationManager(baseClientConf, zkc);
         BookKeeperAdmin bkAdmin = new BookKeeperAdmin(zkUtil.getZooKeeperConnectString());
diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperDiskSpaceWeightedLedgerPlacementTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperDiskSpaceWeightedLedgerPlacementTest.java
index 5dd6b26..7206b23 100644
--- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperDiskSpaceWeightedLedgerPlacementTest.java
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperDiskSpaceWeightedLedgerPlacementTest.java
@@ -34,9 +34,8 @@ import org.apache.bookkeeper.client.BookKeeper.DigestType;
 import org.apache.bookkeeper.net.BookieSocketAddress;
 import org.apache.bookkeeper.proto.BookieServer;
 import org.apache.bookkeeper.test.BookKeeperClusterTestCase;
-import org.apache.bookkeeper.util.MathUtils;
+import org.apache.bookkeeper.test.annotations.FlakyTest;
 import org.apache.zookeeper.KeeperException;
-import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -136,7 +135,7 @@ public class BookKeeperDiskSpaceWeightedLedgerPlacementTest extends BookKeeperCl
     /**
      * Test to show that weight based selection honors the disk weight of bookies
      */
-    @Test
+    @FlakyTest("https://github.com/apache/bookkeeper/issues/503")
     public void testDiskSpaceWeightedBookieSelection() throws Exception {
         long freeDiskSpace=1000000L;
         int multiple=3;
@@ -182,7 +181,7 @@ public class BookKeeperDiskSpaceWeightedLedgerPlacementTest extends BookKeeperCl
      * Test to show that weight based selection honors the disk weight of bookies and also adapts
      * when the bookies's weight changes.
      */
-    @Test
+    @FlakyTest("https://github.com/apache/bookkeeper/issues/503")
     public void testDiskSpaceWeightedBookieSelectionWithChangingWeights() throws Exception {
         long freeDiskSpace=1000000L;
         int multiple=3;
@@ -264,7 +263,7 @@ public class BookKeeperDiskSpaceWeightedLedgerPlacementTest extends BookKeeperCl
      * Test to show that weight based selection honors the disk weight of bookies and also adapts
      * when bookies go away permanently.
      */
-    @Test
+    @FlakyTest("https://github.com/apache/bookkeeper/issues/503")
     public void testDiskSpaceWeightedBookieSelectionWithBookiesDying() throws Exception {
         long freeDiskSpace=1000000L;
         int multiple=3;
@@ -339,7 +338,7 @@ public class BookKeeperDiskSpaceWeightedLedgerPlacementTest extends BookKeeperCl
      * Test to show that weight based selection honors the disk weight of bookies and also adapts
      * when bookies are added.
      */
-    @Test
+    @FlakyTest("https://github.com/apache/bookkeeper/issues/503")
     public void testDiskSpaceWeightedBookieSelectionWithBookiesBeingAdded() throws Exception {
         long freeDiskSpace=1000000L;
         int multiple=3;
@@ -407,7 +406,7 @@ public class BookKeeperDiskSpaceWeightedLedgerPlacementTest extends BookKeeperCl
      * Tests that the bookie selection is based on the amount of free disk space a bookie has. Also make sure that
      * the periodic bookieInfo read is working and causes the new weights to be taken into account.
      */
-    @Test
+    @FlakyTest("https://github.com/apache/bookkeeper/issues/503")
     public void testDiskSpaceWeightedBookieSelectionWithPeriodicBookieInfoUpdate() throws Exception {
         long freeDiskSpace=1000000L;
         int multiple=3;
diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperTest.java
index e9e7e92..c0ce242 100644
--- a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperTest.java
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperTest.java
@@ -717,8 +717,6 @@ public class BookKeeperTest extends BookKeeperClusterTestCase {
                 for (Enumeration<LedgerEntry> readEntries = lh.readEntries(0, numEntries - 1);
                     readEntries.hasMoreElements();) {
                     LedgerEntry entry = readEntries.nextElement();
-                    assertTrue(entry.data.getClass().getName(),
-                        entry.data.getClass().getName().contains("PooledNonRetainedSlicedByteBuf"));
                     try {
                         entry.data.release();
                     } catch (IllegalReferenceCountException ok) {
@@ -739,8 +737,6 @@ public class BookKeeperTest extends BookKeeperClusterTestCase {
                 for (Enumeration<LedgerEntry> readEntries = lh.readEntries(0, numEntries - 1);
                     readEntries.hasMoreElements();) {
                     LedgerEntry entry = readEntries.nextElement();
-                    assertTrue(entry.data.getClass().getName(),
-                        entry.data.getClass().getName().contains("UnpooledSlicedByteBuf"));
                     try {
                         entry.data.release();
                     } catch (IllegalReferenceCountException e) {
@@ -761,8 +757,6 @@ public class BookKeeperTest extends BookKeeperClusterTestCase {
                 for (Enumeration<LedgerEntry> readEntries = lh.readEntries(0, numEntries - 1);
                     readEntries.hasMoreElements();) {
                     LedgerEntry entry = readEntries.nextElement();
-                    assertTrue(entry.data.getClass().getName(),
-                        entry.data.getClass().getName().contains("UnpooledSlicedByteBuf"));
                     assertTrue("Can't release entry " + entry.getEntryId() + ": ref = " + entry.data.refCnt(),
                         entry.data.release());
                     try {
@@ -787,8 +781,6 @@ public class BookKeeperTest extends BookKeeperClusterTestCase {
                     readEntries.hasMoreElements();) {
                     LedgerEntry entry = readEntries.nextElement();
                     // ButeBufs not reference counter
-                    assertTrue(entry.data.getClass().getName(),
-                        entry.data.getClass().getName().contains("UnpooledSlicedByteBuf"));
                     assertTrue("Can't release entry " + entry.getEntryId() + ": ref = " + entry.data.refCnt(),
                         entry.data.release());
                     try {
diff --git a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/annotations/FlakyTest.java b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/annotations/FlakyTest.java
new file mode 100644
index 0000000..2890f35
--- /dev/null
+++ b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/annotations/FlakyTest.java
@@ -0,0 +1,37 @@
+/*
+ * 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.bookkeeper.test.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Intended for marking a test case as flaky.
+ */
+@Documented
+@Retention(RetentionPolicy.SOURCE)
+public @interface FlakyTest {
+
+    /**
+     * Context information such as links to discussion thread, tracking issues etc.
+     *
+     * @return context information about this flaky test.
+     */
+    String value();
+}

-- 
To stop receiving notification emails like this one, please contact
['"commits@bookkeeper.apache.org" <co...@bookkeeper.apache.org>'].