Skip to content

Commit

Permalink
Fix bunch of tests that were still using SuiteScopeTestCase
Browse files Browse the repository at this point in the history
Signed-off-by: Sachin Kale <kalsac@amazon.com>
  • Loading branch information
Sachin Kale committed Sep 1, 2023
1 parent 0f29caf commit 9fdcb39
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
/**
* Tests to validate if user specified a missingValue in the input while doing the aggregation
*/
@OpenSearchIntegTestCase.SuiteScopeTestCase
public class MissingValueIT extends GeoModulePluginIntegTestCase {

private static final String INDEX_NAME = "idx";
Expand All @@ -43,8 +42,8 @@ public class MissingValueIT extends GeoModulePluginIntegTestCase {
private GeoPoint bottomRight;
private GeoPoint topLeft;

@Override
protected void setupSuiteScopeCluster() throws Exception {
@Before
protected void setupTest() throws Exception {
assertAcked(
prepareCreate(INDEX_NAME).setMapping(
"date",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

package org.opensearch.geo.search.aggregations.bucket;

import org.junit.Before;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.common.geo.GeoBoundingBox;
import org.opensearch.common.geo.GeoPoint;
Expand Down Expand Up @@ -59,13 +60,12 @@
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;

@OpenSearchIntegTestCase.SuiteScopeTestCase
public class GeoHashGridIT extends AbstractGeoBucketAggregationIntegTest {

private static final String AGG_NAME = "geohashgrid";

@Override
public void setupSuiteScopeCluster() throws Exception {
@Before
public void setupTest() throws Exception {
Random random = random();
// Creating a BB for limiting the number buckets generated during aggregation
boundingRectangleForGeoShapesAgg = getGridAggregationBoundingBox(random);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package org.opensearch.geo.search.aggregations.bucket;

import org.junit.Before;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.common.geo.GeoBoundingBox;
import org.opensearch.common.geo.GeoPoint;
Expand All @@ -31,15 +32,14 @@
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertSearchResponse;
import static org.hamcrest.Matchers.equalTo;

@OpenSearchIntegTestCase.SuiteScopeTestCase
public class GeoTileGridIT extends AbstractGeoBucketAggregationIntegTest {

private static final int GEOPOINT_MAX_PRECISION = 17;

private static final String AGG_NAME = "geotilegrid";

@Override
public void setupSuiteScopeCluster() throws Exception {
@Before
public void setupTest() throws Exception {
final Random random = random();
// Creating a BB for limiting the number buckets generated during aggregation
boundingRectangleForGeoShapesAgg = getGridAggregationBoundingBox(random);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package org.opensearch.geo.search.aggregations.bucket;

import org.junit.Before;
import org.opensearch.action.index.IndexRequestBuilder;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.geo.GeoModulePluginIntegTestCase;
Expand All @@ -31,7 +32,6 @@
* compute empty buckets, its {@code reduce()} method must be called. So by adding the date histogram under other buckets,
* we can make sure that the reduce is properly propagated by checking that empty buckets were created.
*/
@OpenSearchIntegTestCase.SuiteScopeTestCase
public class ShardReduceIT extends GeoModulePluginIntegTestCase {

private IndexRequestBuilder indexDoc(String date, int value) throws Exception {
Expand All @@ -52,8 +52,8 @@ private IndexRequestBuilder indexDoc(String date, int value) throws Exception {
);
}

@Override
public void setupSuiteScopeCluster() throws Exception {
@Before
public void setupTest() throws Exception {
assertAcked(
prepareCreate("idx").setMapping(
"nested",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package org.opensearch.geo.search.aggregations.metrics;

import org.junit.Before;
import org.opensearch.action.index.IndexRequestBuilder;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.common.document.DocumentField;
Expand Down Expand Up @@ -65,8 +66,8 @@ public abstract class AbstractGeoAggregatorModulePluginTestCase extends GeoModul
protected static Map<String, Integer> expectedDocCountsForGeoHash = null;
protected static Map<String, GeoPoint> expectedCentroidsForGeoHash = null;

@Override
public void setupSuiteScopeCluster() throws Exception {
@Before
public void setupTest() throws Exception {
createIndex(UNMAPPED_IDX_NAME);
assertAcked(
prepareCreate(IDX_NAME).setMapping(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.sameInstance;

@OpenSearchIntegTestCase.SuiteScopeTestCase
public class GeoBoundsITTestCase extends AbstractGeoAggregatorModulePluginTestCase {
private static final String aggName = "geoBounds";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.notNullValue;

@OpenSearchIntegTestCase.SuiteScopeTestCase
public class GeoCentroidITTestCase extends AbstractGeoAggregatorModulePluginTestCase {
private static final String aggName = "geoCentroid";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.util.List;
import java.util.Map;

@OpenSearchIntegTestCase.SuiteScopeTestCase
public class SearchPipelineCommonIT extends OpenSearchIntegTestCase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

package org.opensearch.search.aggregations.metrics;

import org.junit.Before;
import org.opensearch.action.index.IndexRequestBuilder;
import org.opensearch.action.search.SearchResponse;
import org.opensearch.common.document.DocumentField;
Expand All @@ -57,7 +58,6 @@
import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertSearchResponse;
import static org.hamcrest.Matchers.equalTo;

@OpenSearchIntegTestCase.SuiteScopeTestCase
public abstract class AbstractGeoTestCase extends OpenSearchIntegTestCase {

protected static final String SINGLE_VALUED_FIELD_NAME = "geo_value";
Expand All @@ -79,8 +79,8 @@ public abstract class AbstractGeoTestCase extends OpenSearchIntegTestCase {
protected static Map<String, GeoPoint> expectedCentroidsForGeoHash = null;
protected static final double GEOHASH_TOLERANCE = 1E-5D;

@Override
public void setupSuiteScopeCluster() throws Exception {
@Before
public void setupTest() throws Exception {
createIndex(UNMAPPED_IDX_NAME);
assertAcked(
prepareCreate(IDX_NAME).setMapping(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

package org.opensearch.search.aggregations.metrics;

import org.junit.Before;
import org.opensearch.action.index.IndexRequestBuilder;
import org.opensearch.test.OpenSearchIntegTestCase;

Expand All @@ -39,12 +40,11 @@

import static org.opensearch.common.xcontent.XContentFactory.jsonBuilder;

@OpenSearchIntegTestCase.SuiteScopeTestCase
public abstract class AbstractNumericTestCase extends OpenSearchIntegTestCase {
protected static long minValue, maxValue, minValues, maxValues;

@Override
public void setupSuiteScopeCluster() throws Exception {
@Before
public void setupTest() throws Exception {
createIndex("idx");
createIndex("idx_unmapped");

Expand Down

0 comments on commit 9fdcb39

Please sign in to comment.