Skip to content

Bug fix for suite execution & additional logging #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.github.noconnor.junitperf.statistics.StatisticsCalculator;
import com.google.common.util.concurrent.RateLimiter;
import lombok.Builder;
import lombok.extern.slf4j.Slf4j;

import java.util.function.Supplier;

Expand All @@ -11,6 +12,7 @@
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.NANOSECONDS;

@Slf4j
final class EvaluationTask implements Runnable {

private final TestStatement statement;
Expand Down Expand Up @@ -76,7 +78,7 @@ private void evaluateStatement(long startMeasurements) {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (Throwable throwable) {
// IGNORE
log.trace("Warmup error", throwable);
}
} else {

Expand All @@ -85,6 +87,7 @@ private void evaluateStatement(long startMeasurements) {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (Throwable throwable) {
log.trace("Setup error", throwable);
throw new IllegalStateException("Before method failed", throwable);
}

Expand All @@ -101,13 +104,15 @@ private void evaluateStatement(long startMeasurements) {
stats.incrementErrorCount();
stats.addLatencyMeasurement(nanoTime() - startTimeNs);
}
log.trace("Execution error", throwable);
}

try {
statement.runAfters();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (Throwable throwable) {
log.trace("Teardown error", throwable);
throw new IllegalStateException("After method failed", throwable);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,13 @@ public void interceptTestMethod(Invocation<Void> invocation,
test.setMeasurementsStartTimeMs(currentTimeMillis() + perfTestAnnotation.warmUpMs());
test.setContext(context);

SimpleTestStatement testStatement = () -> method.invoke(
extensionContext.getRequiredTestInstance(),
invocationContext.getArguments().toArray()
);
SimpleTestStatement testStatement = () -> {
method.setAccessible(true);
method.invoke(
extensionContext.getRequiredTestInstance(),
invocationContext.getArguments().toArray()
);
};

PerformanceEvaluationStatement parallelExecution = test.getStatementBuilder()
.baseStatement(testStatement)
Expand Down Expand Up @@ -198,7 +201,7 @@ private static void proceedQuietly(Invocation<Void> invocation) throws Throwable
// Must be called for framework to proceed
invocation.proceed();
} catch (Throwable e) {
// Ignore
log.trace("Proceed error", e);
}
}

Expand Down