Package org.apache.flink.testutils.s3
Class S3TestCredentials
- java.lang.Object
-
- org.apache.flink.testutils.s3.S3TestCredentials
-
public class S3TestCredentials extends Object
Access to credentials to access S3 buckets during integration tests.
-
-
Constructor Summary
Constructors Constructor Description S3TestCredentials()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassumeCredentialsAvailable()Checks whether an S3 test bucket is configured in the environment variables of this JVM.static voidassumeStaticCredentialsAvailable()Checks whether static access/secret keys are available.static StringgetS3AccessKey()Gets the S3 Access Key.static StringgetS3SecretKey()Gets the S3 Secret Key.static StringgetTestBucketUri()Gets the URI for the path under which all tests should put their data.static StringgetTestBucketUriWithScheme(String scheme)Gets the URI for the path under which all tests should put their data.static booleanhasStaticCredentials()Checks whether static access/secret keys are configured.
-
-
-
Method Detail
-
hasStaticCredentials
public static boolean hasStaticCredentials()
Checks whether static access/secret keys are configured. When they are not, tests should leave credentials to the default AWS provider chain instead of pinning keys into config.
-
assumeCredentialsAvailable
public static void assumeCredentialsAvailable()
Checks whether an S3 test bucket is configured in the environment variables of this JVM. If not, throws anAssumptionViolatedExceptionwhich causes JUnit tests to be skipped. This does not check for static access/secret keys; tests that need them should useassumeStaticCredentialsAvailable().
-
assumeStaticCredentialsAvailable
public static void assumeStaticCredentialsAvailable()
Checks whether static access/secret keys are available. If not, throws anAssumptionViolatedExceptionso JUnit skips tests that specifically require static keys (e.g. credential-key forwarding tests) rather than the default AWS provider chain.
-
getS3AccessKey
public static String getS3AccessKey()
Gets the S3 Access Key.This method throws an exception if the key is not available, which is the case in keyless runs where only the bucket is set. Tests should check
hasStaticCredentials()or useassumeStaticCredentialsAvailable()first.
-
getS3SecretKey
public static String getS3SecretKey()
Gets the S3 Secret Key.This method throws an exception if the key is not available, which is the case in keyless runs where only the bucket is set. Tests should check
hasStaticCredentials()or useassumeStaticCredentialsAvailable()first.
-
getTestBucketUri
public static String getTestBucketUri()
Gets the URI for the path under which all tests should put their data.This method throws an exception if the bucket was not configured. Tests should use
assumeCredentialsAvailable()to skip tests when no bucket is configured.
-
getTestBucketUriWithScheme
public static String getTestBucketUriWithScheme(String scheme)
Gets the URI for the path under which all tests should put their data.This method throws an exception if the bucket was not configured. Tests should use
assumeCredentialsAvailable()to skip tests when no bucket is configured.
-
-