Skip to content

Commit

Permalink
remove REST test and adressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexksikes committed Dec 16, 2014
1 parent be985c6 commit 3924eb2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 37 deletions.
29 changes: 0 additions & 29 deletions rest-api-spec/test/indices.stats/16_issue7644.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@

import org.elasticsearch.index.search.stats.SearchStats;
import org.elasticsearch.index.search.stats.SearchStats.Stats;
import org.elasticsearch.test.ElasticsearchLuceneTestCase;
import org.elasticsearch.test.ElasticsearchTestCase;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

public class SearchStatsUnitTests extends ElasticsearchLuceneTestCase {
public class SearchStatsUnitTests extends ElasticsearchTestCase {

@Test
public void TestShardLevelSearchGroupStatsIssue7144() throws Exception {
// https://github.com/elasticsearch/elasticsearch/issues/7644
public void testShardLevelSearchGroupStats() throws Exception {
// let's create two dummy search stats with groups
Map<String, Stats> groupStats1 = new HashMap<>();
Map<String, Stats> groupStats2 = new HashMap<>();
Expand All @@ -40,21 +41,21 @@ public void TestShardLevelSearchGroupStatsIssue7144() throws Exception {

// adding these two search stats and checking group stats are correct
searchStats1.add(searchStats2);
checkStats(groupStats1.get("group1"), 1);
assertStats(groupStats1.get("group1"), 1);

// another call, adding again ...
searchStats1.add(searchStats2);
checkStats(groupStats1.get("group1"), 2);
assertStats(groupStats1.get("group1"), 2);

// making sure stats2 was not affected (this would previously return 2!)
checkStats(groupStats2.get("group1"), 1);
assertStats(groupStats2.get("group1"), 1);

// adding again would then return wrong search stats (would return 4! instead of 3)
searchStats1.add(searchStats2);
checkStats(groupStats1.get("group1"), 3);
assertStats(groupStats1.get("group1"), 3);
}

private void checkStats(Stats stats, long equalTo) {
private void assertStats(Stats stats, long equalTo) {
assertEquals(equalTo, stats.getQueryCount());
assertEquals(equalTo, stats.getQueryTimeInMillis());
assertEquals(equalTo, stats.getQueryCurrent());
Expand Down

0 comments on commit 3924eb2

Please sign in to comment.