File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 77 "build" : " ncc build src/index.ts" ,
88 "lint" : " eslint . --ext .ts,.tsx" ,
99 "format" : " prettier --write **/*.ts" ,
10- "test" : " mocha -r ts-node/register -t 120s 'tests/unit/*.test.ts'" ,
11- "e2e-tests" : " mocha -r ts-node/register -t 120s 'tests/e2e.test.ts'"
10+ "test" : " mocha -r ts-node/register -t 120s 'tests/unit/*.test.ts' --exit " ,
11+ "e2e-tests" : " mocha -r ts-node/register -t 120s 'tests/e2e.test.ts' --exit "
1212 },
1313 "repository" : {
1414 "type" : " git" ,
Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ import { CloudRun } from './cloudRun';
1919import { Service } from './service' ;
2020import { get } from 'lodash' ;
2121
22+ function sleep ( ms : number ) : Promise < void > {
23+ return new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
24+ }
25+
2226/**
2327 * Executes the main action. It includes the main business logic and is the
2428 * primary entry point. It is documented inline.
@@ -44,6 +48,7 @@ async function run(): Promise<void> {
4448 let serviceResponse = await client . deploy ( service ) ;
4549 while ( ! get ( serviceResponse , 'status.url' ) ) {
4650 serviceResponse = await client . getService ( service . name ) ;
51+ await sleep ( 2000 ) ;
4752 }
4853 // Set URL as output
4954 core . setOutput ( 'url' , get ( serviceResponse , 'status.url' ) ) ;
Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ const image = 'gcr.io/cloudrun/hello';
2828const name = `test-${ Math . round ( Math . random ( ) * 100000 ) } ` ; // Cloud Run currently has name length restrictions
2929const service = new Service ( { image, name } ) ;
3030
31+ function sleep ( ms : number ) : Promise < void > {
32+ return new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
33+ }
34+
3135describe ( 'CloudRun' , function ( ) {
3236 it ( 'initializes with JSON creds' , function ( ) {
3337 const client = new CloudRun ( region , {
@@ -61,6 +65,7 @@ describe('CloudRun', function() {
6165 let result = await client . deploy ( service ) ;
6266 while ( ! result . status ! . url ) {
6367 result = await client . getService ( name ) ;
68+ await sleep ( 2000 ) ;
6469 }
6570 expect ( result ) . to . not . eql ( null ) ;
6671 expect ( result . status ! . url ) . to . include ( 'run.app' ) ;
You can’t perform that action at this time.
0 commit comments