Skip to content
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

Fix flaky publisher/OffloadingTest #2751

Merged
merged 1 commit into from
Nov 11, 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 @@ -143,8 +143,8 @@ enum OffloadCase {
}
}

@ParameterizedTest
@EnumSource(OffloadingTest.OffloadCase.class)
@ParameterizedTest(name = "{displayName} [{index}]: case={0}")
@EnumSource(OffloadCase.class)
void testOffloading(OffloadCase offloadCase) throws InterruptedException {
int offloads = testOffloading(offloadCase.offloadOperator, offloadCase.terminal);
assertThat("Unexpected offloads: " + offloadCase.expectedOffloads,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.servicetalk.concurrent.api.AsyncContext;
import io.servicetalk.concurrent.api.Executor;
import io.servicetalk.concurrent.api.ExecutorExtension;
import io.servicetalk.concurrent.api.Executors;
import io.servicetalk.concurrent.api.TestExecutor;
import io.servicetalk.concurrent.internal.DeliberateException;
import io.servicetalk.context.api.ContextMap;
Expand All @@ -28,7 +29,6 @@
import org.slf4j.LoggerFactory;

import static io.servicetalk.concurrent.api.ExecutorExtension.withCachedExecutor;
import static io.servicetalk.concurrent.api.Executors.immediate;
import static io.servicetalk.context.api.ContextMap.Key.newKey;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.startsWith;
Expand Down Expand Up @@ -80,9 +80,10 @@ protected enum TerminalOperation {
protected static final Matcher<String> OFFLOAD_EXECUTOR = startsWith("TestExecutor");

@RegisterExtension
public static final ExecutorExtension<Executor> APP_EXECUTOR_EXT = APP_ISOLATION ?
public static final ExecutorExtension<Executor> APP_EXECUTOR_EXT = (APP_ISOLATION ?
withCachedExecutor(APP_EXECUTOR_PREFIX) :
ExecutorExtension.withExecutor(() -> immediate()).setClassLevel(true);
ExecutorExtension.withExecutor(Executors::immediate))
.setClassLevel(true);
@RegisterExtension
public final ExecutorExtension<TestExecutor> testExecutor = ExecutorExtension.withTestExecutor();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

import org.hamcrest.CoreMatchers;
import org.hamcrest.Matcher;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.EnumSource;

Expand Down Expand Up @@ -50,7 +48,6 @@
import static org.hamcrest.CoreMatchers.nullValue;
import static org.hamcrest.MatcherAssert.assertThat;

@Execution(ExecutionMode.CONCURRENT)
class OffloadingTest extends AbstractPublisherOffloadingTest {

enum OffloadCase {
Expand Down Expand Up @@ -190,7 +187,7 @@ enum OffloadCase {
}
}

@ParameterizedTest
@ParameterizedTest(name = "{displayName} [{index}]: case={0}")
@EnumSource(OffloadCase.class)
void testOffloading(OffloadCase offloadCase) throws InterruptedException {
int offloads = testOffloading(offloadCase.offloadOperator, offloadCase.terminal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ enum OffloadCase {
}
}

@ParameterizedTest
@EnumSource(OffloadingTest.OffloadCase.class)
void testOffloading(OffloadingTest.OffloadCase offloadCase) throws InterruptedException {
@ParameterizedTest(name = "{displayName} [{index}]: case={0}")
@EnumSource(OffloadCase.class)
void testOffloading(OffloadCase offloadCase) throws InterruptedException {
int offloads = testOffloading(offloadCase.offloadOperator, offloadCase.terminal);
assertThat("Unexpected offloads: " + offloadCase.expectedOffloads,
offloads, CoreMatchers.is(offloadCase.offloadsExpected));
Expand Down
Loading