Add mint tests into MinIO repo (#7886)

This commit is contained in:
Harshavardhana
2019-07-09 18:32:39 -07:00
committed by GitHub
parent 2d96745156
commit 1dc25bcf5f
73 changed files with 7949 additions and 8 deletions

View File

@@ -0,0 +1,19 @@
#!/bin/bash -e
#
# Mint (C) 2017 Minio, Inc.
#
# Licensed 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.
#
test_run_dir="$MINT_RUN_CORE_DIR/aws-sdk-go"
GO111MODULE=on go build -o "$test_run_dir/aws-sdk-go" "$test_run_dir/quick-tests.go"

View File

@@ -0,0 +1,58 @@
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="aws-sdk-java-tests" default="run">
<property name="ivy.install.version" value="2.1.0-rc2" />
<condition property="ivy.home" value="${env.IVY_HOME}">
<isset property="env.IVY_HOME" />
</condition>
<property name="ivy.home" value="${user.home}/.ant" />
<property name="ivy.jar.dir" value="${ivy.home}/lib" />
<property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar" />
<target name="download-ivy" unless="offline">
<mkdir dir="${ivy.jar.dir}"/>
<get src="https://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<target name="init-ivy" depends="download-ivy">
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="resolve" description="--> retrieve dependencies with ivy">
<ivy:retrieve />
</target>
<target name="clean">
<delete dir="build"/>
</target>
<path id="aws-s3-sdk-deps">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
</path>
<target name="compile">
<mkdir dir="build/classes"/>
<javac srcdir="src" destdir="build/classes">
<classpath refid="aws-s3-sdk-deps" />
</javac>
</target>
<target name="jar">
<mkdir dir="build/jar"/>
<jar destfile="build/jar/FunctionalTests.jar" basedir="build/classes">
<archives>
<zips>
<fileset dir="lib/" includes="*.jar"/>
</zips>
</archives>
<manifest>
<attribute name="Main-Class" value="io.minio.awssdk.tests.FunctionalTests"/>
</manifest>
</jar>
</target>
</project>

View File

@@ -0,0 +1,30 @@
#!/bin/bash -e
#
# Mint (C) 2017 Minio, Inc.
#
# Licensed 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.
#
test_run_dir="$MINT_RUN_CORE_DIR/aws-sdk-java"
cd "$(dirname "$(realpath "$0")")"
ant init-ivy && \
ant resolve && \
ant compile && \
ant jar
cp build/jar/FunctionalTests.jar "$test_run_dir/"
rm -rf lib/ build/

View File

@@ -0,0 +1,6 @@
<ivy-module version="2.0">
<info organisation="org.apache" module="aws-sdk-java-tests"/>
<dependencies>
<dependency org="com.amazonaws" name="aws-java-sdk-s3" rev="1.11.289"/>
</dependencies>
</ivy-module>

View File

@@ -0,0 +1,632 @@
/*
* Mint, (C) 2018 Minio, Inc.
*
* Licensed 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 io.minio.awssdk.tests;
import java.io.*;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.*;
import java.util.*;
import java.nio.file.*;
import java.math.BigInteger;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.BasicAWSCredentials;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.CreateBucketRequest;
import com.amazonaws.services.s3.model.ObjectListing;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.amazonaws.services.s3.model.SSECustomerKey;
// Main Testing class
public class FunctionalTests {
private static final String PASS = "PASS";
private static final String FAILED = "FAIL";
private static final String IGNORED = "NA";
private static String accessKey;
private static String secretKey;
private static String region;
private static String endpoint;
private static boolean enableHTTPS;
private static final Random random = new Random(new SecureRandom().nextLong());
private static String bucketName = getRandomName();
private static boolean mintEnv = false;
private static String file1Kb;
private static String file1Mb;
private static String file6Mb;
private static SSECustomerKey sseKey1;
private static SSECustomerKey sseKey2;
private static SSECustomerKey sseKey3;
private static AmazonS3 s3Client;
private static S3TestUtils s3TestUtils;
public static String getRandomName() {
return "aws-java-sdk-test-" + new BigInteger(32, random).toString(32);
}
/**
* Prints a success log entry in JSON format.
*/
public static void mintSuccessLog(String function, String args, long startTime) {
if (mintEnv) {
System.out.println(
new MintLogger(function, args, System.currentTimeMillis() - startTime, PASS, null, null, null));
}
}
/**
* Prints a failure log entry in JSON format.
*/
public static void mintFailedLog(String function, String args, long startTime, String message, String error) {
if (mintEnv) {
System.out.println(new MintLogger(function, args, System.currentTimeMillis() - startTime, FAILED, null,
message, error));
}
}
/**
* Prints a ignore log entry in JSON format.
*/
public static void mintIgnoredLog(String function, String args, long startTime) {
if (mintEnv) {
System.out.println(
new MintLogger(function, args, System.currentTimeMillis() - startTime, IGNORED, null, null, null));
}
}
public static void initTests() throws IOException {
// Create encryption key.
byte[] rawKey1 = "32byteslongsecretkeymustgenerate".getBytes();
SecretKey secretKey1 = new SecretKeySpec(rawKey1, 0, rawKey1.length, "AES");
sseKey1 = new SSECustomerKey(secretKey1);
// Create new encryption key for target so it is saved using sse-c
byte[] rawKey2 = "xxbytescopysecretkeymustprovided".getBytes();
SecretKey secretKey2 = new SecretKeySpec(rawKey2, 0, rawKey2.length, "AES");
sseKey2 = new SSECustomerKey(secretKey2);
// Create new encryption key for target so it is saved using sse-c
byte[] rawKey3 = "32byteslongsecretkeymustgenerat1".getBytes();
SecretKey secretKey3 = new SecretKeySpec(rawKey3, 0, rawKey3.length, "AES");
sseKey3 = new SSECustomerKey(secretKey3);
// Create bucket
s3Client.createBucket(new CreateBucketRequest(bucketName));
}
public static void teardown() throws IOException {
// Remove all objects under the test bucket & the bucket itself
// TODO: use multi delete API instead
ObjectListing objectListing = s3Client.listObjects(bucketName);
while (true) {
for (Iterator<?> iterator = objectListing.getObjectSummaries().iterator(); iterator.hasNext();) {
S3ObjectSummary summary = (S3ObjectSummary) iterator.next();
s3Client.deleteObject(bucketName, summary.getKey());
}
// more objectListing to retrieve?
if (objectListing.isTruncated()) {
objectListing = s3Client.listNextBatchOfObjects(objectListing);
} else {
break;
}
}
;
s3Client.deleteBucket(bucketName);
}
// Test regular object upload using encryption
public static void uploadObjectEncryption_test1() throws Exception {
if (!mintEnv) {
System.out.println(
"Test: uploadObject(String bucketName, String objectName, String f, SSECustomerKey sseKey)");
}
if (!enableHTTPS) {
return;
}
long startTime = System.currentTimeMillis();
String file1KbMD5 = Utils.getFileMD5(file1Kb);
String objectName = "testobject";
try {
s3TestUtils.uploadObject(bucketName, objectName, file1Kb, sseKey1);
s3TestUtils.downloadObject(bucketName, objectName, sseKey1, file1KbMD5);
mintSuccessLog("uploadObject(String bucketName, String objectName, String f, SSECustomerKey sseKey)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", String: " + file1Kb
+ ", SSECustomerKey: " + sseKey1,
startTime);
} catch (Exception e) {
mintFailedLog("uploadObject(String bucketName, String objectName, String f, SSECustomerKey sseKey)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", String: " + file1Kb
+ ", SSECustomerKey: " + sseKey1,
startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace()));
throw e;
}
}
// Test downloading an object with a wrong encryption key
public static void downloadObjectEncryption_test1() throws Exception {
if (!mintEnv) {
System.out.println("Test: downloadObject(String bucketName, String objectName, SSECustomerKey sseKey)");
}
if (!enableHTTPS) {
return;
}
long startTime = System.currentTimeMillis();
String file1KbMD5 = Utils.getFileMD5(file1Kb);
String objectName = "testobject";
try {
s3TestUtils.uploadObject(bucketName, "testobject", file1Kb, sseKey1);
s3TestUtils.downloadObject(bucketName, objectName, sseKey2);
Exception ex = new Exception("downloadObject did not throw an S3 Access denied exception");
mintFailedLog("downloadObject(String bucketName, String objectName, SSECustomerKey sseKey)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey2,
startTime, null, ex.toString() + " >>> " + Arrays.toString(ex.getStackTrace()));
throw ex;
} catch (Exception e) {
if (!e.getMessage().contains("Access Denied")) {
Exception ex = new Exception(
"downloadObject did not throw S3 Access denied Exception but it did throw: " + e.getMessage());
mintFailedLog("downloadObject(String bucketName, String objectName, SSECustomerKey sseKey)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey2,
startTime, null, ex.toString() + " >>> " + Arrays.toString(ex.getStackTrace()));
throw ex;
}
mintSuccessLog("downloadObject(String bucketName, String objectName, SSECustomerKey sseKey)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey2,
startTime);
}
}
// Test copying object with a new different encryption key
public static void copyObjectEncryption_test1() throws Exception {
if (!mintEnv) {
System.out.println("Test: copyObject(String bucketName, String objectName, SSECustomerKey sseKey, "
+ "String destBucketName, String dstObjectName, SSECustomerKey sseKey2, boolean replaceDirective)");
}
if (!enableHTTPS) {
return;
}
long startTime = System.currentTimeMillis();
String file1KbMD5 = Utils.getFileMD5(file1Kb);
String objectName = "testobject";
String dstObjectName = "dir/newobject";
try {
s3TestUtils.uploadObject(bucketName, objectName, file1Kb, sseKey1);
s3TestUtils.copyObject(bucketName, objectName, sseKey1, bucketName, dstObjectName, sseKey2, false);
s3TestUtils.downloadObject(bucketName, dstObjectName, sseKey2, file1KbMD5);
} catch (Exception e) {
mintFailedLog("copyObject(String bucketName, String objectName, SSECustomerKey sseKey, "
+ "String destBucketName, String dstObjectName, SSECustomerKey sseKey2, boolean replaceDirective)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ "DstbucketName: " + bucketName + ", DstObjectName: " + dstObjectName
+ ", SSECustomerKey: " + sseKey2 + ", replaceDirective: " + false,
startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace()));
throw e;
}
mintSuccessLog("copyObject(String bucketName, String objectName, SSECustomerKey sseKey, "
+ "String destBucketName, String dstObjectName, SSECustomerKey sseKey2, boolean replaceDirective)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ "DstbucketName: " + bucketName + ", DstObjectName: " + dstObjectName + ", SSECustomerKey: "
+ sseKey2 + ", replaceDirective: " + false,
startTime);
}
// Test copying object with wrong source encryption key
public static void copyObjectEncryption_test2() throws Exception {
if (!mintEnv) {
System.out.println("Test: copyObject(String bucketName, String objectName, SSECustomerKey sseKey, "
+ "String destBucketName, String dstObjectName, SSECustomerKey sseKey2, boolean replaceDirective)");
}
if (!enableHTTPS) {
return;
}
String objectName = "testobject";
String dstObjectName = "dir/newobject";
long startTime = System.currentTimeMillis();
try {
s3TestUtils.copyObject(bucketName, objectName, sseKey3, bucketName, dstObjectName, sseKey2, false);
Exception ex = new Exception("copyObject did not throw an S3 Access denied exception");
mintFailedLog("copyObject(String bucketName, String objectName, SSECustomerKey sseKey, "
+ "String destBucketName, String dstObjectName, SSECustomerKey sseKey2, boolean replaceDirective)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey3
+ "DstbucketName: " + bucketName + ", DstObjectName: " + dstObjectName
+ ", SSECustomerKey: " + sseKey2 + ", replaceDirective: " + false,
startTime, null, ex.toString() + " >>> " + Arrays.toString(ex.getStackTrace()));
throw ex;
} catch (Exception e) {
if (!e.getMessage().contains("Access Denied")) {
Exception ex = new Exception(
"copyObject did not throw S3 Access denied Exception but it did throw: " + e.getMessage());
mintFailedLog("copyObject(String bucketName, String objectName, SSECustomerKey sseKey, "
+ "String destBucketName, String dstObjectName, SSECustomerKey sseKey2, boolean replaceDirective)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey3
+ "DstbucketName: " + bucketName + ", DstObjectName: " + dstObjectName
+ ", SSECustomerKey: " + sseKey2 + ", replaceDirective: " + false,
startTime, null, ex.toString() + " >>> " + Arrays.toString(ex.getStackTrace()));
throw ex;
}
mintSuccessLog("copyObject(String bucketName, String objectName, SSECustomerKey sseKey, "
+ "String destBucketName, String dstObjectName, SSECustomerKey sseKey2, boolean replaceDirective)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey3
+ "DstbucketName: " + bucketName + ", DstObjectName: " + dstObjectName
+ ", SSECustomerKey: " + sseKey2 + ", replaceDirective: " + false,
startTime);
}
}
// Test copying multipart object
public static void copyObjectEncryption_test3() throws Exception {
if (!mintEnv) {
System.out.println("Test: copyObject(String bucketName, String objectName, SSECustomerKey sseKey, "
+ "String destBucketName, String dstObjectName, SSECustomerKey sseKey2, boolean replaceDirective)");
}
if (!enableHTTPS) {
return;
}
long startTime = System.currentTimeMillis();
String file6MbMD5 = Utils.getFileMD5(file6Mb);
String objectName = "testobject";
String dstObjectName = "dir/newobject";
try {
s3TestUtils.uploadMultipartObject(bucketName, objectName, file6Mb, sseKey1);
s3TestUtils.copyObject(bucketName, objectName, sseKey1, bucketName, dstObjectName, sseKey2, false);
s3TestUtils.downloadObject(bucketName, dstObjectName, sseKey2, file6MbMD5);
} catch (Exception e) {
mintFailedLog("copyObject(String bucketName, String objectName, SSECustomerKey sseKey, "
+ "String destBucketName, String dstObjectName, SSECustomerKey sseKey2, boolean replaceDirective)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ "DstbucketName: " + bucketName + ", DstObjectName: " + dstObjectName
+ ", SSECustomerKey: " + sseKey2 + ", replaceDirective: " + false,
startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace()));
throw e;
}
mintSuccessLog("copyObject(String bucketName, String objectName, SSECustomerKey sseKey, "
+ "String destBucketName, String dstObjectName, SSECustomerKey sseKey2, boolean replaceDirective)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ "DstbucketName: " + bucketName + ", DstObjectName: " + dstObjectName + ", SSECustomerKey: "
+ sseKey2 + ", replaceDirective: " + false,
startTime);
}
// Test downloading encrypted object with Get Range, 0 -> 1024
public static void downloadGetRangeEncryption_test1() throws Exception {
if (!mintEnv) {
System.out.println("Test: downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)");
}
if (!enableHTTPS) {
return;
}
long startTime = System.currentTimeMillis();
String objectName = "testobject";
String range1MD5 = Utils.getFileMD5(file1Kb);
int start = 0;
int length = 1024;
try {
s3TestUtils.uploadObject(bucketName, objectName, file1Kb, sseKey1);
s3TestUtils.downloadObject(bucketName, objectName, sseKey1, range1MD5, start, length);
} catch (Exception e) {
mintFailedLog(
"downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ ", expectedMD5: " + range1MD5 + ", start: " + start + ", length: " + length,
startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace()));
throw e;
}
mintSuccessLog(
"downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ ", expectedMD5: " + range1MD5 + ", start: " + start + ", length: " + length,
startTime);
}
// Test downloading encrypted object with Get Range, 0 -> 1
public static void downloadGetRangeEncryption_test2() throws Exception {
if (!mintEnv) {
System.out.println("Test: downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)");
}
if (!enableHTTPS) {
return;
}
long startTime = System.currentTimeMillis();
String objectName = "testobject";
int start = 0;
int length = 1;
String range1MD5 = Utils.getFileMD5(file1Kb, start, length);
try {
s3TestUtils.uploadObject(bucketName, objectName, file1Kb, sseKey1);
s3TestUtils.downloadObject(bucketName, objectName, sseKey1, range1MD5, start, length);
} catch (Exception e) {
mintFailedLog(
"downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ ", expectedMD5: " + range1MD5 + ", start: " + start + ", length: " + length,
startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace()));
throw e;
}
mintSuccessLog(
"downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ ", expectedMD5: " + range1MD5 + ", start: " + start + ", length: " + length,
startTime);
}
// Test downloading encrypted object with Get Range, 0 -> 1024-1
public static void downloadGetRangeEncryption_test3() throws Exception {
if (!mintEnv) {
System.out.println("Test: downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)");
}
if (!enableHTTPS) {
return;
}
long startTime = System.currentTimeMillis();
String objectName = "testobject";
int start = 0;
int length = 1023;
String range1MD5 = Utils.getFileMD5(file1Kb, start, length);
try {
s3TestUtils.uploadObject(bucketName, objectName, file1Kb, sseKey1);
s3TestUtils.downloadObject(bucketName, objectName, sseKey1, range1MD5, start, length);
} catch (Exception e) {
mintFailedLog(
"downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ ", expectedMD5: " + range1MD5 + ", start: " + start + ", length: " + length,
startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace()));
throw e;
}
mintSuccessLog(
"downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ ", expectedMD5: " + range1MD5 + ", start: " + start + ", length: " + length,
startTime);
}
// Test downloading encrypted object with Get Range, 1 -> 1024-1
public static void downloadGetRangeEncryption_test4() throws Exception {
if (!mintEnv) {
System.out.println("Test: downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)");
}
if (!enableHTTPS) {
return;
}
long startTime = System.currentTimeMillis();
String objectName = "testobject";
int start = 1;
int length = 1023;
String range1MD5 = Utils.getFileMD5(file1Kb, start, length);
try {
s3TestUtils.uploadObject(bucketName, objectName, file1Kb, sseKey1);
s3TestUtils.downloadObject(bucketName, objectName, sseKey1, range1MD5, start, length);
} catch (Exception e) {
mintFailedLog(
"downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ ", expectedMD5: " + range1MD5 + ", start: " + start + ", length: " + length,
startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace()));
throw e;
}
mintSuccessLog(
"downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ ", expectedMD5: " + range1MD5 + ", start: " + start + ", length: " + length,
startTime);
}
// Test downloading encrypted object with Get Range, 64*1024 -> 64*1024
public static void downloadGetRangeEncryption_test5() throws Exception {
if (!mintEnv) {
System.out.println("Test: downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)");
}
if (!enableHTTPS) {
return;
}
long startTime = System.currentTimeMillis();
String objectName = "testobject";
int start = 64 * 1024;
int length = 64 * 1024;
String range1MD5 = Utils.getFileMD5(file1Mb, start, length);
try {
s3TestUtils.uploadObject(bucketName, objectName, file1Mb, sseKey1);
s3TestUtils.downloadObject(bucketName, objectName, sseKey1, range1MD5, start, length);
} catch (Exception e) {
mintFailedLog(
"downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ ", expectedMD5: " + range1MD5 + ", start: " + start + ", length: " + length,
startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace()));
throw e;
}
mintSuccessLog(
"downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ ", expectedMD5: " + range1MD5 + ", start: " + start + ", length: " + length,
startTime);
}
// Test downloading encrypted object with Get Range, 64*1024 ->
// 1024*1024-64*1024
public static void downloadGetRangeEncryption_test6() throws Exception {
if (!mintEnv) {
System.out.println("Test: downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)");
}
if (!enableHTTPS) {
return;
}
long startTime = System.currentTimeMillis();
String objectName = "testobject";
int start = 64 * 1024;
int length = 1024 * 1024 - 64 * 1024;
String range1MD5 = Utils.getFileMD5(file1Mb, start, length);
try {
s3TestUtils.uploadObject(bucketName, objectName, file1Mb, sseKey1);
s3TestUtils.downloadObject(bucketName, objectName, sseKey1, range1MD5, start, length);
} catch (Exception e) {
mintFailedLog(
"downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ ", expectedMD5: " + range1MD5 + ", start: " + start + ", length: " + length,
startTime, null, e.toString() + " >>> " + Arrays.toString(e.getStackTrace()));
throw e;
}
mintSuccessLog(
"downloadObjectGetRange(String bucketName, String objectName, "
+ "SSECustomerKey sseKey, String expectedMD5, int start, int length)",
"bucketName: " + bucketName + ", objectName: " + objectName + ", SSECustomerKey: " + sseKey1
+ ", expectedMD5: " + range1MD5 + ", start: " + start + ", length: " + length,
startTime);
}
// Run tests
public static void runTests() throws Exception {
uploadObjectEncryption_test1();
downloadObjectEncryption_test1();
copyObjectEncryption_test1();
copyObjectEncryption_test2();
copyObjectEncryption_test3();
downloadGetRangeEncryption_test1();
downloadGetRangeEncryption_test2();
downloadGetRangeEncryption_test3();
downloadGetRangeEncryption_test4();
downloadGetRangeEncryption_test5();
downloadGetRangeEncryption_test6();
}
public static void main(String[] args) throws Exception, IOException, NoSuchAlgorithmException {
endpoint = System.getenv("SERVER_ENDPOINT");
accessKey = System.getenv("ACCESS_KEY");
secretKey = System.getenv("SECRET_KEY");
enableHTTPS = System.getenv("ENABLE_HTTPS").equals("1");
region = "us-east-1";
if (enableHTTPS) {
endpoint = "https://" + endpoint;
} else {
endpoint = "http://" + endpoint;
}
String dataDir = System.getenv("MINT_DATA_DIR");
if (dataDir != null && !dataDir.equals("")) {
mintEnv = true;
file1Kb = Paths.get(dataDir, "datafile-1-kB").toString();
file1Mb = Paths.get(dataDir, "datafile-1-MB").toString();
file6Mb = Paths.get(dataDir, "datafile-6-MB").toString();
}
String mintMode = null;
if (mintEnv) {
mintMode = System.getenv("MINT_MODE");
}
AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey);
AmazonS3ClientBuilder.EndpointConfiguration endpointConfiguration = new AmazonS3ClientBuilder.EndpointConfiguration(
endpoint, region);
AmazonS3ClientBuilder clientBuilder = AmazonS3ClientBuilder.standard();
clientBuilder.setCredentials(new AWSStaticCredentialsProvider(credentials));
clientBuilder.setEndpointConfiguration(endpointConfiguration);
clientBuilder.setPathStyleAccessEnabled(true);
s3Client = clientBuilder.build();
s3TestUtils = new S3TestUtils(s3Client);
try {
initTests();
FunctionalTests.runTests();
} catch (Exception e) {
e.printStackTrace();
System.exit(-1);
} finally {
teardown();
}
}
}

View File

@@ -0,0 +1,60 @@
/*
* Mint, (C) 2018 Minio, Inc.
*
* Licensed 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 io.minio.awssdk.tests;
import java.io.*;
// LimitedInputStream wraps a regular InputStream, calling
// read() will skip some bytes as configured and will also
// return only data with configured length
class LimitedInputStream extends InputStream {
private int skip;
private int length;
private InputStream is;
LimitedInputStream(InputStream is, int skip, int length) {
this.is = is;
this.skip = skip;
this.length = length;
}
@Override
public int read() throws IOException {
int r;
while (skip > 0) {
r = is.read();
if (r < 0) {
throw new IOException("stream ended before being able to skip all bytes");
}
skip--;
}
if (length == 0) {
return -1;
}
r = is.read();
if (r < 0) {
throw new IOException("stream ended before being able to read all bytes");
}
length--;
return r;
}
}

View File

@@ -0,0 +1,151 @@
/*
* Minio Java SDK for Amazon S3 Compatible Cloud Storage,
* (C) 2015, 2016, 2017, 2018 Minio, Inc.
*
* Licensed 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 io.minio.awssdk.tests;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
public class MintLogger {
@JsonProperty("name")
private String name;
@JsonProperty("function")
private String function;
@JsonProperty("args")
private String args;
@JsonProperty("duration")
private long duration;
@JsonProperty("status")
private String status;
@JsonProperty("alert")
private String alert;
@JsonProperty("message")
private String message;
@JsonProperty("error")
private String error;
/**
* Constructor.
**/
public MintLogger(String function,
String args,
long duration,
String status,
String alert,
String message,
String error) {
this.name = "aws-sdk-java";
this.function = function;
this.duration = duration;
this.args = args;
this.status = status;
this.alert = alert;
this.message = message;
this.error = error;
}
/**
* Return JSON Log Entry.
**/
@JsonIgnore
public String toString() {
try {
return new ObjectMapper().setSerializationInclusion(Include.NON_NULL).writeValueAsString(this);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
return "";
}
/**
* Return Alert.
**/
@JsonIgnore
public String alert() {
return alert;
}
/**
* Return Error.
**/
@JsonIgnore
public String error() {
return error;
}
/**
* Return Message.
**/
@JsonIgnore
public String message() {
return message;
}
/**
* Return args.
**/
@JsonIgnore
public String args() {
return args;
}
/**
* Return status.
**/
@JsonIgnore
public String status() {
return status;
}
/**
* Return name.
**/
@JsonIgnore
public String name() {
return name;
}
/**
* Return function.
**/
@JsonIgnore
public String function() {
return function;
}
/**
* Return duration.
**/
@JsonIgnore
public long duration() {
return duration;
}
}

View File

@@ -0,0 +1,187 @@
/*
* Mint, (C) 2018 Minio, Inc.
*
* Licensed 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 io.minio.awssdk.tests;
import java.io.*;
import java.util.*;
import java.nio.channels.Channels;
import com.amazonaws.services.s3.model.GetObjectMetadataRequest;
import com.amazonaws.services.s3.model.GetObjectRequest;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.PutObjectRequest;
import com.amazonaws.services.s3.model.CopyObjectRequest;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectInputStream;
import com.amazonaws.services.s3.model.SSECustomerKey;
import com.amazonaws.services.s3.model.CompleteMultipartUploadRequest;
import com.amazonaws.services.s3.model.InitiateMultipartUploadRequest;
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult;
import com.amazonaws.services.s3.model.PartETag;
import com.amazonaws.services.s3.model.UploadPartRequest;
import com.amazonaws.services.s3.model.MetadataDirective;
import com.amazonaws.services.s3.AmazonS3;
class S3TestUtils {
private AmazonS3 s3Client;
S3TestUtils(AmazonS3 s3Client) {
this.s3Client = s3Client;
}
void uploadMultipartObject(String bucketName, String keyName,
String filePath, SSECustomerKey sseKey) throws IOException {
File file = new File(filePath);
List<PartETag> partETags = new ArrayList<PartETag>();
// Step 1: Initialize.
InitiateMultipartUploadRequest initRequest = new
InitiateMultipartUploadRequest(bucketName, keyName);
if (sseKey != null) {
initRequest.setSSECustomerKey(sseKey);
}
InitiateMultipartUploadResult initResponse =
s3Client.initiateMultipartUpload(initRequest);
long contentLength = file.length();
long partSize = 5242880; // Set part size to 5 MB.
// Step 2: Upload parts.
long filePosition = 0;
for (int i = 1; filePosition < contentLength; i++) {
// Last part can be less than 5 MB. Adjust part size.
partSize = Math.min(partSize, (contentLength - filePosition));
// Create request to upload a part.
UploadPartRequest uploadRequest = new UploadPartRequest()
.withBucketName(bucketName).withKey(keyName)
.withUploadId(initResponse.getUploadId()).withPartNumber(i)
.withFileOffset(filePosition)
.withFile(file)
.withPartSize(partSize);
if (sseKey != null) {
uploadRequest.withSSECustomerKey(sseKey);
}
// Upload part and add response to our list.
partETags.add(s3Client.uploadPart(uploadRequest).getPartETag());
filePosition += partSize;
}
// Step 3: Complete.
CompleteMultipartUploadRequest compRequest = new
CompleteMultipartUploadRequest(
bucketName,
keyName,
initResponse.getUploadId(),
partETags);
s3Client.completeMultipartUpload(compRequest);
}
void uploadObject(String bucketName, String keyName,
String filePath, SSECustomerKey sseKey) throws IOException {
File f = new File(filePath);
PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, keyName, f);
if (sseKey != null) {
putObjectRequest.withSSECustomerKey(sseKey);
}
s3Client.putObject(putObjectRequest);
}
void downloadObject(String bucketName, String keyName, SSECustomerKey sseKey)
throws Exception, IOException {
downloadObject(bucketName, keyName, sseKey, "", -1, -1);
}
void downloadObject(String bucketName, String keyName, SSECustomerKey sseKey,
String expectedMD5)
throws Exception, IOException {
downloadObject(bucketName, keyName, sseKey, expectedMD5, -1, -1);
}
void downloadObject(String bucketName, String keyName, SSECustomerKey sseKey,
String expectedMD5, int start, int length) throws Exception, IOException {
GetObjectRequest getObjectRequest = new GetObjectRequest(bucketName, keyName)
.withSSECustomerKey(sseKey);
if (start >= 0 && length >= 0) {
getObjectRequest.setRange(start, start+length-1);
}
S3Object s3Object = s3Client.getObject(getObjectRequest);
int size = 0;
int c;
S3ObjectInputStream input = s3Object.getObjectContent();
ByteArrayOutputStream output = new ByteArrayOutputStream();
String data = "";
while ((c = input.read()) != -1) {
output.write((byte) c);
size++;
}
if (length >= 0 && size != length) {
throw new Exception("downloaded object has unexpected size, expected: " + length + ", received: " + size);
}
String calculatedMD5 = Utils.getBufferMD5(output.toByteArray());
if (!expectedMD5.equals("") && !calculatedMD5.equals(expectedMD5)) {
throw new Exception("downloaded object has unexpected md5sum, expected: " + expectedMD5 + ", found: " + calculatedMD5);
}
}
void copyObject(String bucketName, String keyName, SSECustomerKey sseKey,
String targetBucketName, String targetKeyName, SSECustomerKey newSseKey,
boolean replace) {
CopyObjectRequest copyRequest = new CopyObjectRequest(bucketName, keyName, targetBucketName, targetKeyName);
if (sseKey != null) {
copyRequest.withSourceSSECustomerKey(sseKey);
}
if (newSseKey != null) {
copyRequest.withDestinationSSECustomerKey(newSseKey);
}
if (replace) {
copyRequest.withMetadataDirective(MetadataDirective.COPY);
}
s3Client.copyObject(copyRequest);
}
long retrieveObjectMetadata(String bucketName, String keyName, SSECustomerKey sseKey) {
GetObjectMetadataRequest getMetadataRequest = new GetObjectMetadataRequest(bucketName, keyName)
.withSSECustomerKey(sseKey);
ObjectMetadata objectMetadata = s3Client.getObjectMetadata(getMetadataRequest);
return objectMetadata.getContentLength();
}
}

View File

@@ -0,0 +1,76 @@
/*
* Mint, (C) 2018 Minio, Inc.
*
* Licensed 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 io.minio.awssdk.tests;
import java.io.*;
import java.nio.channels.*;
import java.security.*;
class Utils {
public static byte[] createChecksum(InputStream is, int skip, int length) throws Exception {
int numRead;
byte[] buffer = new byte[1024];
MessageDigest complete = MessageDigest.getInstance("MD5");
if (skip > -1 && length > -1) {
is = new LimitedInputStream(is, skip, length);
}
do {
numRead = is.read(buffer);
if (numRead > 0) {
complete.update(buffer, 0, numRead);
}
} while (numRead != -1);
return complete.digest();
}
public static String getInputStreamMD5(InputStream is) throws Exception {
return getInputStreamMD5(is, -1, -1);
}
public static String getInputStreamMD5(InputStream is, int start, int length) throws Exception {
byte[] b = createChecksum(is, start, length);
String result = "";
for (int i=0; i < b.length; i++) {
result += Integer.toString( ( b[i] & 0xff ) + 0x100, 16).substring( 1 );
}
return result;
}
public static String getFileMD5(String filePath) throws Exception {
return getFileMD5(filePath, -1, -1);
}
public static String getFileMD5(String filePath, int start, int length) throws Exception {
File f = new File(filePath);
InputStream is = new FileInputStream(f);
return getInputStreamMD5(is, start, length);
}
public static String getBufferMD5(byte[] data) throws Exception {
ByteArrayInputStream bis = new ByteArrayInputStream(data);
return getInputStreamMD5(bis);
}
}

View File

@@ -0,0 +1,20 @@
#!/bin/bash -e
#
# Mint (C) 2017 Minio, Inc.
#
# Licensed 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.
#
test_run_dir="$MINT_RUN_CORE_DIR/aws-sdk-php"
$WGET --output-document=- https://getcomposer.org/installer | php -- --install-dir="$test_run_dir"
php "$test_run_dir/composer.phar" --working-dir="$test_run_dir" install

View File

@@ -0,0 +1,18 @@
#!/bin/bash -e
#
# Mint (C) 2017 Minio, Inc.
#
# Licensed 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.
#
gem install --no-rdoc --no-ri aws-sdk multipart_body

20
mint/build/awscli/install.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash -e
#
# Mint (C) 2017 Minio, Inc.
#
# Licensed 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.
#
AWS_CLI_VERSION="1.11.112"
python -m pip install awscli==$AWS_CLI_VERSION

View File

@@ -0,0 +1,19 @@
#!/bin/bash -e
#
# Mint (C) 2019 Minio, Inc.
#
# Licensed 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.
#
test_run_dir="$MINT_RUN_CORE_DIR/healthcheck"
GO111MODULE=on go build -o "$test_run_dir/healthcheck" "$test_run_dir/healthcheck.go"

31
mint/build/mc/install.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash -e
#
# Mint (C) 2017 Minio, Inc.
#
# Licensed 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.
#
MC_VERSION=$(curl --retry 10 -Ls -o /dev/null -w "%{url_effective}" https://github.com/minio/mc/releases/latest | sed "s/https:\/\/github.com\/minio\/mc\/releases\/tag\///")
if [ -z "$MC_VERSION" ]; then
echo "unable to get mc version from github"
exit 1
fi
test_run_dir="$MINT_RUN_CORE_DIR/mc"
$WGET --output-document="${test_run_dir}/mc" "https://dl.minio.io/client/mc/release/linux-amd64/mc.${MC_VERSION}"
chmod a+x "${test_run_dir}/mc"
git clone --quiet https://github.com/minio/mc.git "$test_run_dir/mc.git"
(cd "$test_run_dir/mc.git"; git checkout --quiet "tags/${MC_VERSION}")
cp -a "${test_run_dir}/mc.git/functional-tests.sh" "$test_run_dir/"
rm -fr "$test_run_dir/mc.git"

View File

@@ -0,0 +1,42 @@
#!/bin/bash
#
# Mint (C) 2017 Minio, Inc.
#
# Licensed 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.
#
set -e
MINIO_DOTNET_SDK_PATH="$MINT_RUN_CORE_DIR/minio-dotnet"
MINIO_DOTNET_SDK_VERSION=$(curl --retry 10 -Ls -o /dev/null -w "%{url_effective}" https://github.com/minio/minio-dotnet/releases/latest | sed "s/https:\/\/github.com\/minio\/minio-dotnet\/releases\/tag\///")
if [ -z "$MINIO_DOTNET_SDK_VERSION" ]; then
echo "unable to get minio-dotnet version from github"
exit 1
fi
out_dir="$MINIO_DOTNET_SDK_PATH/out"
if [ -z "$out_dir" ]; then
mkdir "$out_dir"
fi
curl https://raw.githubusercontent.com/minio/minio-dotnet/"${MINIO_DOTNET_SDK_VERSION}"/Minio.Functional.Tests/FunctionalTest.cs > "${MINIO_DOTNET_SDK_PATH}/FunctionalTest.cs"
curl https://raw.githubusercontent.com/minio/minio-dotnet/"${MINIO_DOTNET_SDK_VERSION}"/Minio.Functional.Tests/MintLogger.cs > "${MINIO_DOTNET_SDK_PATH}/MintLogger.cs"
curl https://raw.githubusercontent.com/minio/minio-dotnet/"${MINIO_DOTNET_SDK_VERSION}"/Minio.Functional.Tests/JsonNetLogger.cs > "${MINIO_DOTNET_SDK_PATH}/JsonNetLogger.cs"
curl https://raw.githubusercontent.com/minio/minio-dotnet/"${MINIO_DOTNET_SDK_VERSION}"/Minio.Functional.Tests/Program.cs > "${MINIO_DOTNET_SDK_PATH}/Program.cs"
curl https://raw.githubusercontent.com/minio/minio-dotnet/"${MINIO_DOTNET_SDK_VERSION}"/Minio.Functional.Tests/RandomStreamGenerator.cs > "${MINIO_DOTNET_SDK_PATH}/RandomStreamGenerator.cs"
curl https://raw.githubusercontent.com/minio/minio-dotnet/"${MINIO_DOTNET_SDK_VERSION}"/Minio.Functional.Tests/Minio.Functional.Tests.csproj > "${MINIO_DOTNET_SDK_PATH}/Minio.Functional.Tests.csproj"
cd "$MINIO_DOTNET_SDK_PATH"
dotnet restore /p:Configuration=Mint
dotnet publish --runtime ubuntu.16.04-x64 --output out /p:Configuration=Mint

27
mint/build/minio-go/install.sh Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash -e
#
# Mint (C) 2017 Minio, Inc.
#
# Licensed 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.
#
MINIO_GO_VERSION=$(curl --retry 10 -Ls -o /dev/null -w "%{url_effective}" https://github.com/minio/minio-go/releases/latest | sed "s/https:\/\/github.com\/minio\/minio-go\/releases\/tag\///")
if [ -z "$MINIO_GO_VERSION" ]; then
echo "unable to get minio-go version from github"
exit 1
fi
test_run_dir="$MINT_RUN_CORE_DIR/minio-go"
(git clone https://github.com/minio/minio-go && cd minio-go && git checkout --quiet "tags/$MINIO_GO_VERSION")
GO111MODULE=on CGO_ENABLED=0 go build -o "$test_run_dir/minio-go" "minio-go/functional_tests.go"
rm -rf minio-go

View File

@@ -0,0 +1,30 @@
#!/bin/bash -e
#
# Mint (C) 2017 Minio, Inc.
#
# Licensed 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.
#
MINIO_JAVA_VERSION=$(curl --retry 10 -s "http://repo1.maven.org/maven2/io/minio/minio/maven-metadata.xml" | sed -n "/<latest>/{s/<.[^>]*>//g;p;q}" | sed "s/ *//g")
if [ -z "$MINIO_JAVA_VERSION" ]; then
echo "unable to get latest minio-java version from maven"
exit 1
fi
test_run_dir="$MINT_RUN_CORE_DIR/minio-java"
git clone --quiet https://github.com/minio/minio-java.git "$test_run_dir/minio-java.git"
(cd "$test_run_dir/minio-java.git"; git checkout --quiet "tags/${MINIO_JAVA_VERSION}")
$WGET --output-document="$test_run_dir/minio-${MINIO_JAVA_VERSION}-all.jar" "http://repo1.maven.org/maven2/io/minio/minio/${MINIO_JAVA_VERSION}/minio-${MINIO_JAVA_VERSION}-all.jar"
javac -cp "$test_run_dir/minio-${MINIO_JAVA_VERSION}-all.jar" "${test_run_dir}/minio-java.git/functional"/*.java
cp -a "${test_run_dir}/minio-java.git/functional"/*.class "$test_run_dir/"
rm -fr "$test_run_dir/minio-java.git"

28
mint/build/minio-js/install.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/bash -e
#
# Mint (C) 2017 Minio, Inc.
#
# Licensed 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.
#
MINIO_JS_VERSION=$(curl --retry 10 -Ls -o /dev/null -w "%{url_effective}" https://github.com/minio/minio-js/releases/latest | sed "s/https:\/\/github.com\/minio\/minio-js\/releases\/tag\///")
if [ -z "$MINIO_JS_VERSION" ]; then
echo "unable to get minio-js version from github"
exit 1
fi
test_run_dir="$MINT_RUN_CORE_DIR/minio-js"
mkdir "${test_run_dir}/test"
$WGET --output-document="${test_run_dir}/test/functional-tests.js" "https://raw.githubusercontent.com/minio/minio-js/${MINIO_JS_VERSION}/src/test/functional/functional-tests.js"
npm --prefix "$test_run_dir" install --save "minio@$MINIO_JS_VERSION"
npm --prefix "$test_run_dir" install

29
mint/build/minio-py/install.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/bin/bash -e
#
# Mint (C) 2017 Minio, Inc.
#
# Licensed 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.
#
MINIO_PY_VERSION=$(curl --retry 10 -Ls -o /dev/null -w "%{url_effective}" https://github.com/minio/minio-py/releases/latest | sed "s/https:\/\/github.com\/minio\/minio-py\/releases\/tag\///")
if [ -z "$MINIO_PY_VERSION" ]; then
echo "unable to get minio-py version from github"
exit 1
fi
test_run_dir="$MINT_RUN_CORE_DIR/minio-py"
# FIX https://github.com/pypa/pip/issues/5221
python -m pip install --upgrade pip
python -m pip install --user faker
python -m pip install minio=="$MINIO_PY_VERSION"
$WGET --output-document="$test_run_dir/tests.py" "https://raw.githubusercontent.com/minio/minio-py/${MINIO_PY_VERSION}/tests/functional/tests.py"

19
mint/build/s3cmd/install.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash -e
#
# Mint (C) 2017 Minio, Inc.
#
# Licensed 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.
#
# Always install the latest.
python -m pip install s3cmd

19
mint/build/security/install.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash -e
#
# Mint (C) 2018 Minio, Inc.
#
# Licensed 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.
#
test_run_dir="$MINT_RUN_CORE_DIR/security"
GO111MODULE=on go build -o "$test_run_dir/tls-tests" "$test_run_dir/tls-tests.go"

19
mint/build/worm/install.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash -e
#
# Mint (C) 2017 Minio, Inc.
#
# Licensed 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.
#
test_run_dir="$MINT_RUN_CORE_DIR/worm"
GO111MODULE=on CGO_ENABLED=0 go build -o "$test_run_dir/worm" "$test_run_dir/quick-worm-tests.go"