You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by nt...@apache.org on 2017/12/08 15:42:18 UTC

ignite git commit: IGNITE-7052 S3 IP finder: add an ability to provide endpoint address. This closes #3179.

Repository: ignite
Updated Branches:
  refs/heads/master 3c20b0e4e -> 93e133c5b


IGNITE-7052 S3 IP finder: add an ability to provide endpoint address. This closes #3179.

Signed-off-by: nikolay_tikhonov <nt...@gridgain.com>


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/93e133c5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/93e133c5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/93e133c5

Branch: refs/heads/master
Commit: 93e133c5bc4e69f2b7571e33c3d4dc4ecc3f68db
Parents: 3c20b0e
Author: Alexey Popov <ta...@gmail.com>
Authored: Fri Dec 8 18:42:08 2017 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Dec 8 18:42:08 2017 +0300

----------------------------------------------------------------------
 .../spi/checkpoint/s3/S3CheckpointSpi.java      | 37 ++++++++++++
 .../spi/checkpoint/s3/S3CheckpointSpiMBean.java |  6 ++
 .../tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java | 28 ++++++++-
 .../s3/S3CheckpointManagerSelfTest.java         |  2 +-
 .../checkpoint/s3/S3CheckpointSpiSelfTest.java  | 26 ++++++++-
 ...pointSpiStartStopBucketEndpointSelfTest.java | 50 ++++++++++++++++
 .../s3/S3CheckpointSpiStartStopSelfTest.java    |  2 +-
 .../s3/S3SessionCheckpointSelfTest.java         |  2 +-
 .../TcpDiscoveryS3IpFinderAbstractSelfTest.java | 48 +++++++++++++--
 ...3IpFinderAwsCredentialsProviderSelfTest.java |  1 +
 ...scoveryS3IpFinderAwsCredentialsSelfTest.java |  1 +
 ...scoveryS3IpFinderBucketEndpointSelfTest.java | 61 ++++++++++++++++++++
 .../ignite/testsuites/IgniteS3TestSuite.java    |  4 ++
 13 files changed, 257 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/93e133c5/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java b/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java
index 2330ef3..195e69e 100644
--- a/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java
+++ b/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java
@@ -74,6 +74,7 @@ import org.jetbrains.annotations.Nullable;
  * <ul>
  * <li>{@link #setBucketNameSuffix(String)}</li>
  * <li>{@link #setClientConfiguration(ClientConfiguration)}</li>
+ * <li>{@link #setBucketEndpoint(String)}</li>
  * </ul>
  * <h2 class="header">Java Example</h2>
  * {@link S3CheckpointSpi} can be configured as follows:
@@ -155,6 +156,9 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi {
     /** Bucket name (generated). */
     private String bucketName;
 
+    /** Bucket endpoint (set by user). */
+    private @Nullable String bucketEndpoint;
+
     /** Amazon client configuration. */
     private ClientConfiguration cfg;
 
@@ -175,6 +179,15 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi {
     }
 
     /**
+     * Gets S3 bucket endpoint to use.
+     *
+     * @return S3 bucket endpoint to use.
+     */
+    public @Nullable String getBucketEndpoint() {
+        return bucketEndpoint;
+    }
+
+    /**
      * Gets S3 access key.
      *
      * @return S3 access key.
@@ -242,6 +255,22 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi {
     }
 
     /**
+     * Sets bucket endpoint.
+     * If the endpoint is not set then S3CheckpointSpi will go to each region to find a corresponding bucket.
+     * For information about possible endpoint names visit
+     * <a href="http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region">docs.aws.amazon.com</a>
+     *
+     * @param bucketEndpoint Bucket endpoint, for example, {@code }s3.us-east-2.amazonaws.com.
+     * @return {@code this} for chaining.
+     */
+    @IgniteSpiConfiguration(optional = true)
+    public S3CheckpointSpi setBucketEndpoint(String bucketEndpoint) {
+        this.bucketEndpoint = bucketEndpoint;
+
+        return this;
+    }
+
+    /**
      * Sets Amazon client configuration.
      * <p>
      * For details refer to Amazon S3 API reference.
@@ -298,6 +327,9 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi {
 
         s3 = cfg != null ? new AmazonS3Client(cred, cfg) : new AmazonS3Client(cred);
 
+        if (!F.isEmpty(bucketEndpoint))
+            s3.setEndpoint(bucketEndpoint);
+
         if (!s3.doesBucketExist(bucketName)) {
             try {
                 s3.createBucket(bucketName);
@@ -735,6 +767,11 @@ public class S3CheckpointSpi extends IgniteSpiAdapter implements CheckpointSpi {
         }
 
         /** {@inheritDoc} */
+        @Override public String getBucketEndpoint() {
+            return S3CheckpointSpi.this.getBucketName();
+        }
+
+        /** {@inheritDoc} */
         @Override public String getAccessKey() {
             return S3CheckpointSpi.this.getAccessKey();
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/93e133c5/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiMBean.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiMBean.java b/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiMBean.java
index 5c7c8a5d..032e066 100644
--- a/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiMBean.java
+++ b/modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiMBean.java
@@ -34,6 +34,12 @@ public interface S3CheckpointSpiMBean extends IgniteSpiManagementMBean {
     public String getBucketName();
 
     /**
+     * @return S3 bucket endpoint.
+     */
+    @MXBeanDescription("S3 bucket endpoint.")
+    public String getBucketEndpoint();
+
+    /**
      * @return S3 access key.
      */
     @MXBeanDescription("S3 access key.")

http://git-wip-us.apache.org/repos/asf/ignite/blob/93e133c5/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java b/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
index 2307a66..dd8c1a8 100644
--- a/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
+++ b/modules/aws/src/main/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinder.java
@@ -44,6 +44,7 @@ import org.apache.ignite.resources.LoggerResource;
 import org.apache.ignite.spi.IgniteSpiConfiguration;
 import org.apache.ignite.spi.IgniteSpiException;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * AWS S3-based IP finder.
@@ -60,6 +61,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter;
  * <ul>
  *      <li>Client configuration (see {@link #setClientConfiguration(ClientConfiguration)})</li>
  *      <li>Shared flag (see {@link #setShared(boolean)})</li>
+ *      <li>Bucket endpoint (see {@link #setBucketEndpoint(String)})</li>
  * </ul>
  * <p>
  * The finder will create S3 bucket with configured name. The bucket will contain entries named
@@ -98,6 +100,9 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
     /** Bucket name. */
     private String bucketName;
 
+    /** Bucket endpoint */
+    private @Nullable String bucketEndpoint;
+
     /** Init guard. */
     @GridToStringExclude
     private final AtomicBoolean initGuard = new AtomicBoolean();
@@ -299,9 +304,14 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
      * @return Client instance to use to connect to AWS.
      */
     private AmazonS3Client createAmazonS3Client() {
-        return cfg != null
+        AmazonS3Client cln = cfg != null
             ? (cred != null ? new AmazonS3Client(cred, cfg) : new AmazonS3Client(credProvider, cfg))
             : (cred != null ? new AmazonS3Client(cred) : new AmazonS3Client(credProvider));
+
+        if (!F.isEmpty(bucketEndpoint))
+            cln.setEndpoint(bucketEndpoint);
+
+        return cln;
     }
 
     /**
@@ -318,6 +328,22 @@ public class TcpDiscoveryS3IpFinder extends TcpDiscoveryIpFinderAdapter {
     }
 
     /**
+     * Sets bucket endpoint for IP finder.
+     * If the endpoint is not set then IP finder will go to each region to find a corresponding bucket.
+     * For information about possible endpoint names visit
+     * <a href="http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region">docs.aws.amazon.com</a>
+     *
+     * @param bucketEndpoint Bucket endpoint, for example, s3.us-east-2.amazonaws.com.
+     * @return {@code this} for chaining.
+     */
+    @IgniteSpiConfiguration(optional = true)
+    public TcpDiscoveryS3IpFinder setBucketEndpoint(String bucketEndpoint) {
+        this.bucketEndpoint = bucketEndpoint;
+
+        return this;
+    }
+
+    /**
      * Sets Amazon client configuration.
      * <p>
      * For details refer to Amazon S3 API reference.

http://git-wip-us.apache.org/repos/asf/ignite/blob/93e133c5/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointManagerSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointManagerSelfTest.java
index 529e4d0..acda385 100644
--- a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointManagerSelfTest.java
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointManagerSelfTest.java
@@ -41,7 +41,7 @@ public class S3CheckpointManagerSelfTest extends GridCheckpointManagerAbstractSe
 
         spi.setAwsCredentials(cred);
 
-        spi.setBucketNameSuffix("unit-test-bucket");
+        spi.setBucketNameSuffix(S3CheckpointSpiSelfTest.getBucketNameSuffix());
 
         cfg.setCheckpointSpi(spi);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/93e133c5/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiSelfTest.java
index 23abe06..cb38083 100644
--- a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiSelfTest.java
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiSelfTest.java
@@ -24,6 +24,9 @@ import com.amazonaws.services.s3.AmazonS3;
 import com.amazonaws.services.s3.AmazonS3Client;
 import com.amazonaws.services.s3.model.ObjectListing;
 import com.amazonaws.services.s3.model.S3ObjectSummary;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.concurrent.ThreadLocalRandom;
 import org.apache.ignite.GridTestIoUtils;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -55,7 +58,7 @@ public class S3CheckpointSpiSelfTest extends GridSpiAbstractTest<S3CheckpointSpi
 
         spi.setAwsCredentials(cred);
 
-        spi.setBucketNameSuffix("unit-test-bucket");
+        spi.setBucketNameSuffix(getBucketNameSuffix());
 
         super.spiConfigure(spi);
     }
@@ -222,4 +225,25 @@ public class S3CheckpointSpiSelfTest extends GridSpiAbstractTest<S3CheckpointSpi
     private void assertWithRetries(GridAbsClosureX assertion) throws IgniteInterruptedCheckedException {
         GridTestUtils.retryAssert(log, 6, 5000, assertion);
     }
+
+    /**
+     * Gets a Bucket name suffix
+     * Bucket name suffix should be unique for the host to parallel test run on one bucket.
+     * Please note that the final bucket name should not exceed 63 chars.
+     *
+     * @return Bucket name suffix.
+     */
+    static String getBucketNameSuffix() {
+        String bucketNameSuffix;
+        try {
+            bucketNameSuffix = IgniteS3TestSuite.getBucketName(
+                "unit-test-" + InetAddress.getLocalHost().getHostName().toLowerCase());
+        }
+        catch (UnknownHostException e) {
+            bucketNameSuffix = IgniteS3TestSuite.getBucketName(
+                "unit-test-rnd-" + ThreadLocalRandom.current().nextInt(100));
+        }
+
+        return bucketNameSuffix;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/93e133c5/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopBucketEndpointSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopBucketEndpointSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopBucketEndpointSelfTest.java
new file mode 100644
index 0000000..a50b7a3
--- /dev/null
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopBucketEndpointSelfTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.ignite.spi.checkpoint.s3;
+
+import com.amazonaws.auth.AWSCredentials;
+import com.amazonaws.auth.BasicAWSCredentials;
+import org.apache.ignite.spi.GridSpiStartStopAbstractTest;
+import org.apache.ignite.testframework.junits.spi.GridSpiTest;
+import org.apache.ignite.testsuites.IgniteIgnore;
+import org.apache.ignite.testsuites.IgniteS3TestSuite;
+
+/**
+ * Grid S3 checkpoint SPI start stop self test.
+ */
+@GridSpiTest(spi = S3CheckpointSpi.class, group = "Checkpoint SPI")
+public class S3CheckpointSpiStartStopBucketEndpointSelfTest extends GridSpiStartStopAbstractTest<S3CheckpointSpi> {
+
+    /** {@inheritDoc} */
+    @Override protected void spiConfigure(S3CheckpointSpi spi) throws Exception {
+        AWSCredentials cred = new BasicAWSCredentials(IgniteS3TestSuite.getAccessKey(),
+            IgniteS3TestSuite.getSecretKey());
+
+        spi.setAwsCredentials(cred);
+        spi.setBucketNameSuffix(S3CheckpointSpiSelfTest.getBucketNameSuffix() + "-e");
+        spi.setBucketEndpoint("s3.us-east-2.amazonaws.com");
+
+        super.spiConfigure(spi);
+    }
+
+    /** {@inheritDoc} */
+    @IgniteIgnore("https://issues.apache.org/jira/browse/IGNITE-2420")
+    @Override public void testStartStop() throws Exception {
+        super.testStartStop();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/93e133c5/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopSelfTest.java
index c26897f..a062b51 100644
--- a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopSelfTest.java
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpiStartStopSelfTest.java
@@ -36,7 +36,7 @@ public class S3CheckpointSpiStartStopSelfTest extends GridSpiStartStopAbstractTe
 
         spi.setAwsCredentials(cred);
 
-        spi.setBucketNameSuffix("unit-test-bucket");
+        spi.setBucketNameSuffix(S3CheckpointSpiSelfTest.getBucketNameSuffix());
 
         super.spiConfigure(spi);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/93e133c5/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3SessionCheckpointSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3SessionCheckpointSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3SessionCheckpointSelfTest.java
index c1290a4..54a7910 100644
--- a/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3SessionCheckpointSelfTest.java
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/checkpoint/s3/S3SessionCheckpointSelfTest.java
@@ -43,7 +43,7 @@ public class S3SessionCheckpointSelfTest extends GridSessionCheckpointAbstractSe
 
         spi.setAwsCredentials(cred);
 
-        spi.setBucketNameSuffix("unit-test-bucket");
+        spi.setBucketNameSuffix(S3CheckpointSpiSelfTest.getBucketNameSuffix());
 
         cfg.setCheckpointSpi(spi);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/93e133c5/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAbstractSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAbstractSelfTest.java
index d17416f..89a44be 100644
--- a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAbstractSelfTest.java
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAbstractSelfTest.java
@@ -19,7 +19,9 @@ package org.apache.ignite.spi.discovery.tcp.ipfinder.s3;
 
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
 import java.util.Collection;
+import java.util.concurrent.ThreadLocalRandom;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAbstractSelfTest;
 import org.apache.ignite.testsuites.IgniteIgnore;
@@ -35,7 +37,7 @@ abstract class TcpDiscoveryS3IpFinderAbstractSelfTest
      *
      * @throws Exception If any error occurs.
      */
-    protected TcpDiscoveryS3IpFinderAbstractSelfTest() throws Exception {
+    TcpDiscoveryS3IpFinderAbstractSelfTest() throws Exception {
     }
 
     /** {@inheritDoc} */
@@ -47,11 +49,8 @@ abstract class TcpDiscoveryS3IpFinderAbstractSelfTest
         assert finder.isShared() : "Ip finder should be shared by default.";
 
         setAwsCredentials(finder);
-
-        // Bucket name should be unique for the host to parallel test run on one bucket.
-        String bucketName = IgniteS3TestSuite.getBucketName(
-            "ip-finder-unit-test-bucket-" + InetAddress.getLocalHost().getAddress()[3]);
-        finder.setBucketName(bucketName);
+        setBucketEndpoint(finder);
+        setBucketName(finder);
 
         for (int i = 0; i < 5; i++) {
             Collection<InetSocketAddress> addrs = finder.getRegisteredAddresses();
@@ -81,4 +80,41 @@ abstract class TcpDiscoveryS3IpFinderAbstractSelfTest
      * @param finder finder credentials to set into
      */
     protected abstract void setAwsCredentials(TcpDiscoveryS3IpFinder finder);
+
+    /**
+     * Set Bucket endpoint into the provided {@code finder}.
+     * @param finder finder endpoint to set into.
+     */
+    protected void setBucketEndpoint(TcpDiscoveryS3IpFinder finder) {
+        // No-op.
+    }
+
+    /**
+     * Set Bucket endpoint into the provided {@code finder}.
+     * @param finder finder endpoint to set into.
+     */
+    protected void setBucketName(TcpDiscoveryS3IpFinder finder) {
+        finder.setBucketName(getBucketName());
+    }
+
+    /**
+     * Gets Bucket name.
+     * Bucket name should be unique for the host to parallel test run on one bucket.
+     * Please note that the final bucket name should not exceed 63 chars.
+     *
+     * @return Bucket name.
+     */
+    static String getBucketName() {
+        String bucketName;
+        try {
+            bucketName = IgniteS3TestSuite.getBucketName(
+                "ip-finder-unit-test-" + InetAddress.getLocalHost().getHostName().toLowerCase());
+        }
+        catch (UnknownHostException e) {
+            bucketName = IgniteS3TestSuite.getBucketName(
+                "ip-finder-unit-test-rnd-" + ThreadLocalRandom.current().nextInt(100));
+        }
+
+        return bucketName;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/93e133c5/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java
index ea316c4..9ff5571 100644
--- a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.java
@@ -40,6 +40,7 @@ public class TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest extends TcpDis
             new BasicAWSCredentials(IgniteS3TestSuite.getAccessKey(), IgniteS3TestSuite.getSecretKey())));
     }
 
+    /** {@inheritDoc} */
     @Override public void testIpFinder() throws Exception {
         super.testIpFinder();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/93e133c5/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsSelfTest.java
index 7447378..5bea251 100644
--- a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsSelfTest.java
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderAwsCredentialsSelfTest.java
@@ -39,6 +39,7 @@ public class TcpDiscoveryS3IpFinderAwsCredentialsSelfTest extends TcpDiscoveryS3
             IgniteS3TestSuite.getSecretKey()));
     }
 
+    /** {@inheritDoc} */
     @Override public void testIpFinder() throws Exception {
         super.testIpFinder();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/93e133c5/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderBucketEndpointSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderBucketEndpointSelfTest.java b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderBucketEndpointSelfTest.java
new file mode 100644
index 0000000..9eda351
--- /dev/null
+++ b/modules/aws/src/test/java/org/apache/ignite/spi/discovery/tcp/ipfinder/s3/TcpDiscoveryS3IpFinderBucketEndpointSelfTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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.ignite.spi.discovery.tcp.ipfinder.s3;
+
+import com.amazonaws.auth.BasicAWSCredentials;
+import org.apache.ignite.testsuites.IgniteS3TestSuite;
+
+/**
+ * TcpDiscoveryS3IpFinder test using AWS credentials and selected bucket endpoint
+ * Possible endpoints are here: http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region.
+ */
+public class TcpDiscoveryS3IpFinderBucketEndpointSelfTest extends TcpDiscoveryS3IpFinderAbstractSelfTest {
+    /**
+     * Constructor.
+     *
+     * @throws Exception If any error occurs.
+     */
+    public TcpDiscoveryS3IpFinderBucketEndpointSelfTest() throws Exception {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void setAwsCredentials(TcpDiscoveryS3IpFinder finder) {
+        finder.setAwsCredentials(new BasicAWSCredentials(IgniteS3TestSuite.getAccessKey(),
+            IgniteS3TestSuite.getSecretKey()));
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void setBucketEndpoint(TcpDiscoveryS3IpFinder finder) {
+        super.setBucketEndpoint(finder);
+
+        finder.setBucketEndpoint("s3.us-east-2.amazonaws.com");
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void setBucketName(TcpDiscoveryS3IpFinder finder) {
+        super.setBucketName(finder);
+
+        finder.setBucketName(getBucketName() + "-e");
+    }
+
+    /** {@inheritDoc} */
+    @Override public void testIpFinder() throws Exception {
+        super.testIpFinder();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/93e133c5/modules/aws/src/test/java/org/apache/ignite/testsuites/IgniteS3TestSuite.java
----------------------------------------------------------------------
diff --git a/modules/aws/src/test/java/org/apache/ignite/testsuites/IgniteS3TestSuite.java b/modules/aws/src/test/java/org/apache/ignite/testsuites/IgniteS3TestSuite.java
index a703c66..009916b 100644
--- a/modules/aws/src/test/java/org/apache/ignite/testsuites/IgniteS3TestSuite.java
+++ b/modules/aws/src/test/java/org/apache/ignite/testsuites/IgniteS3TestSuite.java
@@ -21,10 +21,12 @@ import junit.framework.TestSuite;
 import org.apache.ignite.spi.checkpoint.s3.S3CheckpointManagerSelfTest;
 import org.apache.ignite.spi.checkpoint.s3.S3CheckpointSpiConfigSelfTest;
 import org.apache.ignite.spi.checkpoint.s3.S3CheckpointSpiSelfTest;
+import org.apache.ignite.spi.checkpoint.s3.S3CheckpointSpiStartStopBucketEndpointSelfTest;
 import org.apache.ignite.spi.checkpoint.s3.S3CheckpointSpiStartStopSelfTest;
 import org.apache.ignite.spi.checkpoint.s3.S3SessionCheckpointSelfTest;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinderAwsCredentialsSelfTest;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.s3.TcpDiscoveryS3IpFinderBucketEndpointSelfTest;
 import org.apache.ignite.testframework.IgniteTestSuite;
 
 /**
@@ -44,10 +46,12 @@ public class IgniteS3TestSuite extends TestSuite {
         suite.addTestSuite(S3CheckpointSpiStartStopSelfTest.class);
         suite.addTestSuite(S3CheckpointManagerSelfTest.class);
         suite.addTestSuite(S3SessionCheckpointSelfTest.class);
+        suite.addTestSuite(S3CheckpointSpiStartStopBucketEndpointSelfTest.class);
 
         // S3 IP finder.
         suite.addTestSuite(TcpDiscoveryS3IpFinderAwsCredentialsSelfTest.class);
         suite.addTestSuite(TcpDiscoveryS3IpFinderAwsCredentialsProviderSelfTest.class);
+        suite.addTestSuite(TcpDiscoveryS3IpFinderBucketEndpointSelfTest.class);
 
         return suite;
     }