GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Upgrade Pub/Sub samples. by jmdobry · Pull Request #216 · GoogleCloudPlatform/nodejs-docs-samples

Conversation

@jmdobry

@jmdobry jmdobry commented Sep 26, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • Switch to region tags that match other languages' samples
  • Simplify tests (cut amount of test code in half)
  • Achieved 100% code coverage (as opposed to 95.5% or whatever we've been limited to previously
  • Added sample for creating a Push Subscription
  • Begin to use ES2015 features available in the Node.js 4.5.0 LTS release

Compare to:

  • [DO NOT MERGE] Upgrade Pub/Sub samples. ruby-docs-samples#63
  • [DO NOT MERGE] Upgrade pubsub samples. python-docs-samples#543

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jmdobry
jmdobry force-pushed the pubsub-sample-style branch from b3edcf9 to e5ced9e Compare September 26, 2016 17:40
@jmdobry jmdobry mentioned this pull request Sep 26, 2016
[DO NOT MERGE] Upgrade Pub/Sub samples. GoogleCloudPlatform/ruby-docs-samples#63
Closed
@codecov-io

codecov-io commented Sep 26, 2016 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Current coverage is 90.28% (diff: 100%)

Merging #216 into master will increase coverage by 72.91%

@@             master       #216   diff @@
==========================================
  Files            33         54     +21   
  Lines          1917       2347    +430   
  Methods           0          0           
  Messages          0          0           
  Branches          0          0           
==========================================
+ Hits            333       2119   +1786   
+ Misses         1584        228   -1356   
  Partials          0          0           

Powered by Codecov. Last update ecef164...4d8e931

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jmdobry jmdobry mentioned this pull request Sep 26, 2016
[DO NOT MERGE] Upgrade pubsub samples. GoogleCloudPlatform/python-docs-samples#543
Closed
@jmdobry
jmdobry force-pushed the pubsub-sample-style branch from 66babd4 to 21fb5ab Compare September 26, 2016 18:31
@jmdobry jmdobry assigned ace-n Sep 26, 2016
ace-n
ace-n reviewed Sep 27, 2016
View reviewed changes

@ace-n ace-n left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Mostly LGTM (other than my comments, and assuming all tests pass).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pubsub/subscriptions.js
// See https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/latest/pubsub/subscription?method=delete
subscription.delete(function (err, apiResponse) {
// Lists all subscriptions for the topic
topic.getSubscriptions((err, subscriptions) => {

@ace-n ace-n Sep 27, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'm assuming that this function-calling style is sufficiently idiomatic.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jmdobry jmdobry Sep 27, 2016

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Yep

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pubsub/subscriptions.js

console.log('Got metadata for subscription: %s', subscriptionName);
return callback(null, metadata);
console.log(`Subscription ${subscription.name} created.`);

@ace-n ace-n Sep 27, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

(Same assumption about idiomatic-ness here.)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jmdobry jmdobry Sep 27, 2016

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Yep

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pubsub/subscriptions.js Outdated
console.log('received message: ' + message.data);
console.log(`Subscription: ${metadata.name}`);
console.log(`Topic: ${metadata.topic}`);
console.log(`Push config: %s`, metadata.pushConfig.pushEndpoint);

@ace-n ace-n Sep 27, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

(Nit - I'm assuming we care): is there a way to make this line consistent with the others?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jmdobry jmdobry Sep 27, 2016

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Good catch

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pubsub/subscriptions.js Outdated
var ackIds = messages.map(function (message) {
return message.ackId;
messages.forEach((message) => {
console.log(`* ${message.id} %j %j`, message.data, message.attributes);

@ace-n ace-n Sep 27, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Same nit as above - do we care about consistency in how arguments to console.log are formatted?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jmdobry jmdobry Sep 27, 2016

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Hmm, I'll pull message.id out, because pulling the other two in doesn't work so well.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pubsub/system-test/subscriptions.test.js
done();
});
after((done) => {
pubsub.subscription(subscriptionNameOne).delete(() => {

@ace-n ace-n Sep 27, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Should we be deleting subscriptionNameTwo as well?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jmdobry jmdobry Sep 27, 2016

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Fixed.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pubsub/system-test/subscriptions.test.js
const output = run(`${cmd} list`, cwd);
assert.notEqual(output.indexOf(`Subscriptions:`), -1);
assert.notEqual(output.indexOf(fullSubscriptionNameOne), -1);
done();

@ace-n ace-n Sep 27, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Does fullSubscriptionNameTwo show up here - and if it does, should we check for it?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jmdobry jmdobry Sep 27, 2016

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Fixed

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pubsub/system-test/subscriptions.test.js
// Listing is eventually consistent. Give the indexes time to update.
const output = run(`${cmd} list ${topicName}`, cwd);
assert.notEqual(output.indexOf(`Subscriptions for ${topicName}:`), -1);
assert.notEqual(output.indexOf(fullSubscriptionNameOne), -1);

@ace-n ace-n Sep 27, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Ditto to above comment (fullSubscriptionNameTwo)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jmdobry jmdobry Sep 27, 2016

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Fixed

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pubsub/system-test/topics.test.js
assert(console.log.calledWith('Published %d message(s)!', messageIds.length));
assert.notEqual(apiResponse, undefined);
console.log(JSON.stringify(messages, null, 2));
assert.equal(messages[0].data, message.data);

@ace-n ace-n Sep 27, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'm assuming the newest message always comes first, and that we don't have to worry about message order?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jmdobry jmdobry Sep 27, 2016

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pub/Sub messages are unordered (they can come in any order).

In this test environment, we know there's only one message because we just created the topic and subscription and published a single message.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pubsub/system-test/topics.test.js
assert(console.log.calledWith('Deleted topic: %s', topicName));
assert.notEqual(apiResponse, undefined);
console.log(JSON.stringify(messages, null, 2));
assert.deepEqual(messages[0].data, message);

@ace-n ace-n Sep 27, 2016

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Ditto assumption about message order.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@jmdobry jmdobry Sep 27, 2016

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

See #216 (comment)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jmdobry
Upgrade pubsub samples.
f74c020
@jmdobry

jmdobry commented Sep 27, 2016

Copy link
Copy Markdown
Member Author

Regarding message ordering, I've actually got a new Pub/Sub sample in another branch that shows how to manually enforce ordering with a stateful counter.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jmdobry
Address comments.
eae0a6f
@jmdobry
jmdobry force-pushed the pubsub-sample-style branch from 21fb5ab to eae0a6f Compare September 27, 2016 19:02
@jmdobry
Remove extraneous datastore test that's causing things to fail.
4d8e931
@ace-n

ace-n commented Sep 27, 2016

Copy link
Copy Markdown
Contributor

LGTM, assuming that datastore test is better off removed than skipped. 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ace-n ace-n mentioned this pull request Sep 27, 2016
Adds 6 quickstart examples #218
Merged
@jmdobry

jmdobry commented Sep 27, 2016

Copy link
Copy Markdown
Member Author

I just removed the test because you removed the method it was testing in a previous PR. I'm not sure how we missed the test...

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jmdobry
jmdobry merged commit 35b153f into master Sep 27, 2016
@jmdobry
jmdobry deleted the pubsub-sample-style branch September 27, 2016 22:22
pattishin pushed a commit that referenced this pull request Nov 9, 2022
@irataxy
chore: show cluster installation state details for get and list metho…
7e4880a
…ds (#216)

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [X] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/nodejs-game-servers/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [X] Ensure the tests and linter pass
- [X] Code coverage does not decrease (if any source code was changed)
- [X] Appropriate docs were updated (if necessary)

Fixes b:179738605 🦕
@pattishin pattishin mentioned this pull request Nov 9, 2022
migrate code from googleapis/nodejs-game-servers #2818
Closed
pattishin pushed a commit that referenced this pull request Nov 9, 2022
@irataxy
chore: show cluster installation state details for get and list metho…
d0d186f
…ds (#216)

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [X] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/nodejs-game-servers/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [X] Ensure the tests and linter pass
- [X] Code coverage does not decrease (if any source code was changed)
- [X] Appropriate docs were updated (if necessary)

Fixes b:179738605 🦕
@pattishin pattishin mentioned this pull request Nov 9, 2022
migrate code from googleapis/nodejs-game-servers #2819
Closed
pattishin pushed a commit that referenced this pull request Nov 9, 2022
@irataxy
chore: show cluster installation state details for get and list metho…
9c82bac
…ds (#216)

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [X] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/nodejs-game-servers/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [X] Ensure the tests and linter pass
- [X] Code coverage does not decrease (if any source code was changed)
- [X] Appropriate docs were updated (if necessary)

Fixes b:179738605 🦕
This was referenced Nov 9, 2022
migrate code from googleapis/nodejs-game-servers #2820
Closed
migrate code from googleapis/nodejs-game-servers #2837
Merged
NimJay pushed a commit that referenced this pull request Nov 11, 2022
@irataxy @NimJay
chore: show cluster installation state details for get and list metho…
da80359
…ds (#216)

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [X] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/nodejs-game-servers/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [X] Ensure the tests and linter pass
- [X] Code coverage does not decrease (if any source code was changed)
- [X] Appropriate docs were updated (if necessary)

Fixes b:179738605 🦕
ace-n pushed a commit that referenced this pull request Nov 16, 2022
@telpirion @JustinBeckwith
docs(samples): Adds start of region tag (#216)
527274d
docs(samples): Adds start of region tag
@ace-n ace-n mentioned this pull request Nov 16, 2022
migrate code from googleapis/nodejs-video-intelligence #2855
Merged
ace-n pushed a commit that referenced this pull request Nov 17, 2022
@telpirion Ace Nassri
docs(samples): Adds start of region tag (#216)
deb95e9
docs(samples): Adds start of region tag
ahrarmonsur pushed a commit that referenced this pull request Nov 17, 2022
@telpirion Ahrar Monsur
docs(samples): Adds start of region tag (#216)
68f0cb3
docs(samples): Adds start of region tag
NimJay pushed a commit that referenced this pull request Nov 19, 2022
@yoshi-automation @JustinBeckwith
chore: release 1.1.0 (#216)
368832d
* updated CHANGELOG.md

* updated package.json

* updated samples/package.json
@NimJay NimJay mentioned this pull request Nov 19, 2022
migrate code from googleapis/nodejs-dataproc #2878
Merged
NimJay pushed a commit that referenced this pull request Nov 19, 2022
@yoshi-automation @NimJay
chore: release 1.1.0 (#216)
bf19208
* updated CHANGELOG.md

* updated package.json

* updated samples/package.json
@kweinmeister kweinmeister mentioned this pull request Jan 11, 2023
migrate code from googleapis/nodejs-retail #2975
Merged
kweinmeister pushed a commit that referenced this pull request Jan 11, 2023
@Arakel2811
samples: removed region tags from events and search directories (#216)
f032a03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@ace-n ace-n ace-n left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@ace-n ace-n

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@jmdobry @codecov-io @ace-n
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.