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

refactor: convert samples test from ava to mocha #190

Merged
merged 9 commits into from
Nov 16, 2018

Conversation

nareshqlogic
Copy link
Contributor

@nareshqlogic nareshqlogic commented Oct 30, 2018

Fixes convert all sample tests from ava to mocha #2865(googleapis/google-cloud-node#2865) (it's a good idea to open an issue first for discussion)

  • Tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 30, 2018
@DominicKramer
Copy link
Contributor

Thank you for opening this PR. For completeness, can you please provide a short summary of why this change is needed for those that don't want to log in to view the link you referenced. Thanks.

@JustinBeckwith
Copy link
Contributor

@DominicKramer this is same as the other, we're trying to consistently use mocha for all the tests.

samples/system-test/express.test.js Outdated Show resolved Hide resolved
@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 30, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 30, 2018
@DominicKramer
Copy link
Contributor

@JustinBeckwith ok sounds good 👍

@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 31, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Oct 31, 2018
@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 12, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 12, 2018
@nareshqlogic
Copy link
Contributor Author

nareshqlogic commented Nov 13, 2018

Hi @JustinBeckwith ,
Sample test is getting failed because the value of constant APP_LOG_SUFFIX is undefined as there is no property APP_LOG_SUFFIX in lb.express object. So let me know can I remove two lines
const lb = require('@google-cloud/logging-bunyan');
const {APP_LOG_SUFFIX} = lb.express;

and also change the line no 48
from const log = logging.log(samples_express_${APP_LOG_SUFFIX});
to const log = logging.log(samples_express);

Kindly provide your feedback.
express test js_failed

@JustinBeckwith
Copy link
Contributor

👋 Thanks for the heads up. I think someone on @googleapis/node-team may be better suited to answer this though :)

@ofrobots
Copy link
Contributor

@JustinBeckwith the export APP_LOG_SUFFIX was added in 5ab8724. This has not been released yet.

I guess what this implies is that we cannot update the samples at the same time as adding a feature to the library – because the samples can only test released versions. IMHO, it would be unnecessary hardship for features to be split so that the sample change happens separately after the feature gets released. Either we have to figure out a better way to test samples, or live with the fact that samples will be broken until a new feature gets shipped in a release.

TL;DR: this should get fixed after a new release gets shipped.

@JustinBeckwith
Copy link
Contributor

@ofrobots That shouldn't be the case. The script we use to test samples does an npm link ../ in the samples directory, pulling in the sources.

@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 13, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 13, 2018
@ofrobots
Copy link
Contributor

@JustinBeckwith can you point to the script? If what you say is true, then that script is no longer working correctly.

@JustinBeckwith
Copy link
Contributor

Sure - that's done in all of our CircleCI scripts here:
https://github.com/googleapis/nodejs-logging-bunyan/blob/master/.circleci/config.yml#L88

Is it possible it isn't happening in the kokoro script @kinwa91?

@JustinBeckwith
Copy link
Contributor

@JustinBeckwith JustinBeckwith added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 16, 2018
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Nov 16, 2018
@ofrobots
Copy link
Contributor

ofrobots commented Nov 16, 2018

The error is unexplainable then. I'm looking into it further =)

@ofrobots
Copy link
Contributor

So here, an issue.. I am not sure if it is a problem yet.

This code installs a link. Then we run npm run samples-tests in the parent directory.

npm run samples-test

Which installs the link again.

"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",

@ofrobots
Copy link
Contributor

The sample test seems to be passing on the latest run even though the status has been updated here.

@JustinBeckwith JustinBeckwith changed the title #3105:nodejs-logging-bunyan: Convert samples test from ava to mocha refactor: convert samples test from ava to mocha Nov 16, 2018
@JustinBeckwith
Copy link
Contributor

The system test failures appear to be unrelated, and I filed an issue in #204 to track that part.

@JustinBeckwith JustinBeckwith merged commit 9865e8d into googleapis:master Nov 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants