Review Board 1.7.22


FLUME-1862 - ElasticSearch Test Flakey

Review Request #9053 - Created Jan. 22, 2013 and updated

Cameron Gandevia
FLUME-1862
Reviewers
Flume
flume-git
Updated ElasticSearchSink unit tests to use none gateway type. Hopefully fixes an issue where ElasticSearch attempts to recover an index from disk during the test startup.

 
flume-ng-sinks/flume-ng-elasticsearch-sink/src/test/java/org/apache/flume/sink/elasticsearch/AbstractElasticSearchSinkTest.java
Revision 6d472cf New Change
[20] 35 lines
[+20]
36
import org.apache.flume.channel.MemoryChannel;
36
import org.apache.flume.channel.MemoryChannel;
37
import org.apache.flume.conf.Configurables;
37
import org.apache.flume.conf.Configurables;
38
import org.elasticsearch.action.search.SearchResponse;
38
import org.elasticsearch.action.search.SearchResponse;
39
import org.elasticsearch.client.Client;
39
import org.elasticsearch.client.Client;
40
import org.elasticsearch.common.collect.Maps;
40
import org.elasticsearch.common.collect.Maps;

    
   
41
import org.elasticsearch.common.settings.ImmutableSettings;

    
   
42
import org.elasticsearch.common.settings.Settings;
41
import org.elasticsearch.gateway.Gateway;
43
import org.elasticsearch.gateway.Gateway;
42
import org.elasticsearch.index.query.QueryBuilder;
44
import org.elasticsearch.index.query.QueryBuilder;
43
import org.elasticsearch.index.query.QueryBuilders;
45
import org.elasticsearch.index.query.QueryBuilders;
44
import org.elasticsearch.node.Node;
46
import org.elasticsearch.node.Node;
45
import org.elasticsearch.node.NodeBuilder;
47
import org.elasticsearch.node.NodeBuilder;
[+20] [20] 23 lines
[+20]
69
    timestampedIndexName = DEFAULT_INDEX_NAME + "-"
71
    timestampedIndexName = DEFAULT_INDEX_NAME + "-"
70
        + ElasticSearchSink.df.format(new Date());
72
        + ElasticSearchSink.df.format(new Date());
71
  }
73
  }
72

    
   
74

   
73
  void createNodes() throws Exception {
75
  void createNodes() throws Exception {
74
    node = NodeBuilder.nodeBuilder().local(true).node();
76
    Settings settings = ImmutableSettings

    
   
77
        .settingsBuilder()

    
   
78
        .put("number_of_shards", 1)

    
   
79
        .put("number_of_replicas", 0)

    
   
80
        .put("routing.hash.type", "simple")

    
   
81
        .put("gateway.type", "none")

    
   
82
        .build();

    
   
83

   

    
   
84
    node = NodeBuilder.nodeBuilder().settings(settings).local(true).node();
75
    client = node.client();
85
    client = node.client();
76

    
   
86

   
77
    client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute()
87
    client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute()
78
        .actionGet();
88
        .actionGet();
79
  }
89
  }
[+20] [20] 54 lines
  1. flume-ng-sinks/flume-ng-elasticsearch-sink/src/test/java/org/apache/flume/sink/elasticsearch/AbstractElasticSearchSinkTest.java: Loading...