Skip to content

Commit c9dd9c6

Browse files
authored
fix: Wait for instances to get created in all samples (#1149)
* Wait for instances to get created in all samples * fix: Wait for instances to get created in all samples
1 parent 82816af commit c9dd9c6

File tree

6 files changed

+13
-7
lines changed

6 files changed

+13
-7
lines changed

samples/test/app-profile.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ const appProfileSnippets = require('./app-profile.js');
2828
const instance = bigtable.instance(INSTANCE_ID);
2929

3030
describe.skip('App Profile Snippets', () => {
31-
before(() => {
32-
instance.create({
31+
before(async () => {
32+
const [, operation] = await instance.create({
3333
clusters: [
3434
{
3535
name: CLUSTER_ID,
@@ -39,6 +39,7 @@ describe.skip('App Profile Snippets', () => {
3939
],
4040
type: 'DEVELOPMENT',
4141
});
42+
await operation.promise();
4243
});
4344

4445
after(() => {

samples/test/cluster.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const instance = bigtable.instance(INSTANCE_ID);
2929
describe.skip('Cluster Snippets', () => {
3030
before(async () => {
3131
try {
32-
await instance.create({
32+
const [, operation] = await instance.create({
3333
clusters: [
3434
{
3535
name: CLUSTER_ID,
@@ -39,6 +39,7 @@ describe.skip('Cluster Snippets', () => {
3939
],
4040
type: 'DEVELOPMENT',
4141
});
42+
await operation.promise();
4243
} catch (err) {
4344
// Handle the error.
4445
}

samples/test/family.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const instance = bigtable.instance(INSTANCE_ID);
3131
describe.skip('Family Snippets', () => {
3232
before(async () => {
3333
try {
34-
await instance.create({
34+
const [, operation] = await instance.create({
3535
clusters: [
3636
{
3737
name: CLUSTER_ID,
@@ -41,6 +41,7 @@ describe.skip('Family Snippets', () => {
4141
],
4242
type: 'DEVELOPMENT',
4343
});
44+
await operation.promise();
4445
await instance.createTable(TABLE_ID);
4546
} catch (err) {
4647
//

samples/test/instances.test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const instance = bigtable.instance(instanceId);
2929

3030
describe('instances', () => {
3131
before(async () => {
32-
await instance.create({
32+
const [, operation] = await instance.create({
3333
clusters: [
3434
{
3535
id: clusterId,
@@ -38,6 +38,7 @@ describe('instances', () => {
3838
},
3939
],
4040
});
41+
await operation.promise();
4142
});
4243

4344
after(() => instance.delete());

samples/test/row.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const instance = bigtable.instance(INSTANCE_ID);
3030
describe.skip('Row Snippets', () => {
3131
before(async () => {
3232
try {
33-
await instance.create({
33+
const [, operation] = await instance.create({
3434
clusters: [
3535
{
3636
name: CLUSTER_ID,
@@ -40,6 +40,7 @@ describe.skip('Row Snippets', () => {
4040
],
4141
type: 'DEVELOPMENT',
4242
});
43+
await operation.promise();
4344
await instance.createTable(TABLE_ID);
4445
} catch (err) {
4546
// Handle the error.

samples/test/table.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const instance = bigtable.instance(INSTANCE_ID);
3030
describe.skip('Table Snippets', () => {
3131
before(async () => {
3232
try {
33-
await instance.create({
33+
const [, operation] = await instance.create({
3434
clusters: [
3535
{
3636
name: CLUSTER_ID,
@@ -40,6 +40,7 @@ describe.skip('Table Snippets', () => {
4040
],
4141
type: 'DEVELOPMENT',
4242
});
43+
await operation.promise();
4344
} catch (err) {
4445
// Handle the error.
4546
}

0 commit comments

Comments
 (0)