Skip to content

Commit

Permalink
fix failing tests that relied on a bug to succeed
Browse files Browse the repository at this point in the history
  • Loading branch information
adejanovski committed Dec 17, 2024
1 parent ae5b482 commit 139464a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ public void a_new_daily_repair_schedule_is_added_for_the_last_added_cluster_and_
params.put("intensity", "0.9");
params.put("scheduleDaysBetween", "1");
params.put("scheduleTriggerTime", DateTime.now().plusSeconds(1).toString());
params.put("segmentCountPerNode", "1");
ReaperTestJettyRunner runner = RUNNERS.get(RAND.nextInt(RUNNERS.size()));
Response response = runner.callReaper("POST", "/repair_schedule", Optional.of(params));
int responseStatus = response.getStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@

package io.cassandrareaper.acceptance;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Comparator;
import java.util.stream.Stream;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.AfterClass;
Expand All @@ -25,6 +32,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


@RunWith(Cucumber.class)
@CucumberOptions(
features = {
Expand All @@ -46,6 +54,8 @@ public static void setUp() throws Exception {
"setting up testing Reaper runner with {} seed hosts defined and memory storage",
TestContext.TEST_CLUSTER_SEED_HOSTS.size());

// We now have persistence in the memory store, so we need to clean up the storage folder before starting the tests
deleteFolderContents("/tmp/reaper/storage/");
runner = new ReaperTestJettyRunner(MEMORY_CONFIG_FILE);
BasicSteps.addReaperRunner(runner);
}
Expand All @@ -56,4 +66,18 @@ public static void tearDown() {
runner.runnerInstance.after();
}

public static void deleteFolderContents(String folderPath) throws IOException {
Path path = Paths.get(folderPath);
try (Stream<Path> walk = Files.walk(path)) {
walk.sorted(Comparator.reverseOrder())
.forEach(p -> {
try {
Files.delete(p);
} catch (IOException e) {
throw new RuntimeException("Failed to delete " + p, e);
}
});
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ enableDynamicSeedList: false
jmxConnectionTimeoutInSeconds: 10
datacenterAvailability: LOCAL
percentRepairedCheckIntervalMinutes: 1
repairManagerSchedulingIntervalSeconds: 0
repairManagerSchedulingIntervalSeconds: 1

logging:
level: WARN
Expand Down

0 comments on commit 139464a

Please sign in to comment.