From 7f18be0719edc7981c9de933fd851df91e3f05a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A5le=20Pedersen?= Date: Sat, 7 Oct 2023 13:02:15 +0200 Subject: [PATCH] fixes #726, fixes testImportExport to not be affected by lingering data --- .../tools/horreum/svc/ExperimentServiceImpl.java | 4 ++-- .../hyperfoil/tools/horreum/svc/RunServiceTest.java | 3 +-- .../hyperfoil/tools/horreum/svc/TestServiceTest.java | 12 ++++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/horreum-backend/src/main/java/io/hyperfoil/tools/horreum/svc/ExperimentServiceImpl.java b/horreum-backend/src/main/java/io/hyperfoil/tools/horreum/svc/ExperimentServiceImpl.java index 08ab09b25..7f9afeb2c 100644 --- a/horreum-backend/src/main/java/io/hyperfoil/tools/horreum/svc/ExperimentServiceImpl.java +++ b/horreum-backend/src/main/java/io/hyperfoil/tools/horreum/svc/ExperimentServiceImpl.java @@ -236,7 +236,7 @@ private void runExperiments(DataSet.Info info, Consumer result output -> perProfileLogs.forEach((profileId, pls)-> addLog(pls, info.testId, info.id, PersistentLogDAO.DEBUG, "Baseline filter output: %s", output))); - Map datapoints = DataPointDAO.find("dataset_id = ?1", info.id) + Map datapoints = 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 @@ -248,7 +248,7 @@ private void runExperiments(DataSet.Info info, Consumer result ExperimentProfileDAO profile = ExperimentProfileDAO.findById(entry.getKey()); Map> byVar = new HashMap<>(); List variableIds = profile.comparisons.stream().map(ExperimentComparisonDAO::getVariableId).collect(Collectors.toList()); - DataPointDAO.find("dataset_id IN ?1 AND variable_id IN ?2", Sort.descending("timestamp", "dataset_id"), entry.getValue(), variableIds) + 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 results = new HashMap<>(); for (var comparison : profile.comparisons) { diff --git a/horreum-backend/src/test/java/io/hyperfoil/tools/horreum/svc/RunServiceTest.java b/horreum-backend/src/test/java/io/hyperfoil/tools/horreum/svc/RunServiceTest.java index 87267980c..a3edeaf38 100644 --- a/horreum-backend/src/test/java/io/hyperfoil/tools/horreum/svc/RunServiceTest.java +++ b/horreum-backend/src/test/java/io/hyperfoil/tools/horreum/svc/RunServiceTest.java @@ -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"); @@ -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(); diff --git a/horreum-backend/src/test/java/io/hyperfoil/tools/horreum/svc/TestServiceTest.java b/horreum-backend/src/test/java/io/hyperfoil/tools/horreum/svc/TestServiceTest.java index 23de88e0d..eaea45e16 100644 --- a/horreum-backend/src/test/java/io/hyperfoil/tools/horreum/svc/TestServiceTest.java +++ b/horreum-backend/src/test/java/io/hyperfoil/tools/horreum/svc/TestServiceTest.java @@ -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)); } }); }