cleanup after revert
This commit is contained in:
@@ -25,8 +25,6 @@ import org.junit.jupiter.params.provider.ValueSource;
|
||||
import org.lucares.collections.LongList;
|
||||
import org.lucares.pdb.api.DateTimeRange;
|
||||
import org.lucares.pdb.api.Query;
|
||||
import org.lucares.pdb.datastore.internal.DataStore;
|
||||
import org.lucares.performance.db.PdbExport;
|
||||
import org.lucares.performance.db.PerformanceDb;
|
||||
import org.lucares.utils.file.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
@@ -92,66 +90,6 @@ public class TcpIngestorTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIngestDataViaTcpStream_CustomFormat() throws Exception {
|
||||
|
||||
final long dateA = Instant.now().toEpochMilli();
|
||||
final long dateB = Instant.now().toEpochMilli() + 1;
|
||||
final long dateC = Instant.now().toEpochMilli() - 1;
|
||||
final DateTimeRange dateRange = DateTimeRange.relativeMinutes(1);
|
||||
final String host = "someHost";
|
||||
|
||||
// 1. insert some data
|
||||
try (TcpIngestor ingestor = new TcpIngestor(dataDirectory)) {
|
||||
ingestor.useRandomPort();
|
||||
ingestor.start();
|
||||
|
||||
final long deltaEpochMilliB = dateB - dateA;
|
||||
final long deltaEpochMilliC = dateC - dateB;
|
||||
|
||||
final String data = "#$0:host=someHost,pod=somePod\n"//
|
||||
+ dateA + ",1,0\n"// previous date is 0, therefore the delta is dateA / using tags with id 0
|
||||
+ "$1:host=someHost,pod=otherPod\n" //
|
||||
+ deltaEpochMilliB + ",2,1\n" // dates are the delta the the previous date / using tags with id 1
|
||||
+ deltaEpochMilliC + ",3,0"; // dates are the delta the the previous date / using tags with id 0
|
||||
|
||||
PdbTestUtil.send(data, ingestor.getPort());
|
||||
} catch (final Exception e) {
|
||||
LOGGER.error("", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
// 2. export the data
|
||||
final List<Path> exportFiles = PdbExport.export(dataDirectory, dataDirectory.resolve("export"));
|
||||
|
||||
// 3. delete database
|
||||
FileUtils.delete(dataDirectory.resolve(DataStore.SUBDIR_STORAGE));
|
||||
|
||||
// 4. create a new database
|
||||
try (TcpIngestor ingestor = new TcpIngestor(dataDirectory)) {
|
||||
ingestor.useRandomPort();
|
||||
ingestor.start();
|
||||
for (final Path exportFile : exportFiles) {
|
||||
PdbTestUtil.send(exportFile, ingestor.getPort());
|
||||
}
|
||||
}
|
||||
|
||||
// 5. check that the data is correctly inserted
|
||||
try (PerformanceDb db = new PerformanceDb(dataDirectory)) {
|
||||
final LongList result = db.get(new Query("host=" + host, dateRange)).singleGroup().flatMap();
|
||||
Assertions.assertEquals(6, result.size());
|
||||
|
||||
Assertions.assertEquals(dateA, result.get(0));
|
||||
Assertions.assertEquals(1, result.get(1));
|
||||
|
||||
Assertions.assertEquals(dateC, result.get(2));
|
||||
Assertions.assertEquals(3, result.get(3));
|
||||
|
||||
Assertions.assertEquals(dateB, result.get(4));
|
||||
Assertions.assertEquals(2, result.get(5));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIngestionThreadDoesNotDieOnErrors() throws Exception {
|
||||
final OffsetDateTime dateA = OffsetDateTime.now().minusMinutes(1);
|
||||
|
||||
Reference in New Issue
Block a user