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 7
7
"build" : " ncc build src/index.ts" ,
8
8
"lint" : " eslint . --ext .ts,.tsx" ,
9
9
"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 "
12
12
},
13
13
"repository" : {
14
14
"type" : " git" ,
Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ import { CloudRun } from './cloudRun';
19
19
import { Service } from './service' ;
20
20
import { get } from 'lodash' ;
21
21
22
+ function sleep ( ms : number ) : Promise < void > {
23
+ return new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
24
+ }
25
+
22
26
/**
23
27
* Executes the main action. It includes the main business logic and is the
24
28
* primary entry point. It is documented inline.
@@ -44,6 +48,7 @@ async function run(): Promise<void> {
44
48
let serviceResponse = await client . deploy ( service ) ;
45
49
while ( ! get ( serviceResponse , 'status.url' ) ) {
46
50
serviceResponse = await client . getService ( service . name ) ;
51
+ await sleep ( 2000 ) ;
47
52
}
48
53
// Set URL as output
49
54
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';
28
28
const name = `test-${ Math . round ( Math . random ( ) * 100000 ) } ` ; // Cloud Run currently has name length restrictions
29
29
const service = new Service ( { image, name } ) ;
30
30
31
+ function sleep ( ms : number ) : Promise < void > {
32
+ return new Promise ( ( resolve ) => setTimeout ( resolve , ms ) ) ;
33
+ }
34
+
31
35
describe ( 'CloudRun' , function ( ) {
32
36
it ( 'initializes with JSON creds' , function ( ) {
33
37
const client = new CloudRun ( region , {
@@ -61,6 +65,7 @@ describe('CloudRun', function() {
61
65
let result = await client . deploy ( service ) ;
62
66
while ( ! result . status ! . url ) {
63
67
result = await client . getService ( name ) ;
68
+ await sleep ( 2000 ) ;
64
69
}
65
70
expect ( result ) . to . not . eql ( null ) ;
66
71
expect ( result . status ! . url ) . to . include ( 'run.app' ) ;
You can’t perform that action at this time.
0 commit comments