Tests: update to Lucene 4.9.0

Closes #107.

(cherry picked from commit c3c9a44)
This commit is contained in:
David Pilato 2014-07-30 13:39:07 +02:00
parent 11f4e9c063
commit 776677f7e2
5 changed files with 31 additions and 26 deletions

View File

@ -242,7 +242,7 @@ Replace all occurrences of `access_key`, `secret_key`, `bucket` and `region` wit
To run test:
```sh
mvn -Dtests.aws=true -Des.config=/path/to/config/file/elasticsearch.yml clean test
mvn -Dtests.aws=true -Dtests.config=/path/to/config/file/elasticsearch.yml clean test
```

View File

@ -33,7 +33,7 @@
<properties>
<elasticsearch.version>2.0.0-SNAPSHOT</elasticsearch.version>
<lucene.version>4.8.1</lucene.version>
<lucene.version>4.9.0</lucene.version>
<tests.output>onerror</tests.output>
<tests.jvms>1</tests.jvms>
<tests.shuffle>true</tests.shuffle>
@ -227,6 +227,7 @@
<tests.weekly>${tests.weekly}</tests.weekly>
<tests.slow>${tests.slow}</tests.slow>
<tests.aws>${tests.aws}</tests.aws>
<tests.config>${tests.config}</tests.config>
<tests.awaitsfix>${tests.awaitsfix}</tests.awaitsfix>
<tests.slow>${tests.slow}</tests.slow>
<tests.timeoutSuite>${tests.timeoutSuite}</tests.timeoutSuite>

View File

@ -50,7 +50,7 @@ public class S3ImmutableBlobContainer extends AbstractS3BlobContainer implements
try {
ObjectMetadata md = new ObjectMetadata();
if (blobStore.serverSideEncryption()) {
md.setServerSideEncryption(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION);
md.setSSEAlgorithm(ObjectMetadata.AES_256_SERVER_SIDE_ENCRYPTION);
}
md.setContentLength(sizeInBytes);
blobStore.client().putObject(blobStore.bucket(), buildKey(blobName), is, md);

View File

@ -20,8 +20,11 @@
package org.elasticsearch.cloud.aws;
import com.carrotsearch.randomizedtesting.annotations.TestGroup;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.env.Environment;
import org.elasticsearch.env.FailedToResolveConfigException;
import org.elasticsearch.plugins.PluginsService;
import org.elasticsearch.test.ElasticsearchIntegrationTest;
@ -37,22 +40,7 @@ public abstract class AbstractAwsTest extends ElasticsearchIntegrationTest {
/**
* Annotation for tests that require AWS to run. AWS tests are disabled by default.
* <p/>
* To enable test add -Dtests.aws=true -Des.config=/path/to/elasticsearch.yml
* <p/>
* The elasticsearch.yml file should contain the following keys
* <pre>
* cloud:
* aws:
* access_key: AKVAIQBF2RECL7FJWGJQ
* secret_key: vExyMThREXeRMm/b/LRzEB8jWwvzQeXgjqMX+6br
* region: "us-west"
*
* repositories:
* s3:
* bucket: "bucket_name"
*
* </pre>
* Look at README file for details on how to run tests
*/
@Documented
@Inherited
@ -67,12 +55,25 @@ public abstract class AbstractAwsTest extends ElasticsearchIntegrationTest {
@Override
protected Settings nodeSettings(int nodeOrdinal) {
return ImmutableSettings.builder()
ImmutableSettings.Builder settings = ImmutableSettings.builder()
.put(super.nodeSettings(nodeOrdinal))
.put("plugins." + PluginsService.LOAD_PLUGIN_FROM_CLASSPATH, true)
.put(AwsModule.S3_SERVICE_TYPE_KEY, TestAwsS3Service.class)
.put("cloud.aws.test.random", randomInt())
.put("cloud.aws.test.write_failures", 0.1)
.build();
.put("cloud.aws.test.write_failures", 0.1);
Environment environment = new Environment();
// if explicit, just load it and don't load from env
try {
if (Strings.hasText(System.getProperty("tests.config"))) {
settings.loadFromUrl(environment.resolveConfig(System.getProperty("tests.config")));
} else {
fail("to run integration tests, you need to set -Dtest.aws=true and -Dtests.config=/path/to/elasticsearch.yml");
}
} catch (FailedToResolveConfigException exception) {
fail("your test configuration file is incorrect: " + System.getProperty("tests.config"));
}
return settings.build();
}
}

View File

@ -48,8 +48,7 @@ import org.junit.Test;
import java.util.List;
import java.util.ArrayList;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.*;
/**
*/
@ -200,7 +199,7 @@ public class S3SnapshotRestoreTest extends AbstractAwsTest {
logger.info("--> verify encryption for bucket [{}], prefix [{}]", bucketName, basePath);
List<S3ObjectSummary> summaries = s3Client.listObjects(bucketName, basePath).getObjectSummaries();
for (S3ObjectSummary summary : summaries) {
assertThat(s3Client.getObjectMetadata(bucketName, summary.getKey()).getServerSideEncryption(), equalTo("AES256"));
assertThat(s3Client.getObjectMetadata(bucketName, summary.getKey()).getSSEAlgorithm(), equalTo("AES256"));
}
logger.info("--> delete some data");
@ -387,6 +386,10 @@ public class S3SnapshotRestoreTest extends AbstractAwsTest {
String accessKey = bucket.get("access_key", settings.get("cloud.aws.access_key"));
String secretKey = bucket.get("secret_key", settings.get("cloud.aws.secret_key"));
String bucketName = bucket.get("bucket");
// We check that settings has been set in elasticsearch.yml integration test file
// as described in README
assertThat("Your settings in elasticsearch.yml are incorrects. Check README file.", bucketName, notNullValue());
AmazonS3 client = internalCluster().getInstance(AwsS3Service.class).client(region, accessKey, secretKey);
try {
ObjectListing prevListing = null;