Skip to content

Reduce log verbosity in Travis CI environment. #1373

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

Closed
wants to merge 3 commits into from

Conversation

yifanyang
Copy link
Contributor

For succeeded cases, the test in Travis CI environment will no longer display mocha framework logs (for node test) or karma framework logs (for browser test); logs generated by test code itself are still captured and displayed.

Local development still has full logs.

The is to mitigate #535. The number of total log lines on Travis will drop by about 2/3 with this pull request.

Mocha and karma will not show logs for succeeded test cases in CI
environment. Local development still displays full logs.
@@ -0,0 +1,2 @@
--timeout 20000
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to include google license as in the file you deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like only js/ts files require a license header? Js configuration files under the 'config' directory do have a license header, while all the others don't. But I'm not sure. Your call.

P.S. If we decide to add a header in this mocha config file, mocha version needs an upgrade to support the comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we need a license header here. None of other config files that are in .json or other extensions contain a google license header.

@@ -0,0 +1,2 @@
--reporter dot
Copy link
Member

Choose a reason for hiding this comment

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

what does the 2 options do? Is it possible to add comments in the configuration file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we can. That will require us to upgrade mocha to the latest version (5.2.0) in all of our packages. We have 5.0.5 currently.

I can create another pull request to bump the mocha version in all of our SDK packages. Does this kind of change require approvals from all the SDK owners? Or is it okay to upgrade as long as all test continue to pass?

Copy link
Member

Choose a reason for hiding this comment

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

yep, it would require approvals from them. Upgrading should be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created #1375 to upgrade the mocha version. Feel free to add more reviewers who you think should be aware of this change to that pull request.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comments in the file to explain the usage of these flags.

@yifanyang yifanyang force-pushed the yifany-log-verbosity branch from fd4714e to 5ab4d4e Compare November 21, 2018 23:56
@yifanyang
Copy link
Contributor Author

This pull request is to reduce the amount of logs generated during CI test. Another confusion in our log is that in case of an error, lerna will duplicate the same error messages multiple times. This is annoying especially when the log messages contains many lines (e.g. here firestore logs which has thousands of lines got duplicated 4 times). This is tracked as a separate issue in lerna repo here.

@Feiyang1
Copy link
Member

Does lerna duplicate it 4 times? I think lerna just duplicates it once per node and once for browser, so it amounts to 4 error messages?

@mikelehen
Copy link
Contributor

I think we also have mocha configured to retry tests 3 times:

. So that could explain why you see 4 failures.

Copy link
Contributor

@mikelehen mikelehen left a comment

Choose a reason for hiding this comment

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

Do we really need 3 different mocha configs (CI, browser, node)? This seems confusing and I'm concerned that we could end up with different behavior locally vs in travis, which seems very undesirable. Can we just have a single config (or browser vs node if necessary).

@@ -14,7 +14,7 @@
"dev": "rollup -c -w",
"test": "run-p test:browser test:node",
"test:browser": "karma start --single-run",
"test:node": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --compilers ts:ts-node/register/type-check -r src/nodePatches.ts --retries 5 --timeout 5000 --exit",
"test:node": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --compilers ts:ts-node/register/type-check -r src/nodePatches.ts --retries 5 --timeout 5000 --opts ../../config/mocha.node.opts",
Copy link
Contributor

Choose a reason for hiding this comment

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

Hrm. This sets retries / timeout and then pulls in options that are going to set different retries / timeout (and I don't know which one will win). Same issue exists elsewhere.

FWIW- 3 retries seems excessive to me already. I don't know why we ended up with 5 retries in places...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Flags on the command line will override the corresponding ones in mocha.opts, based on the mocha doc here. And what I'm trying to propose is to put all default configurations in the config file and only override them with command line flags when necessary.

I have no idea of the 5 retries.

Copy link
Member

@Feiyang1 Feiyang1 Nov 27, 2018

Choose a reason for hiding this comment

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

Since we created a config file, we should move all the default options into the file. It will be easier for people to read.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. I don't think we actually want to override the defaults in these cases. The defaults should work for both CI and local development AFAIK.

Copy link
Contributor

Choose a reason for hiding this comment

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

(to be clear, by "defaults" I mean what we put in the config file)


# Node doesn't exit after mocha test completion. Supplying this flag for force exit.
# Not applicable in karma + mocha test (browser test).
--exit
Copy link
Contributor

Choose a reason for hiding this comment

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

Am I confused or do we no longer set a timeout / retries in CI?

I'm not opposed to playing with changing these, but I'd want to do it in a separate PR since I think it's orthogonal to the logging output (well, mostly).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the mocha config for node testing.

I think it makes sense to separate out the change for mocha config file. I though it would be simple and straightforward at first, but it does feel confusing in this PR now.

@mikelehen mikelehen removed their assignment Nov 26, 2018
@yifanyang
Copy link
Contributor Author

Does lerna duplicate it 4 times? I think lerna just duplicates it once per node and once for browser, so it amounts to 4 error messages?

I think we also have mocha configured to retry tests 3 times:
. So that could explain why you see 4 failures.

Not exactly. See this example for better demonstration. The failed test in the example is a case in firebase/testing, for which we only have node test but no browser test:

"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"test": "TS_NODE_CACHE=NO nyc --reporter lcovonly -- mocha 'test/{,!(browser)/**/}*.test.ts' --require ts-node/register/type-check --retries 5 --timeout 5000 --exit",
"prepare": "npm run build"
},

The 4 duplicated messages are:

  1. messages printed by mocha;
  2. messages printed by lerna (prefixed with "lerna ERR!");
  3. messages printed by lerna (in the "Error" filed of the error object at the end of the log);
  4. messages printed by lerna (in the "stdout" field of the error object at the end of the log).

@yifanyang
Copy link
Contributor Author

This pr essentially tries to introduce below two changes. It's more clear to track them separately as these two changes are less related to each other. Closing this pr.

@yifanyang yifanyang closed this Jan 10, 2019
@yifanyang yifanyang deleted the yifany-log-verbosity branch January 10, 2019 00:44
@firebase firebase locked and limited conversation to collaborators Oct 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants