You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by st...@apache.org on 2019/02/28 19:42:56 UTC

[hadoop] 02/02: HADOOP-16109. Use parameterized tests for the s3a seek contract, with all three seek options checked

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

stevel pushed a commit to branch s3/HADOOP-16109-parquet-eof-s3a-seek
in repository https://gitbox.apache.org/repos/asf/hadoop.git

commit e99560fdc64ce47d25de97e819040f4d85ee339b
Author: Steve Loughran <st...@apache.org>
AuthorDate: Thu Feb 28 19:42:51 2019 +0000

    HADOOP-16109. Use parameterized tests for the s3a seek contract, with all three seek options checked
    
    Change-Id: Ic379cca760a6683a72f5f35d4f7780dbcba2ac1b
---
 .../contract/s3a/ITestS3AContractRandomSeek.java   | 33 ----------------------
 .../fs/contract/s3a/ITestS3AContractSeek.java      | 28 ++++++++++++++++++
 2 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractRandomSeek.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractRandomSeek.java
deleted file mode 100644
index e1ed976..0000000
--- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractRandomSeek.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.hadoop.fs.contract.s3a;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.s3a.Constants;
-
-public class ITestS3AContractRandomSeek extends ITestS3AContractSeek {
-
-  @Override
-  protected Configuration createConfiguration() {
-    Configuration conf = super.createConfiguration();
-    conf.setInt(Constants.READAHEAD_RANGE, READAHEAD);
-    conf.set(Constants.INPUT_FADVISE, Constants.INPUT_FADV_RANDOM);
-    return conf;
-  }
-}
diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractSeek.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractSeek.java
index d968e54..ed0ae97 100644
--- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractSeek.java
+++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/contract/s3a/ITestS3AContractSeek.java
@@ -18,7 +18,12 @@
 
 package org.apache.hadoop.fs.contract.s3a;
 
+import java.util.Arrays;
+import java.util.Collection;
+
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataInputStream;
@@ -27,15 +32,36 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.contract.AbstractContractSeekTest;
 import org.apache.hadoop.fs.contract.AbstractFSContract;
 import org.apache.hadoop.fs.contract.ContractTestUtils;
+import org.apache.hadoop.fs.s3a.Constants;
 
 import static org.apache.hadoop.fs.s3a.S3ATestUtils.maybeEnableS3Guard;
 
 /**
  * S3A contract tests covering file seek.
  */
+@RunWith(Parameterized.class)
 public class ITestS3AContractSeek extends AbstractContractSeekTest {
 
   protected static final int READAHEAD = 1024;
+
+  private final String seekPolicy;
+
+  /**
+   * Test array for parameterized test runs.
+   * @return a list of parameter tuples.
+   */
+  @Parameterized.Parameters
+  public static Collection<Object[]> params() {
+    return Arrays.asList(new Object[][]{
+        {Constants.INPUT_FADV_RANDOM},
+        {Constants.INPUT_FADV_NORMAL},
+        {Constants.INPUT_FADV_SEQUENTIAL},
+    });
+  }
+
+  public ITestS3AContractSeek(final String seekPolicy) {
+    this.seekPolicy = seekPolicy;
+  }
   
   /**
    * Create a configuration, possibly patching in S3Guard options.
@@ -46,6 +72,8 @@ public class ITestS3AContractSeek extends AbstractContractSeekTest {
     Configuration conf = super.createConfiguration();
     // patch in S3Guard options
     maybeEnableS3Guard(conf);
+    conf.setInt(Constants.READAHEAD_RANGE, READAHEAD);
+    conf.set(Constants.INPUT_FADVISE, seekPolicy);
     return conf;
   }
 


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