use of io.stackgres.apiweb.dto.cluster.ClusterLogEntryDto in project stackgres by ongres.
the class ClusterResourceMockedTest method getLogsWithAscSortShouldNotFail.
@Test
void getLogsWithAscSortShouldNotFail() {
clusterMocks();
when(finder.findByNameAndNamespace(getResourceName(), getResourceNamespace())).thenReturn(Optional.of(customResources.getItems().get(0)));
doAnswer(new Answer<List<ClusterLogEntryDto>>() {
@Override
public List<ClusterLogEntryDto> answer(InvocationOnMock invocation) throws Throwable {
DistributedLogsQueryParameters parameters = invocation.getArgument(0);
assertNotNull(parameters);
checkDto(parameters.getCluster(), customResources.getItems().get(0));
assertEquals(50, parameters.getRecords());
assertEquals(Optional.empty(), parameters.getFromTimeAndIndex());
assertEquals(Optional.empty(), parameters.getToTimeAndIndex());
assertEquals(parameters.getFilters(), ImmutableMap.of());
assertEquals(parameters.getFullTextSearchQuery(), Optional.empty());
assertTrue(parameters.isSortAsc());
assertFalse(parameters.isFromInclusive());
return logList;
}
}).when(distributedLogsFetcher).logs(any());
Integer records = null;
String from = null;
String to = null;
String sort = "asc";
String text = null;
List<String> logType = null;
List<String> podName = null;
List<String> role = null;
List<String> errorLevel = null;
List<String> userName = null;
List<String> databaseName = null;
Boolean fromInclusive = null;
List<ClusterLogEntryDto> logs = getClusterLogsResource().logs(getResourceNamespace(), getResourceName(), records, from, to, sort, text, logType, podName, role, errorLevel, userName, databaseName, fromInclusive);
assertIterableEquals(logList, logs);
}
use of io.stackgres.apiweb.dto.cluster.ClusterLogEntryDto in project stackgres by ongres.
the class ClusterResourceMockedTest method getLogsWithToAndIndexShouldNotFail.
@Test
void getLogsWithToAndIndexShouldNotFail() {
clusterMocks();
when(finder.findByNameAndNamespace(getResourceName(), getResourceNamespace())).thenReturn(Optional.of(customResources.getItems().get(0)));
doAnswer(new Answer<List<ClusterLogEntryDto>>() {
@Override
public List<ClusterLogEntryDto> answer(InvocationOnMock invocation) throws Throwable {
DistributedLogsQueryParameters parameters = invocation.getArgument(0);
assertNotNull(parameters);
checkDto(parameters.getCluster(), customResources.getItems().get(0));
assertEquals(50, parameters.getRecords());
assertEquals(Optional.empty(), parameters.getFromTimeAndIndex());
assertEquals(Optional.of(Tuple.tuple(Instant.EPOCH, 1)), parameters.getToTimeAndIndex());
assertEquals(parameters.getFilters(), ImmutableMap.of());
assertEquals(parameters.getFullTextSearchQuery(), Optional.empty());
assertFalse(parameters.isSortAsc());
assertFalse(parameters.isFromInclusive());
return logList;
}
}).when(distributedLogsFetcher).logs(any());
Integer records = null;
String from = null;
String to = Instant.EPOCH.toString() + "," + 1;
String sort = null;
String text = null;
List<String> logType = null;
List<String> podName = null;
List<String> role = null;
List<String> errorLevel = null;
List<String> userName = null;
List<String> databaseName = null;
Boolean fromInclusive = null;
List<ClusterLogEntryDto> logs = getClusterLogsResource().logs(getResourceNamespace(), getResourceName(), records, from, to, sort, text, logType, podName, role, errorLevel, userName, databaseName, fromInclusive);
assertIterableEquals(logList, logs);
}
use of io.stackgres.apiweb.dto.cluster.ClusterLogEntryDto in project stackgres by ongres.
the class ClusterResourceMockedTest method getLogsWithRoleFilterShouldNotFail.
@Test
void getLogsWithRoleFilterShouldNotFail() {
clusterMocks();
when(finder.findByNameAndNamespace(getResourceName(), getResourceNamespace())).thenReturn(Optional.of(customResources.getItems().get(0)));
doAnswer(new Answer<List<ClusterLogEntryDto>>() {
@Override
public List<ClusterLogEntryDto> answer(InvocationOnMock invocation) throws Throwable {
DistributedLogsQueryParameters parameters = invocation.getArgument(0);
assertNotNull(parameters);
checkDto(parameters.getCluster(), customResources.getItems().get(0));
assertEquals(50, parameters.getRecords());
assertEquals(Optional.empty(), parameters.getFromTimeAndIndex());
assertEquals(Optional.empty(), parameters.getToTimeAndIndex());
assertEquals(parameters.getFilters(), ImmutableMap.of("role", List.of("test")));
assertEquals(parameters.getFullTextSearchQuery(), Optional.empty());
assertFalse(parameters.isSortAsc());
assertFalse(parameters.isFromInclusive());
return logList;
}
}).when(distributedLogsFetcher).logs(any());
Integer records = null;
String from = null;
String to = null;
String sort = null;
String text = null;
List<String> logType = null;
List<String> podName = null;
List<String> role = List.of("test");
List<String> errorLevel = null;
List<String> userName = null;
List<String> databaseName = null;
Boolean fromInclusive = null;
List<ClusterLogEntryDto> logs = getClusterLogsResource().logs(getResourceNamespace(), getResourceName(), records, from, to, sort, text, logType, podName, role, errorLevel, userName, databaseName, fromInclusive);
assertIterableEquals(logList, logs);
}
use of io.stackgres.apiweb.dto.cluster.ClusterLogEntryDto in project stackgres by ongres.
the class ClusterResourceMockedTest method getLogsWithFromShouldNotFail.
@Test
void getLogsWithFromShouldNotFail() {
clusterMocks();
when(finder.findByNameAndNamespace(getResourceName(), getResourceNamespace())).thenReturn(Optional.of(customResources.getItems().get(0)));
doAnswer(new Answer<List<ClusterLogEntryDto>>() {
@Override
public List<ClusterLogEntryDto> answer(InvocationOnMock invocation) throws Throwable {
DistributedLogsQueryParameters parameters = invocation.getArgument(0);
assertNotNull(parameters);
checkDto(parameters.getCluster(), customResources.getItems().get(0));
assertEquals(50, parameters.getRecords());
assertEquals(Optional.of(Tuple.tuple(Instant.EPOCH, 0)), parameters.getFromTimeAndIndex());
assertEquals(Optional.empty(), parameters.getToTimeAndIndex());
assertEquals(ImmutableMap.of(), parameters.getFilters());
assertEquals(Optional.empty(), parameters.getFullTextSearchQuery());
assertFalse(parameters.isSortAsc());
assertFalse(parameters.isFromInclusive());
return logList;
}
}).when(distributedLogsFetcher).logs(any());
Integer records = null;
String from = Instant.EPOCH.toString();
String to = null;
String sort = null;
String text = null;
List<String> logType = null;
List<String> podName = null;
List<String> role = null;
List<String> errorLevel = null;
List<String> userName = null;
List<String> databaseName = null;
Boolean fromInclusive = null;
List<ClusterLogEntryDto> logs = getClusterLogsResource().logs(getResourceNamespace(), getResourceName(), records, from, to, sort, text, logType, podName, role, errorLevel, userName, databaseName, fromInclusive);
assertIterableEquals(logList, logs);
}
use of io.stackgres.apiweb.dto.cluster.ClusterLogEntryDto in project stackgres by ongres.
the class ClusterResourceMockedTest method getLogsWithErrorLevelFilterShouldNotFail.
@Test
void getLogsWithErrorLevelFilterShouldNotFail() {
clusterMocks();
when(finder.findByNameAndNamespace(getResourceName(), getResourceNamespace())).thenReturn(Optional.of(customResources.getItems().get(0)));
doAnswer(new Answer<List<ClusterLogEntryDto>>() {
@Override
public List<ClusterLogEntryDto> answer(InvocationOnMock invocation) throws Throwable {
DistributedLogsQueryParameters parameters = invocation.getArgument(0);
assertNotNull(parameters);
checkDto(parameters.getCluster(), customResources.getItems().get(0));
assertEquals(50, parameters.getRecords());
assertEquals(Optional.empty(), parameters.getFromTimeAndIndex());
assertEquals(Optional.empty(), parameters.getToTimeAndIndex());
assertEquals(parameters.getFilters(), ImmutableMap.of("errorLevel", List.of("test")));
assertEquals(parameters.getFullTextSearchQuery(), Optional.empty());
assertFalse(parameters.isSortAsc());
assertFalse(parameters.isFromInclusive());
return logList;
}
}).when(distributedLogsFetcher).logs(any());
Integer records = null;
String from = null;
String to = null;
String sort = null;
String text = null;
List<String> logType = null;
List<String> podName = null;
List<String> role = null;
List<String> errorLevel = List.of("test");
List<String> userName = null;
List<String> databaseName = null;
Boolean fromInclusive = null;
List<ClusterLogEntryDto> logs = getClusterLogsResource().logs(getResourceNamespace(), getResourceName(), records, from, to, sort, text, logType, podName, role, errorLevel, userName, databaseName, fromInclusive);
assertIterableEquals(logList, logs);
}
Aggregations