Skip to content

Commit

Permalink
Skip racey TCK test
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Jun 13, 2019
1 parent 3935835 commit f63562e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,40 @@
import org.eclipse.microprofile.rest.client.tck.ClientHeaderParamTest;
import org.eclipse.microprofile.rest.client.tck.InvokeWithJsonBProviderTest;
import org.eclipse.microprofile.rest.client.tck.InvokeWithJsonPProviderTest;
import org.eclipse.microprofile.rest.client.tck.asynctests.AsyncMethodTest;
import org.testng.IAnnotationTransformer;
import org.testng.IConfigurable;
import org.testng.IConfigureCallBack;
import org.testng.ITestNGMethod;
import org.testng.ITestResult;
import org.testng.annotations.ITestAnnotation;

public class SkipTestsThatThrowNoClassDefFound implements IConfigurable, IAnnotationTransformer {
public class SkipProblematicTests implements IConfigurable, IAnnotationTransformer {

private static final Set<String> TESTS_THAT_THROW_CLASS_NOT_FOUND = new HashSet<>(Arrays.asList(
InvokeWithJsonBProviderTest.class.getName(), InvokeWithJsonPProviderTest.class.getName(),
ClientHeaderParamTest.class.getName()));

private static final Set<String> RACEY_TESTS = new HashSet<>(Arrays.asList(
//testAsyncInvocationInterceptorProvider is racey, as there is no guarantee the
//removeThreadId has been set by the time the test attempts to assert it, this is
//because the removeContext action happens after the response is provided, so the
//completion stage is complete before this method is called
AsyncMethodTest.class.getName()));

private static final Set<String> SKIP;

static {
SKIP = new HashSet<>();
SKIP.addAll(TESTS_THAT_THROW_CLASS_NOT_FOUND);
SKIP.addAll(RACEY_TESTS);
}

// ensures that the methods annotated with @BeforeTest don't run (since this is where the exception is thrown)
@Override
public void run(IConfigureCallBack callBack, ITestResult testResult) {
ITestNGMethod method = testResult.getMethod();
if (TESTS_THAT_THROW_CLASS_NOT_FOUND.contains(method.getTestClass().getName())) {
if (SKIP.contains(method.getTestClass().getName())) {
return;
}

Expand All @@ -37,7 +53,7 @@ public void run(IConfigureCallBack callBack, ITestResult testResult) {
@Override
public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) {
String className = testClass != null ? testClass.getName() : testMethod.getDeclaringClass().getName();
if (TESTS_THAT_THROW_CLASS_NOT_FOUND.contains(className)) {
if (SKIP.contains(className)) {
annotation.setEnabled(false);
}
}
Expand Down
4 changes: 3 additions & 1 deletion tcks/microprofile-rest-client/tck-suite.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
java.lang.NoClassDefFoundError: org/jboss/resteasy/specimpl/ResteasyUriBuilder
These need to be disabled completely because simply ignoring all methods is not good enough
as the exception occurs during @BeforeTest
There are also some tests that are inherently racey
-->
<listeners>
<listener class-name="io.quarkus.tck.restclient.SkipTestsThatThrowNoClassDefFound" />
<listener class-name="io.quarkus.tck.restclient.SkipProblematicTests" />
</listeners>

<test name="microprofile-rest-client 1.2 TCK">
Expand Down

0 comments on commit f63562e

Please sign in to comment.