Skip to content

Commit

Permalink
fixes #726, fixes testImportExport to not be affected by lingering data
Browse files Browse the repository at this point in the history
  • Loading branch information
stalep committed Oct 7, 2023
1 parent 46163c6 commit 7f18be0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private void runExperiments(DataSet.Info info, Consumer<ExperimentResult> result
output -> perProfileLogs.forEach((profileId, pls)-> addLog(pls, info.testId, info.id,
PersistentLogDAO.DEBUG, "Baseline filter output: %s", output)));

Map<Integer, DataPointDAO> datapoints = DataPointDAO.<DataPointDAO>find("dataset_id = ?1", info.id)
Map<Integer, DataPointDAO> datapoints = DataPointDAO.<DataPointDAO>find("dataset.id = ?1", info.id)
.stream().collect(Collectors.toMap(dp -> dp.variable.id, Function.identity(),
// defensive merge: although we should not be able to load any old datapoints
// (with identical dataset_id+variable_id combo) these may temporarily appear
Expand All @@ -248,7 +248,7 @@ private void runExperiments(DataSet.Info info, Consumer<ExperimentResult> result
ExperimentProfileDAO profile = ExperimentProfileDAO.findById(entry.getKey());
Map<Integer, List<DataPointDAO>> byVar = new HashMap<>();
List<Integer> variableIds = profile.comparisons.stream().map(ExperimentComparisonDAO::getVariableId).collect(Collectors.toList());
DataPointDAO.<DataPointDAO>find("dataset_id IN ?1 AND variable_id IN ?2", Sort.descending("timestamp", "dataset_id"), entry.getValue(), variableIds)
DataPointDAO.<DataPointDAO>find("dataset.id IN ?1 AND variable.id IN ?2", Sort.descending("timestamp", "dataset_id"), entry.getValue(), variableIds)
.stream().forEach(dp -> byVar.computeIfAbsent(dp.variable.id, v -> new ArrayList<>()).add(dp));
Map<ExperimentComparison, ComparisonResult> results = new HashMap<>();
for (var comparison : profile.comparisons) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,6 @@ public void testJavascriptExecution() throws InterruptedException {
Assertions.assertEquals("foobar", preview.value.textValue());
}

@Disabled
@org.junit.jupiter.api.Test
public void runExperiment() throws InterruptedException {
Test test = createExampleTest("supersecret");
Expand Down Expand Up @@ -785,7 +784,7 @@ public void runExperiment() throws InterruptedException {
lblBuildID.owner = test.owner;
lblBuildID.metrics = false;
lblBuildID.filtering = true;
lblBuildID.id = addOrUpdateLabel(schema.id, lblBuildID);
//lblBuildID.id = addOrUpdateLabel(schema.id, lblBuildID);

//3. Config change detection variables
Variable variable = new Variable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,13 @@ private void testImportExport(boolean wipe) {
TestUtil.eventually(() -> {
em.clear();
try (var h = roleManager.withRoles(Collections.singleton(Roles.HORREUM_SYSTEM))) {
assertEquals(0, TestDAO.count());
assertEquals(0, ActionDAO.count());
assertEquals(0, VariableDAO.count());
assertEquals(0, TestDAO.count("id = ?1", test.id));
assertEquals(0, ActionDAO.count("testId = ?1", test.id));
assertEquals(0, VariableDAO.count("testId = ?1", test.id));
assertEquals(0, ChangeDetectionDAO.count());
assertEquals(0, MissingDataRuleDAO.count());
assertEquals(0, ExperimentProfileDAO.count());
assertEquals(0, WatchDAO.count());
assertEquals(0, MissingDataRuleDAO.count("test.id = ?1", test.id));
assertEquals(0, ExperimentProfileDAO.count("test.id = ?1", test.id));
assertEquals(0, WatchDAO.count("test.id = ?1", test.id));
}
});
}
Expand Down

0 comments on commit 7f18be0

Please sign in to comment.