Reactivate coverage; thread timing for test

This commit is contained in:
jeffbanks
2023-01-13 14:56:16 -06:00
parent 28a3ac3ad1
commit c61fac2442
2 changed files with 7 additions and 4 deletions

View File

@@ -34,6 +34,9 @@ jobs:
- name: Running tests
run: mvn -B test
- name: Collecting reports
run: tar -cvf codecov-report.tar target/coverage-report/**/*
- name: Uploading [nosqlbench] test coverage
uses: actions/upload-artifact@v3
with:

View File

@@ -114,7 +114,7 @@ public class ActivityExecutorTest {
@Test
synchronized void testNewActivityExecutor() throws InterruptedException {
ActivityDef ad = ActivityDef.parseActivityDef("driver=diag;alias=test;cycles=100;initdelay=5000;");
ActivityDef ad = ActivityDef.parseActivityDef("driver=diag;alias=test;cycles=1000;initdelay=5000;");
new ActivityTypeLoader().load(ad);
logger.info("Thread id: " + Thread.currentThread().getId());
@@ -134,23 +134,23 @@ public class ActivityExecutorTest {
ActivityExecutor ae = new ActivityExecutor(a, "test-new-executor");
ad.setThreads(5);
ae.startActivity();
// Used for slowing the roll due to state transitions in test.
Thread.sleep(2000L);
int[] speeds = new int[]{1, 2000, 5, 2000, 2, 2000};
for (int offset = 0; offset < speeds.length; offset += 2) {
int threadTarget = speeds[offset];
int threadTime = speeds[offset + 1];
logger.info(() -> "Setting thread level to " + threadTarget + " for " + threadTime + " seconds.");
logger.debug(() -> "Setting thread level to " + threadTarget + " for " + threadTime + " seconds.");
ad.setThreads(threadTarget);
try {
Thread.sleep(threadTime);
logger.info("Thread Id: " + Thread.currentThread().getState() + " State: " + Thread.currentThread().getState());
} catch (InterruptedException ignored) {
}
}
ad.setThreads(0);
// Slow the roll ...
// Used for slowing the roll due to state transitions in test.
Thread.sleep(2000L);
}