Repository: hadoop Updated Branches: refs/heads/HADOOP-13345 85148a705 -> 35e4bcd43
HADOOP-14467. S3Guard: Improve FNFE message when opening a stream. Contributed by Aaron Fabbri. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/35e4bcd4 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/35e4bcd4 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/35e4bcd4 Branch: refs/heads/HADOOP-13345 Commit: 35e4bcd4330dc9d544970bfeba9d68da674b94ec Parents: 85148a7 Author: Steve Loughran <ste...@apache.org> Authored: Wed Aug 9 17:05:56 2017 +0100 Committer: Steve Loughran <ste...@apache.org> Committed: Wed Aug 9 17:05:56 2017 +0100 ---------------------------------------------------------------------- .../hadoop/fs/s3a/ITestS3ADelayedFNF.java | 55 ++++++++++++++++++++ .../org/apache/hadoop/fs/s3a/S3ATestUtils.java | 2 +- 2 files changed, 56 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/35e4bcd4/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ADelayedFNF.java ---------------------------------------------------------------------- diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ADelayedFNF.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ADelayedFNF.java new file mode 100644 index 0000000..60bfa23 --- /dev/null +++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3ADelayedFNF.java @@ -0,0 +1,55 @@ +/* + * 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.s3a; + +import org.apache.hadoop.fs.FSDataInputStream; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.contract.ContractTestUtils; +import org.apache.hadoop.test.LambdaTestUtils; +import org.junit.Test; + +import java.io.FileNotFoundException; + +/** + * Tests behavior of a FileNotFound error that happens after open(), i.e. on + * the first read. + */ +public class ITestS3ADelayedFNF extends AbstractS3ATestBase { + + + /** + * See debugging documentation + * <a href="https://cwiki.apache.org/confluence/display/HADOOP/S3A%3A+FileNotFound+Exception+on+Read">here</a>. + * @throws Exception + */ + @Test + public void testNotFoundFirstRead() throws Exception { + FileSystem fs = getFileSystem(); + Path p = path("some-file"); + ContractTestUtils.createFile(fs, p, false, new byte[] {20, 21, 22}); + + FSDataInputStream in = fs.open(p); + assertDeleted(p, false); + + // This should fail since we deleted after the open. + LambdaTestUtils.intercept(FileNotFoundException.class, () -> in.read()); + } + +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/35e4bcd4/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java ---------------------------------------------------------------------- diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java index f46f9ba..cb73323 100644 --- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java +++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java @@ -330,7 +330,7 @@ public final class S3ATestUtils { } /** - * Assume testing S3Guard is not enabled. + * Test assumption that S3Guard is/is not enabled. */ public static void assumeS3GuardState(boolean shouldBeEnabled, Configuration originalConf) throws URISyntaxException { --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org