[PURIFY] fix GetDataStreamsRequestTests build failure
This fixes the constructor for IndexNameExpressionResolver to pass in Settings.EMPTY to a ThreadContext used by the resolver. Signed-off-by: Peter Nied <petern@amazon.com>
This commit is contained in:
parent
d91ce2bd00
commit
033f34cfdc
|
@ -25,6 +25,8 @@ import org.elasticsearch.cluster.metadata.DataStream;
|
|||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.test.AbstractWireSerializingTestCase;
|
||||
|
||||
|
@ -70,7 +72,8 @@ public class GetDataStreamsRequestTests extends AbstractWireSerializingTestCase<
|
|||
ClusterState cs = getClusterStateWithDataStreams(
|
||||
org.elasticsearch.common.collect.List.of(new Tuple<>(dataStreamName, 1)), org.elasticsearch.common.collect.List.of());
|
||||
GetDataStreamAction.Request req = new GetDataStreamAction.Request(new String[]{dataStreamName});
|
||||
List<DataStream> dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs, new IndexNameExpressionResolver(), req);
|
||||
List<DataStream> dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs,
|
||||
new IndexNameExpressionResolver(new ThreadContext(Settings.EMPTY)), req);
|
||||
assertThat(dataStreams.size(), equalTo(1));
|
||||
assertThat(dataStreams.get(0).getName(), equalTo(dataStreamName));
|
||||
}
|
||||
|
@ -82,24 +85,28 @@ public class GetDataStreamsRequestTests extends AbstractWireSerializingTestCase<
|
|||
org.elasticsearch.common.collect.List.of());
|
||||
|
||||
GetDataStreamAction.Request req = new GetDataStreamAction.Request(new String[]{dataStreamNames[1].substring(0, 5) + "*"});
|
||||
List<DataStream> dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs, new IndexNameExpressionResolver(), req);
|
||||
List<DataStream> dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs,
|
||||
new IndexNameExpressionResolver(new ThreadContext(Settings.EMPTY)), req);
|
||||
assertThat(dataStreams.size(), equalTo(1));
|
||||
assertThat(dataStreams.get(0).getName(), equalTo(dataStreamNames[1]));
|
||||
|
||||
req = new GetDataStreamAction.Request(new String[]{"*"});
|
||||
dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs, new IndexNameExpressionResolver(), req);
|
||||
dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs,
|
||||
new IndexNameExpressionResolver(new ThreadContext(Settings.EMPTY)), req);
|
||||
assertThat(dataStreams.size(), equalTo(2));
|
||||
assertThat(dataStreams.get(0).getName(), equalTo(dataStreamNames[1]));
|
||||
assertThat(dataStreams.get(1).getName(), equalTo(dataStreamNames[0]));
|
||||
|
||||
req = new GetDataStreamAction.Request((String[]) null);
|
||||
dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs, new IndexNameExpressionResolver(), req);
|
||||
dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs,
|
||||
new IndexNameExpressionResolver(new ThreadContext(Settings.EMPTY)), req);
|
||||
assertThat(dataStreams.size(), equalTo(2));
|
||||
assertThat(dataStreams.get(0).getName(), equalTo(dataStreamNames[1]));
|
||||
assertThat(dataStreams.get(1).getName(), equalTo(dataStreamNames[0]));
|
||||
|
||||
req = new GetDataStreamAction.Request(new String[]{"matches-none*"});
|
||||
dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs, new IndexNameExpressionResolver(), req);
|
||||
dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs,
|
||||
new IndexNameExpressionResolver(new ThreadContext(Settings.EMPTY)), req);
|
||||
assertThat(dataStreams.size(), equalTo(0));
|
||||
}
|
||||
|
||||
|
@ -110,24 +117,28 @@ public class GetDataStreamsRequestTests extends AbstractWireSerializingTestCase<
|
|||
org.elasticsearch.common.collect.List.of());
|
||||
|
||||
GetDataStreamAction.Request req = new GetDataStreamAction.Request(new String[]{dataStreamNames[0], dataStreamNames[1]});
|
||||
List<DataStream> dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs, new IndexNameExpressionResolver(), req);
|
||||
List<DataStream> dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs,
|
||||
new IndexNameExpressionResolver(new ThreadContext(Settings.EMPTY)), req);
|
||||
assertThat(dataStreams.size(), equalTo(2));
|
||||
assertThat(dataStreams.get(0).getName(), equalTo(dataStreamNames[1]));
|
||||
assertThat(dataStreams.get(1).getName(), equalTo(dataStreamNames[0]));
|
||||
|
||||
req = new GetDataStreamAction.Request(new String[]{dataStreamNames[1]});
|
||||
dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs, new IndexNameExpressionResolver(), req);
|
||||
dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs,
|
||||
new IndexNameExpressionResolver(new ThreadContext(Settings.EMPTY)), req);
|
||||
assertThat(dataStreams.size(), equalTo(1));
|
||||
assertThat(dataStreams.get(0).getName(), equalTo(dataStreamNames[1]));
|
||||
|
||||
req = new GetDataStreamAction.Request(new String[]{dataStreamNames[0]});
|
||||
dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs, new IndexNameExpressionResolver(), req);
|
||||
dataStreams = GetDataStreamAction.TransportAction.getDataStreams(cs,
|
||||
new IndexNameExpressionResolver(new ThreadContext(Settings.EMPTY)), req);
|
||||
assertThat(dataStreams.size(), equalTo(1));
|
||||
assertThat(dataStreams.get(0).getName(), equalTo(dataStreamNames[0]));
|
||||
|
||||
GetDataStreamAction.Request req2 = new GetDataStreamAction.Request(new String[]{"foo"});
|
||||
IndexNotFoundException e = expectThrows(IndexNotFoundException.class,
|
||||
() -> GetDataStreamAction.TransportAction.getDataStreams(cs, new IndexNameExpressionResolver(), req2));
|
||||
() -> GetDataStreamAction.TransportAction.getDataStreams(cs,
|
||||
new IndexNameExpressionResolver(new ThreadContext(Settings.EMPTY)), req2));
|
||||
assertThat(e.getMessage(), containsString("no such index [foo]"));
|
||||
}
|
||||
|
||||
|
@ -136,7 +147,8 @@ public class GetDataStreamsRequestTests extends AbstractWireSerializingTestCase<
|
|||
ClusterState cs = ClusterState.builder(new ClusterName("_name")).build();
|
||||
GetDataStreamAction.Request req = new GetDataStreamAction.Request(new String[]{dataStreamName});
|
||||
IndexNotFoundException e = expectThrows(IndexNotFoundException.class,
|
||||
() -> GetDataStreamAction.TransportAction.getDataStreams(cs, new IndexNameExpressionResolver(), req));
|
||||
() -> GetDataStreamAction.TransportAction.getDataStreams(cs,
|
||||
new IndexNameExpressionResolver(new ThreadContext(Settings.EMPTY)), req));
|
||||
assertThat(e.getMessage(), containsString("no such index [" + dataStreamName + "]"));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue