Search in sources :

Example 21 with ContainerMatrixTest

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

the class QueryValidationResourceIT method testLowercaseNotOperator.

@ContainerMatrixTest
void testLowercaseNotOperator() {
    final ValidatableResponse validatableResponse = given().spec(requestSpec).when().body("{\"query\":\"not(http_response_code:200)\"}").post("/search/validate").then().statusCode(200);
    validatableResponse.assertThat().body("status", equalTo("WARNING"));
    validatableResponse.assertThat().body("explanations.error_message[0]", containsString("Query contains invalid operator \"not\". All AND / OR / NOT operators have to be written uppercase"));
}
Also used : ValidatableResponse(io.restassured.response.ValidatableResponse) ContainerMatrixTest(org.graylog.testing.containermatrix.annotations.ContainerMatrixTest)

Example 22 with ContainerMatrixTest

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

the class QueryValidationResourceIT method testOrQuery.

@ContainerMatrixTest
void testOrQuery() {
    final ValidatableResponse validatableResponse = given().spec(requestSpec).when().body("{\"query\":\"unknown_field:(x OR y)\"}").post("/search/validate").then().statusCode(200);
    validatableResponse.assertThat().body("status", equalTo("WARNING"));
    validatableResponse.assertThat().body("explanations.error_message[0]", containsString("Query contains unknown field: unknown_field"));
}
Also used : ValidatableResponse(io.restassured.response.ValidatableResponse) ContainerMatrixTest(org.graylog.testing.containermatrix.annotations.ContainerMatrixTest)

Example 23 with ContainerMatrixTest

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

the class QueryValidationResourceIT method testInvalidQuery.

@ContainerMatrixTest
void testInvalidQuery() {
    final ValidatableResponse validatableResponse = given().spec(requestSpec).when().body("{\"query\":\"foo:\"}").post("/search/validate").then().statusCode(200);
    validatableResponse.assertThat().body("status", equalTo("ERROR"));
    validatableResponse.assertThat().body("explanations.error_message[0]", containsString("Cannot parse query, cause: incomplete query, query ended unexpectedly"));
}
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