@@ -13,7 +13,7 @@ const tests = [];
1313
1414tests . push ( {
1515 name : 'should work if agent is killed with signal' ,
16- test : async ( ) => {
16+ test : async ( getEnv ) => {
1717 return new Promise ( ( resolve ) => {
1818 const grpcServer = new GRPCServer ( ) ;
1919 grpcServer . start ( mustSucceed ( async ( port ) => {
@@ -23,11 +23,7 @@ tests.push({
2323 resolve ( ) ;
2424 } ) ) ;
2525
26- const env = {
27- NODE_DEBUG_NATIVE : 'nsolid_grpc_agent' ,
28- NSOLID_GRPC_INSECURE : 1 ,
29- NSOLID_GRPC : `localhost:${ port } ` ,
30- } ;
26+ const env = getEnv ( port ) ;
3127
3228 const opts = {
3329 stdio : [ 'inherit' , 'inherit' , 'inherit' , 'ipc' ] ,
@@ -43,7 +39,7 @@ tests.push({
4339
4440tests . push ( {
4541 name : 'should work if agent exits gracefully without error' ,
46- test : async ( ) => {
42+ test : async ( getEnv ) => {
4743 return new Promise ( ( resolve ) => {
4844 const grpcServer = new GRPCServer ( ) ;
4945 grpcServer . start ( mustSucceed ( async ( port ) => {
@@ -53,11 +49,7 @@ tests.push({
5349 resolve ( ) ;
5450 } ) ) ;
5551
56- const env = {
57- NODE_DEBUG_NATIVE : 'nsolid_grpc_agent' ,
58- NSOLID_GRPC_INSECURE : 1 ,
59- NSOLID_GRPC : `localhost:${ port } ` ,
60- } ;
52+ const env = getEnv ( port ) ;
6153
6254 const opts = {
6355 stdio : [ 'inherit' , 'inherit' , 'inherit' , 'ipc' ] ,
@@ -76,7 +68,7 @@ tests.push({
7668
7769tests . push ( {
7870 name : 'should work if agent exits gracefully with error code' ,
79- test : async ( ) => {
71+ test : async ( getEnv ) => {
8072 return new Promise ( ( resolve ) => {
8173 const grpcServer = new GRPCServer ( ) ;
8274 grpcServer . start ( mustSucceed ( async ( port ) => {
@@ -86,11 +78,7 @@ tests.push({
8678 resolve ( ) ;
8779 } ) ) ;
8880
89- const env = {
90- NODE_DEBUG_NATIVE : 'nsolid_grpc_agent' ,
91- NSOLID_GRPC_INSECURE : 1 ,
92- NSOLID_GRPC : `localhost:${ port } ` ,
93- } ;
81+ const env = getEnv ( port ) ;
9482
9583 const opts = {
9684 stdio : [ 'inherit' , 'inherit' , 'inherit' , 'ipc' ] ,
@@ -109,7 +97,7 @@ tests.push({
10997
11098tests . push ( {
11199 name : 'should work if agent exits with exception' ,
112- test : async ( ) => {
100+ test : async ( getEnv ) => {
113101 return new Promise ( ( resolve ) => {
114102 const grpcServer = new GRPCServer ( ) ;
115103 grpcServer . start ( mustSucceed ( async ( port ) => {
@@ -120,11 +108,7 @@ tests.push({
120108 resolve ( ) ;
121109 } ) ) ;
122110
123- const env = {
124- NODE_DEBUG_NATIVE : 'nsolid_grpc_agent' ,
125- NSOLID_GRPC_INSECURE : 1 ,
126- NSOLID_GRPC : `localhost:${ port } ` ,
127- } ;
111+ const env = getEnv ( port ) ;
128112
129113 const opts = {
130114 stdio : [ 'inherit' , 'inherit' , 'inherit' , 'ipc' ] ,
@@ -141,7 +125,30 @@ tests.push({
141125 } ,
142126} ) ;
143127
144- for ( const { name, test } of tests ) {
145- console . log ( `[basic] ${ name } ` ) ;
146- await test ( ) ;
128+ const testConfigs = [
129+ {
130+ getEnv : ( port ) => {
131+ return {
132+ NODE_DEBUG_NATIVE : 'nsolid_grpc_agent' ,
133+ NSOLID_GRPC_INSECURE : 1 ,
134+ NSOLID_GRPC : `localhost:${ port } ` ,
135+ } ;
136+ } ,
137+ } ,
138+ {
139+ getEnv : ( port ) => {
140+ return {
141+ NODE_DEBUG_NATIVE : 'nsolid_grpc_agent' ,
142+ NSOLID_GRPC_INSECURE : 1 ,
143+ NSOLID_SAAS : `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbtesting.localhost:${ port } ` ,
144+ } ;
145+ } ,
146+ } ,
147+ ] ;
148+
149+ for ( const testConfig of testConfigs ) {
150+ for ( const { name, test } of tests ) {
151+ console . log ( `[basic] ${ name } ` ) ;
152+ await test ( testConfig . getEnv ) ;
153+ }
147154}
0 commit comments