Search in sources :

Example 1 with ContainerMatrixTest

use of org.graylog.testing.containermatrix.annotations.ContainerMatrixTest in project graylog2-server by Graylog2.

the class IndicesIT method retrievingIndexStatsForWildcard.

@ContainerMatrixTest
public void retrievingIndexStatsForWildcard() {
    final IndexSetStatsCreator indexSetStatsCreator = new IndexSetStatsCreator(indices);
    final String indexPrefix = "indices_wildcard_";
    final String wildcard = indexPrefix + "*";
    final IndexSet indexSet = mock(IndexSet.class);
    when(indexSet.getIndexWildcard()).thenReturn(wildcard);
    createRandomIndex(indexPrefix);
    createRandomIndex(indexPrefix);
    final IndexSetStats indexSetStats = indexSetStatsCreator.getForIndexSet(indexSet);
    assertThat(indexSetStats.indices()).isEqualTo(2L);
    assertThat(indexSetStats.size()).isNotZero();
}
Also used : IndexSetStatsCreator(org.graylog2.indexer.IndexSetStatsCreator) IndexSetStats(org.graylog2.rest.resources.system.indexer.responses.IndexSetStats) IndexSet(org.graylog2.indexer.IndexSet) TestIndexSet(org.graylog2.indexer.TestIndexSet) ContainerMatrixTest(org.graylog.testing.containermatrix.annotations.ContainerMatrixTest)

Example 2 with ContainerMatrixTest

use of org.graylog.testing.containermatrix.annotations.ContainerMatrixTest in project graylog2-server by Graylog2.

the class IndicesIT method indexRangeStatsOfIndexReturnsMinMaxTimestampsForGivenIndex.

@ContainerMatrixTest
public void indexRangeStatsOfIndexReturnsMinMaxTimestampsForGivenIndex() {
    importFixture("org/graylog2/indexer/indices/IndicesIT.json");
    IndexRangeStats stats = indices.indexRangeStatsOfIndex(INDEX_NAME);
    assertThat(stats.min()).isEqualTo(new DateTime(2015, 1, 1, 1, 0, DateTimeZone.UTC));
    assertThat(stats.max()).isEqualTo(new DateTime(2015, 1, 1, 5, 0, DateTimeZone.UTC));
}
Also used : IndexRangeStats(org.graylog2.indexer.searches.IndexRangeStats) ZonedDateTime(java.time.ZonedDateTime) DateTime(org.joda.time.DateTime) ContainerMatrixTest(org.graylog.testing.containermatrix.annotations.ContainerMatrixTest)

Example 3 with ContainerMatrixTest

use of org.graylog.testing.containermatrix.annotations.ContainerMatrixTest in project graylog2-server by Graylog2.

the class IndicesIT method indexRangeStatsWorksForEmptyIndex.

@ContainerMatrixTest
public void indexRangeStatsWorksForEmptyIndex() {
    final String indexName = createRandomIndex("indices_it_");
    IndexRangeStats stats = indices.indexRangeStatsOfIndex(indexName);
    assertThat(stats.min()).isEqualTo(new DateTime(0L, DateTimeZone.UTC));
    assertThat(stats.max()).isEqualTo(new DateTime(0L, DateTimeZone.UTC));
}
Also used : IndexRangeStats(org.graylog2.indexer.searches.IndexRangeStats) ZonedDateTime(java.time.ZonedDateTime) DateTime(org.joda.time.DateTime) ContainerMatrixTest(org.graylog.testing.containermatrix.annotations.ContainerMatrixTest)

Example 4 with ContainerMatrixTest

use of org.graylog.testing.containermatrix.annotations.ContainerMatrixTest in project graylog2-server by Graylog2.

the class SearchMetadataIT method testMinimalRequestWithSingleParameter.

@ContainerMatrixTest
void testMinimalRequestWithSingleParameter() {
    final ValidatableResponse response = given().spec(requestSpec).when().body(fixture("org/graylog/plugins/views/minimalistic-request-with-undeclared-parameter.json")).post("/views/search/metadata").then().statusCode(200);
    response.assertThat().body("query_metadata.f1446410-a082-4871-b3bf-d69aa42d0c96.used_parameters_names", contains("action"));
    response.assertThat().body("declared_parameters", anEmptyMap());
}
Also used : ValidatableResponse(io.restassured.response.ValidatableResponse) ContainerMatrixTest(org.graylog.testing.containermatrix.annotations.ContainerMatrixTest)

Example 5 with ContainerMatrixTest

use of org.graylog.testing.containermatrix.annotations.ContainerMatrixTest in project graylog2-server by Graylog2.

the class SearchMetadataIT method testMinimalRequestWithoutParameter.

@ContainerMatrixTest
void testMinimalRequestWithoutParameter() {
    final ValidatableResponse response = given().spec(requestSpec).when().body(fixture("org/graylog/plugins/views/minimalistic-request.json")).post("/views/search/metadata").then().statusCode(200);
    response.assertThat().body("query_metadata*.value.used_parameters_names[0]", empty());
    response.assertThat().body("declared_parameters", anEmptyMap());
}
Also used : ValidatableResponse(io.restassured.response.ValidatableResponse) ContainerMatrixTest(org.graylog.testing.containermatrix.annotations.ContainerMatrixTest)

Aggregations

ContainerMatrixTest (org.graylog.testing.containermatrix.annotations.ContainerMatrixTest)23 ValidatableResponse (io.restassured.response.ValidatableResponse)14 IndexSet (org.graylog2.indexer.IndexSet)4 ZonedDateTime (java.time.ZonedDateTime)3 DateTime (org.joda.time.DateTime)3 BulkIndexRequest (org.graylog.testing.elasticsearch.BulkIndexRequest)2 TestIndexSet (org.graylog2.indexer.TestIndexSet)2 IndexRangeStats (org.graylog2.indexer.searches.IndexRangeStats)2 Response (io.restassured.response.Response)1 IndexNotFoundException (org.graylog2.indexer.IndexNotFoundException)1 IndexSetStatsCreator (org.graylog2.indexer.IndexSetStatsCreator)1 IndexSetStats (org.graylog2.rest.resources.system.indexer.responses.IndexSetStats)1 Order (org.junit.jupiter.api.Order)1 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)1