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

[improve][test] Print stacktrace when the test fails #18498

Merged
merged 1 commit into from
Nov 16, 2022

Conversation

nodece
Copy link
Member

@nodece nodece commented Nov 16, 2022

Motivation

PulsarTestListener misses print stacktrace when the test fails.

------- Starting test [TestClass name=class org.apache.pulsar.websocket.proxy.v1.V1_ProxyAuthenticationTest].anonymousSocketTest([])-------
2022-11-16T17:50:34,336 - INFO  - [TestNG-method=anonymousSocketTest-1:V1_ProxyAuthenticationTest@127] - Connecting to : ws://localhost:54353/ws/consumer/persistent/prop/use/my-ns/my-topic1/my-sub
!!!!!!!!! FAILURE-- [TestClass name=class org.apache.pulsar.websocket.proxy.v1.V1_ProxyAuthenticationTest].anonymousSocketTest([])-------
org.testng.internal.thread.ThreadTimeoutException: Method org.apache.pulsar.websocket.proxy.v1.V1_ProxyAuthenticationTest.anonymousSocketTest() didn't finish within the time-out 50
	at org.testng.internal.MethodInvocationHelper.invokeWithTimeoutWithNewExecutor(MethodInvocationHelper.java:371)
	at org.testng.internal.MethodInvocationHelper.invokeWithTimeout(MethodInvocationHelper.java:282)
	at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:605)
	at org.testng.internal.TestInvoker.retryFailed(TestInvoker.java:214)
	at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:58)
	at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
	at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.testng.TestRunner.privateRun(TestRunner.java:764)
	at org.testng.TestRunner.run(TestRunner.java:585)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
	at org.testng.SuiteRunner.run(SuiteRunner.java:286)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
	at org.testng.TestNG.runSuites(TestNG.java:1069)
	at org.testng.TestNG.run(TestNG.java:1037)
	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:135)
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:112)
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeLazy(TestNGDirectoryTestSuite.java:123)
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:90)
	at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:146)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
====== THREAD DUMPS ======
2022-11-16 17:50:34

Modifications

Add print stacktrace.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@nodece nodece requested a review from tisonkun November 16, 2022 09:56
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Nov 16, 2022
Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be an improvement to print stack trace at last (so that we can easily find the cause from the tail output).

Although, IIRC the stacktrace can often be logged during tests are running so this stacktrace can be duplicate.

@nodece
Copy link
Member Author

nodece commented Nov 16, 2022

/pulsarbot rerun-failure-checks

@codecov-commenter
Copy link

Codecov Report

Merging #18498 (7fef452) into master (7975023) will increase coverage by 0.23%.
The diff coverage is 59.37%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #18498      +/-   ##
============================================
+ Coverage     45.62%   45.85%   +0.23%     
- Complexity    10075    10123      +48     
============================================
  Files           697      697              
  Lines         68024    68028       +4     
  Branches       7293     7291       -2     
============================================
+ Hits          31033    31196     +163     
+ Misses        33413    33242     -171     
- Partials       3578     3590      +12     
Flag Coverage Δ
unittests 45.85% <59.37%> (+0.23%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...nt/impl/PulsarClientImplementationBindingImpl.java 72.41% <ø> (-0.47%) ⬇️
...ar/client/impl/conf/ConsumerConfigurationData.java 92.55% <ø> (+2.12%) ⬆️
...he/pulsar/client/impl/TypedMessageBuilderImpl.java 30.76% <59.37%> (+3.56%) ⬆️
...java/org/apache/pulsar/proxy/stats/TopicStats.java 58.82% <0.00%> (-41.18%) ⬇️
...er/impl/SingleSnapshotAbortedTxnProcessorImpl.java 51.19% <0.00%> (-3.58%) ⬇️
...ersistentStickyKeyDispatcherMultipleConsumers.java 39.90% <0.00%> (-1.93%) ⬇️
...ransactionBufferSnapshotBaseSystemTopicClient.java 61.33% <0.00%> (-1.34%) ⬇️
...org/apache/bookkeeper/mledger/util/RangeCache.java 65.90% <0.00%> (-1.14%) ⬇️
...sistent/PersistentDispatcherMultipleConsumers.java 47.28% <0.00%> (-1.06%) ⬇️
...a/org/apache/pulsar/proxy/server/ProxyService.java 80.00% <0.00%> (-0.94%) ⬇️
... and 25 more

@nodece nodece merged commit 76308f0 into apache:master Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/test doc-not-needed Your PR changes do not impact docs ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants