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

Should limit console output of unit test #3361

Closed
2 tasks done
biyuhao opened this issue Jan 26, 2019 · 5 comments · Fixed by #3383
Closed
2 tasks done

Should limit console output of unit test #3361

biyuhao opened this issue Jan 26, 2019 · 5 comments · Fixed by #3383
Labels
help wanted Everything needs help from contributors
Milestone

Comments

@biyuhao
Copy link
Member

biyuhao commented Jan 26, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: master branch
  • Operating System version: xxx
  • Java version: xxx

Steps to reproduce this issue

Travis-cli has a 4MB hard limit of log size [1].
Currently, our Travis log[2] is about 3.98MB, we are almost there.
We can reduce some trivial log in the console output, but keep a full log in the local file.

For example, test case org.apache.dubbo.rpc.validation.�ValidationTest� eats about 1.3MB in travis log. We can start from here.

[1]. https://docs.travis-ci.com/user/common-build-problems/#log-length-exceeded
[2]. https://api.travis-ci.org/v3/job/484750418/log.txt

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

What do you expected from the above steps?

Actual Result

What actually happens?

If there is an exception, please attach the exception trace:

Just put your stack trace here!
@tswstarplanet tswstarplanet added the help wanted Everything needs help from contributors label Jan 26, 2019
@ralf0131
Copy link
Contributor

+1 do you have any plan how to do this?

@biyuhao
Copy link
Member Author

biyuhao commented Jan 28, 2019

There are many logs printed to console by DubboAppender.
DubboAppender is extended from ConsoleAppender, it will print to console then cache the log in memory, and some unit test case are depending on it.

I am trying to make DubboAppender extend from FileAppender, it will print to the local file instead of the console without breaking any unit test logic.
I did some test in my forked repo, here is the patch biyuhao@b4b7812

And the corresponding Travis log
https://api.travis-ci.org/v3/job/485302374/log.txt
https://api.travis-ci.org/v3/job/485302373/log.txt

As you can see, after this tweak, the Travis log dropped to about 1.51MB.
I'm not sure if there is any better idea. If this solution is fine I'll send a PR.

@ralf0131
Copy link
Contributor

In this way, if there is some error, are we able to check the file for detailed exception?

@biyuhao
Copy link
Member Author

biyuhao commented Jan 29, 2019

for Travis environment

We can output all the unit test log to one local file maybe PROJECT_ROOT/dubbo.log.
If there is some error, use Travis after_failure to print last information of dubbo.log.

after_failure:
  - if [ -f dubbo.log ]; then echo "------TAIL of dubbo.log------"; tail -n 1000 dubbo.log; echo "------END of dubbo.log------"; fi

I simulated a test failure, and the Travis log is https://api.travis-ci.org/v3/job/485746697/log.txt

travis_time:end:238f76ac:start=1548741013072176158,finish=1548741024298622064,duration=11226445906
�[0Ktravis_fold:end:cache.2
�[0K
travis_fold:start:after_failure
�[0Ktravis_time:start:2672b980
�[0K$ if [ -f dubbo.log ]; then echo "------TAIL of dubbo.log------"; tail -n 1000 dubbo.log; echo "------END of dubbo.log------";fi
------TAIL of dubbo.log------
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:582)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:499)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:461)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: TestService
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)

// SOME STACK INFO HERE

	... 27 more
2019-01-29 05:50:12,177 WARN [org.apache.dubbo.remoting.transport.AbstractServer:disconnected] -  [DUBBO] All clients has disconnected from /172.17.0.1:34644. You can graceful shutdown now., dubbo version: 2.7.1-SNAPSHOT, current host: 172.17.0.1
------END of dubbo.log------
travis_time:end:2672b980:start=1548741024303108412,finish=1548741024308579986,duration=5471574
�[0Ktravis_fold:end:after_failure
�[0K
Done. Your build exited with 1.

for local environment

We can always check the full content of the local file log.

If everything is fine, the Travis log will be like https://api.travis-ci.org/v3/job/485755453/log.txt
And the full view of the commit biyuhao@1a103d1

@ralf0131
Copy link
Contributor

@biyuhao Thanks for the explanation. That's what I want!

biyuhao added a commit to biyuhao/dubbo that referenced this issue Jan 29, 2019
@beiwei30 beiwei30 added this to the 2.7.1 milestone Mar 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Everything needs help from contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants