GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Upgrade Pub/Sub samples. by jmdobry · Pull Request #216 · GoogleCloudPlatform/nodejs-docs-samples Conversation
|
Current coverage is 90.28% (diff: 100%)@@ 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
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
66babd4 to
21fb5ab
Compare
There was a problem 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.
There was an error while loading. Please reload this page.
| // 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) => { |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yep
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| console.log('Got metadata for subscription: %s', subscriptionName); | ||
| return callback(null, metadata); | ||
| console.log(`Subscription ${subscription.name} created.`); |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yep
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| console.log('received message: ' + message.data); | ||
| console.log(`Subscription: ${metadata.name}`); | ||
| console.log(`Topic: ${metadata.topic}`); | ||
| console.log(`Push config: %s`, metadata.pushConfig.pushEndpoint); |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Good catch
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| var ackIds = messages.map(function (message) { | ||
| return message.ackId; | ||
| messages.forEach((message) => { | ||
| console.log(`* ${message.id} %j %j`, message.data, message.attributes); |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
| done(); | ||
| }); | ||
| after((done) => { | ||
| pubsub.subscription(subscriptionNameOne).delete(() => { |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| const output = run(`${cmd} list`, cwd); | ||
| assert.notEqual(output.indexOf(`Subscriptions:`), -1); | ||
| assert.notEqual(output.indexOf(fullSubscriptionNameOne), -1); | ||
| done(); |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| // 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); |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| 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); |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
| 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); |
There was a problem 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.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
See #216 (comment)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
21fb5ab to
eae0a6f
Compare
|
LGTM, assuming that datastore test is better off removed than skipped. 👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
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... |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…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 🦕
…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 🦕
…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 🦕
…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 🦕
docs(samples): Adds start of region tag
docs(samples): Adds start of region tag
docs(samples): Adds start of region tag
* updated CHANGELOG.md * updated package.json * updated samples/package.json
* updated CHANGELOG.md * updated package.json * updated samples/package.json
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.