You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by bh...@apache.org on 2020/07/23 00:11:37 UTC

[hadoop-ozone] branch master updated: HDDS-3827. Intermittent failure in TestKeyManagerUnit#listMultipartUploads (#1239)

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

bharat pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 5264b24  HDDS-3827. Intermittent failure in TestKeyManagerUnit#listMultipartUploads (#1239)
5264b24 is described below

commit 5264b240118ccdfacd1646ad75f246c439ba1c6b
Author: Doroszlai, Attila <64...@users.noreply.github.com>
AuthorDate: Thu Jul 23 02:11:27 2020 +0200

    HDDS-3827. Intermittent failure in TestKeyManagerUnit#listMultipartUploads (#1239)
---
 .../apache/hadoop/ozone/om/TestKeyManagerUnit.java | 23 ++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerUnit.java b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerUnit.java
index 4e62eb8..7f31b24 100644
--- a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerUnit.java
+++ b/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerUnit.java
@@ -19,6 +19,7 @@
 
 package org.apache.hadoop.ozone.om;
 
+import java.io.File;
 import java.io.IOException;
 import java.time.Instant;
 import java.util.ArrayList;
@@ -30,6 +31,7 @@ import java.util.Map;
 import java.util.UUID;
 
 import com.google.common.base.Optional;
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.RandomUtils;
 import org.apache.hadoop.hdds.HddsConfigKeys;
 import org.apache.hadoop.hdds.client.BlockID;
@@ -65,6 +67,7 @@ import org.apache.hadoop.ozone.security.OzoneBlockTokenSecretManager;
 import org.apache.hadoop.test.GenericTestUtils;
 
 import org.apache.hadoop.util.Time;
+import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -80,12 +83,14 @@ public class TestKeyManagerUnit {
   private KeyManagerImpl keyManager;
 
   private Instant startDate;
+  private File testDir;
 
   @Before
   public void setup() throws IOException {
     configuration = new OzoneConfiguration();
+    testDir = GenericTestUtils.getRandomizedTestDir();
     configuration.set(HddsConfigKeys.OZONE_METADATA_DIRS,
-        GenericTestUtils.getRandomizedTestDir().toString());
+        testDir.toString());
     metadataManager = new OmMetadataManagerImpl(configuration);
     keyManager = new KeyManagerImpl(
         Mockito.mock(ScmBlockLocationProtocol.class),
@@ -98,6 +103,12 @@ public class TestKeyManagerUnit {
     startDate = Instant.now();
   }
 
+  @After
+  public void cleanup() throws Exception {
+    metadataManager.stop();
+    FileUtils.deleteDirectory(testDir);
+  }
+
   @Test
   public void listMultipartUploadPartsWithZeroUpload() throws IOException {
     //GIVEN
@@ -113,8 +124,6 @@ public class TestKeyManagerUnit {
 
     Assert.assertEquals(0,
         omMultipartUploadListParts.getPartInfoList().size());
-
-    this.startDate = Instant.now();
   }
 
   @Test
@@ -144,9 +153,11 @@ public class TestKeyManagerUnit {
     Assert.assertEquals("dir/key2", uploads.get(1).getKeyName());
 
     Assert.assertNotNull(uploads.get(1));
-    Assert.assertNotNull(uploads.get(1).getCreationTime());
-    Assert.assertTrue("Creation date is too old",
-        uploads.get(1).getCreationTime().compareTo(startDate) > 0);
+    Instant creationTime = uploads.get(1).getCreationTime();
+    Assert.assertNotNull(creationTime);
+    Assert.assertFalse("Creation date is too old: "
+            + creationTime + " < " + startDate,
+        creationTime.isBefore(startDate));
   }
 
   @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-commits-help@hadoop.apache.org