use of org.graylog.testing.containermatrix.annotations.ContainerMatrixTest in project graylog2-server by Graylog2.
the class IndicesIT method indexCreationDateReturnsIndexCreationDateOfExistingIndexAsDateTime.
@ContainerMatrixTest
public void indexCreationDateReturnsIndexCreationDateOfExistingIndexAsDateTime() {
final DateTime now = DateTime.now(DateTimeZone.UTC);
final String indexName = createRandomIndex("indices_it_");
final Optional<DateTime> indexCreationDate = indices.indexCreationDate(indexName);
assertThat(indexCreationDate).isNotEmpty().hasValueSatisfying(date -> assertThat(date.toDate()).isCloseTo(now.toDate(), TimeUnit.SECONDS.toMillis(1)));
}
use of org.graylog.testing.containermatrix.annotations.ContainerMatrixTest in project graylog2-server by Graylog2.
the class SearchMetadataIT method testRetrievingMetadataForStoredSearchWithoutParameter.
@ContainerMatrixTest
void testRetrievingMetadataForStoredSearchWithoutParameter() {
final ValidatableResponse response = given().spec(requestSpec).when().get("/views/search/metadata/61977428c1f17d26b45c8a0b").then().statusCode(200);
response.assertThat().body("query_metadata.f1446410-a082-4871-b3bf-d69aa42d0c96.used_parameters_names", empty());
response.assertThat().body("declared_parameters", anEmptyMap());
}
use of org.graylog.testing.containermatrix.annotations.ContainerMatrixTest in project graylog2-server by Graylog2.
the class SuggestionResourceIT method testTypoCorrection.
@ContainerMatrixTest
void testTypoCorrection() {
final ValidatableResponse validatableResponse = given().spec(requestSpec).when().body("{\"field\":\"facility\", \"input\":\"tets\"}").post("/search/suggest").then().statusCode(200);
validatableResponse.assertThat().body("suggestions.value[0]", equalTo("test"));
validatableResponse.assertThat().body("suggestions.occurrence[0]", greaterThanOrEqualTo(1));
}
use of org.graylog.testing.containermatrix.annotations.ContainerMatrixTest in project graylog2-server by Graylog2.
the class SuggestionResourceIT method testInvalidField.
@ContainerMatrixTest
void testInvalidField() {
final ValidatableResponse validatableResponse = given().spec(requestSpec).when().body("{\"field\":\"message\", \"input\":\"foo\"}").post("/search/suggest").then().statusCode(200);
// error types and messages are different for each ES version, so let's just check that there is an error in the response
validatableResponse.assertThat().body("error", notNullValue());
}
use of org.graylog.testing.containermatrix.annotations.ContainerMatrixTest in project graylog2-server by Graylog2.
the class CountsIT method totalReturnsZeroWithNoIndices.
@ContainerMatrixTest
@Order(2)
public void totalReturnsZeroWithNoIndices() {
final BulkIndexRequest bulkIndexRequest = new BulkIndexRequest();
for (int i = 0; i < 10; i++) {
final Map<String, Object> source = ImmutableMap.of("foo", "bar", "counter", i);
bulkIndexRequest.addRequest(INDEX_NAME_3, source);
}
client().bulkIndex(bulkIndexRequest);
// Simulate no indices for the second index set.
when(indexSet2.getManagedIndices()).thenReturn(new String[0]);
assertThat(counts.total(indexSet1)).isEqualTo(0L);
assertThat(counts.total(indexSet2)).isEqualTo(0L);
assertThat(counts.total(indexSet3)).isEqualTo(10L);
// Simulate no indices for all index sets.
when(indexSetRegistry.getManagedIndices()).thenReturn(new String[0]);
assertThat(counts.total()).isEqualTo(0L);
}
Aggregations