Skip to content

Commit 3f01f61

Browse files
callmehiphopstephenplusplus
authored andcommitted
update cluster links and option handling (#1420)
bigtable: update cluster links and option handling
1 parent 4bce495 commit 3f01f61

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ job.getQueryResults().on('data', function(row) {});
127127
- [API Documentation][gcloud-bigtable-docs]
128128
- [Official Documentation][cloud-bigtable-docs]
129129

130-
*You may need to [create a cluster][gcloud-bigtable-cluster] to use the Google Cloud Bigtable API with your project.*
130+
*You may need to [create a cluster][cloud-bigtable-cluster] to use the Google Cloud Bigtable API with your project.*
131131

132132
#### Preview
133133

@@ -741,7 +741,7 @@ Apache 2.0 - See [COPYING](COPYING) for more information.
741741
[cloud-bigquery-docs]: https://cloud.google.com/bigquery/what-is-bigquery
742742

743743
[cloud-bigtable-docs]: https://cloud.google.com/bigtable/docs/
744-
[cloud-bigtable-cluster]: https://cloud.google.com/bigtable/docs/creating-cluster
744+
[cloud-bigtable-cluster]: https://cloud.google.com/bigtable/docs/creating-compute-instance
745745

746746
[cloud-compute-docs]: https://cloud.google.com/compute/docs
747747

lib/bigtable/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var googleProtoFiles = require('google-proto-files');
2424
var is = require('is');
2525
var nodeutil = require('util');
2626
var format = require('string-format-obj');
27+
var extend = require('extend');
2728

2829
/**
2930
* @type {module:bigtable/table}
@@ -56,7 +57,7 @@ var util = require('../common/util.js');
5657
* To learn more about Bigtable, read the
5758
* [Google Cloud Bigtable Concepts Overview](https://cloud.google.com/bigtable/docs/concepts)
5859
*
59-
* @resource [Creating a Cloud Bigtable Cluster]{@link https://cloud.google.com/bigtable/docs/creating-cluster}
60+
* @resource [Creating a Cloud Bigtable Cluster]{@link https://cloud.google.com/bigtable/docs/creating-compute-instance}
6061
*
6162
* @param {object=} options - [Configuration object](#/docs).
6263
* @param {string} options.cluster - The cluster name that hosts your tables.
@@ -80,7 +81,7 @@ var util = require('../common/util.js');
8081
* // Before you create your table, you first need to create a Bigtable Cluster
8182
* // for the table to be served from. This can be done from either the
8283
* // Google Cloud Platform Console or the `gcloud` cli tool. Please refer to
83-
* // the <a href="https://cloud.google.com/bigtable/docs/creating-cluster">
84+
* // the <a href="https://cloud.google.com/bigtable/docs/creating-compute-instance">
8485
* // official Bigtable documentation</a> for more information.
8586
* //-
8687
*
@@ -280,11 +281,9 @@ function Bigtable(options) {
280281
return new Bigtable(options);
281282
}
282283

283-
options = {
284-
projectId: options.projectId,
285-
zone: options.zone.name || options.zone,
286-
cluster: options.cluster
287-
};
284+
options = extend({}, options, {
285+
zone: options.zone.name || options.zone
286+
});
288287

289288
this.clusterName = format(
290289
'projects/{projectId}/zones/{zone}/clusters/{cluster}',

test/bigtable/index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,24 @@ describe('Bigtable', function() {
110110
fakeUtil.normalizeArguments = normalizeArguments;
111111
});
112112

113+
it('should leave the original options unaltered', function() {
114+
var fakeOptions = {
115+
a: 'a',
116+
b: 'b',
117+
c: 'c',
118+
zone: 'zone'
119+
};
120+
121+
var bigtable = new Bigtable(fakeOptions);
122+
var options = bigtable.calledWith_[1];
123+
124+
for (var option in fakeOptions) {
125+
assert.strictEqual(fakeOptions[option], options[option]);
126+
}
127+
128+
assert.notStrictEqual(fakeOptions, options);
129+
});
130+
113131
it('should localize the cluster name', function() {
114132
assert.strictEqual(bigtable.clusterName, CLUSTER_NAME);
115133
});

0 commit comments

Comments
 (0)