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

Making test less flakily fail #1321

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

java-codehunger
Copy link

@java-codehunger java-codehunger commented Mar 30, 2023

Description

This test is flakily fails. I run this test many times and it makes assertion fails.

Related Issue

I was running this test many times and it fails. The failure message is.

Failure:
java.lang.AssertionError
at org.junit.Assert.fail(Assert.java:86)
at org.junit.Assert.assertTrue(Assert.java:41)
at org.junit.Assert.assertTrue(Assert.java:52)
at org.java_websocket.issues.Issue997Test.test_localServer_ServerLocalhost_ClientLocalhost_CheckInactive(Issue997Test.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:750)

Results :

Failed tests: test_localServer_ServerLocalhost_ClientLocalhost_CheckInactive(org.java_websocket.issues.Issue997Test)

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

Motivation and Context

It will reduce the chances of flaky failure.

How Has This Been Tested?

I run the test in Ubuntu 20 with JDK both 8 and 11.

Types of changes

  • I simply add a little wait time before the assertion checking.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant