@@ -20,7 +20,7 @@ const path = require('path');
2020const uuid = require ( 'uuid' ) ;
2121const sinon = require ( 'sinon' ) ;
2222const fetch = require ( 'node-fetch' ) ;
23- const isReachable = require ( 'is-reachable ' ) ;
23+ const waitPort = require ( 'wait-port ' ) ;
2424const { Datastore} = require ( '@google-cloud/datastore' ) ;
2525
2626const datastore = new Datastore ( ) ;
@@ -49,16 +49,7 @@ const handleLinuxFailures = async proc => {
4949 }
5050} ;
5151
52- // Wait for the HTTP server to start listening
53- const waitForReady = async baseUrl => {
54- let ready = false ;
55- while ( ! ready ) {
56- await new Promise ( r => setTimeout ( r , 500 ) ) ;
57- ready = await isReachable ( baseUrl ) ;
58- }
59- } ;
60-
61- describe . skip ( 'functions/datastore' , ( ) => {
52+ describe ( 'functions/datastore' , ( ) => {
6253 describe ( 'set' , ( ) => {
6354 let ffProc ;
6455 const PORT = 8080 ;
@@ -69,7 +60,7 @@ describe.skip('functions/datastore', () => {
6960 `functions-framework --target=set --signature-type=http --port=${ PORT } ` ,
7061 { timeout : FF_TIMEOUT , shell : true , cwd}
7162 ) ;
72- await waitForReady ( BASE_URL ) ;
63+ await waitPort ( { port : PORT } ) ;
7364 } ) ;
7465
7566 after ( async ( ) => {
@@ -150,7 +141,7 @@ describe.skip('functions/datastore', () => {
150141 `functions-framework --target=get --signature-type=http --port=${ PORT } ` ,
151142 { timeout : FF_TIMEOUT , shell : true , cwd}
152143 ) ;
153- await waitForReady ( BASE_URL ) ;
144+ await waitPort ( { port : PORT } ) ;
154145 } ) ;
155146
156147 after ( async ( ) => {
@@ -236,7 +227,7 @@ describe.skip('functions/datastore', () => {
236227 `functions-framework --target=del --signature-type=http --port=${ PORT } ` ,
237228 { timeout : FF_TIMEOUT , shell : true , cwd}
238229 ) ;
239- await waitForReady ( BASE_URL ) ;
230+ await waitPort ( { port : PORT } ) ;
240231 } ) ;
241232
242233 after ( async ( ) => {
0 commit comments