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

Check in Cloud Job Discovery quick start #684

Merged
merged 9 commits into from
Jul 17, 2018

Conversation

xinyunh0929
Copy link
Contributor

CJD got Public beta launch so we would like to have our samples checked in as other projects.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jul 11, 2018
@xinyunh0929
Copy link
Contributor Author

I saw the other team writing the test using 'ava'. Could we use 'mocha' instead?

@codecov
Copy link

codecov bot commented Jul 12, 2018

Codecov Report

Merging #684 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #684   +/-   ##
=======================================
  Coverage   48.52%   48.52%           
=======================================
  Files           1        1           
  Lines          68       68           
=======================================
  Hits           33       33           
  Misses         35       35

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bfdbab3...b73b47a. Read the comment docs.

@ace-n
Copy link
Contributor

ace-n commented Jul 13, 2018

IIRC we use Ava since it supports parallel test running - @jmdobry can confirm.

Copy link
Contributor

@ace-n ace-n left a comment

Choose a reason for hiding this comment

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

Mostly LGTM, but with a few nits.

I'll be OOO next week, so @happyhuman / @fhinkel can take it from here.


# Google Cloud Job Discovery API Samples

Cloud Job Discovery is part of Google for Jobs - a Google-wide commitment to help
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this autogenerated using repo-tools generate? If not, it should be.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean the README should be generated from repo-tools generate?
Current README is written by myself. Should I remove it then run repo-tools generate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

generate: Generating lib_readme in: /usr/local/google/home/xinyunh/githubCode/nodeJsPersonalFork/nodejs-docs-samples/jobs/cjd_sample
generate: Compiling: /usr/local/google/home/xinyunh/githubCode/nodeJsPersonalFork/nodejs-docs-samples/jobs/cjd_sample/README.md
generate: Failed to generate: /usr/local/google/home/xinyunh/githubCode/nodeJsPersonalFork/nodejs-docs-samples/jobs/cjd_sample/README.md
generate: Oh no! Generating failed after 0.0230s.
generate: TypeError: Cannot read property 'toUpperCase' of undefined
at Object.exports.createReleaseQualityBadge (/usr/lib/node_modules/@google-cloud/nodejs-repo-tools/cjs/utils/index.js:222:35)
at Object.eval [as main] (eval at createFunctionContext (/usr/lib/node_modules/@google-cloud/nodejs-repo-tools/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:254:23), :12:88)
at main (/usr/lib/node_modules/@google-cloud/nodejs-repo-tools/node_modules/handlebars/dist/cjs/handlebars/runtime.js:175:32)
at ret (/usr/lib/node_modules/@google-cloud/nodejs-repo-tools/node_modules/handlebars/dist/cjs/handlebars/runtime.js:178:12)
at ret (/usr/lib/node_modules/@google-cloud/nodejs-repo-tools/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:526:21)
at /usr/lib/node_modules/@google-cloud/nodejs-repo-tools/cjs/cli/commands/generate.js:276:46
at Array.forEach ()
at Object.exports.handler (/usr/lib/node_modules/@google-cloud/nodejs-repo-tools/cjs/cli/commands/generate.js:238:16)
at Object.runCommand (/usr/lib/node_modules/@google-cloud/nodejs-repo-tools/node_modules/yargs/lib/command.js:235:44)
at Object.parseArgs [as _parseArgs] (/usr/lib/node_modules/@google-cloud/nodejs-repo-tools/node_modules/yargs/yargs.js:1014:30)

// [START quickstart]

// Imports the Google APIs client library
const {google} = require('googleapis');
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a client library specifically for this, as opposed to googleapis? (Paging @theacodes)

return;
}

console.log('Request ID: ' + result.data.metadata.requestId);
Copy link
Contributor

Choose a reason for hiding this comment

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

Two nits:

  1. Use promises
  2. Use template strings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I am not too familiar with nodeJs. How could I use promise in this case?

@@ -0,0 +1,62 @@
/**
* Copyright 2017, Google, Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. LLC instead of Inc.

return;
}

if (authClient.createScopedRequired && authClient.createScopedRequired()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not familiar with authClient object. Does it have a field and a method both named createScopedRequired? Is it needed to check both of them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure. I just the follow the same way 'kms' did in their samples for authentication.

@@ -0,0 +1,24 @@
/**
* Copyright 2017, Google, Inc.
Copy link
Contributor

Choose a reason for hiding this comment

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

2018 LLC

Copy link
Contributor

@happyhuman happyhuman left a comment

Choose a reason for hiding this comment

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

LGTM, assuming the comments made by other reviewers are addressed as well.

@happyhuman happyhuman merged commit 022055e into GoogleCloudPlatform:master Jul 17, 2018
ahrarmonsur pushed a commit that referenced this pull request Nov 18, 2022
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
ahrarmonsur pushed a commit that referenced this pull request Nov 18, 2022
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
NimJay pushed a commit that referenced this pull request Nov 18, 2022
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
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.

4 participants