@@ -23,18 +23,12 @@ const setup = require('../lib/setup-terraform');
2323//   .fn(console.error); 
2424
2525describe ( 'Setup Terraform' ,  ( )  =>  { 
26-   const  HOME  =  process . env . HOME ; 
27-   const  APPDATA  =  process . env . APPDATA ; 
28- 
2926  beforeEach ( ( )  =>  { 
30-     process . env . HOME  =  '/tmp/asdf' ; 
31-     process . env . APPDATA  =  '/tmp/asdf' ; 
27+     process . env . RUNNER_TEMP  =  '/tmp/asdf' 
3228  } ) ; 
3329
3430  afterEach ( async  ( )  =>  { 
35-     await  io . rmRF ( process . env . HOME ) ; 
36-     process . env . HOME  =  HOME ; 
37-     process . env . APPDATA  =  APPDATA ; 
31+     await  io . rmRF ( process . env . RUNNER_TEMP ) ; 
3832  } ) ; 
3933
4034  test ( 'gets specific version and adds token and hostname on linux, amd64' ,  async  ( )  =>  { 
@@ -73,8 +67,8 @@ describe('Setup Terraform', () => {
7367
7468    // downloaded CLI has been added to path 
7569    expect ( core . addPath ) . toHaveBeenCalled ( ) ; 
76-     // expect credentials are in ${HOME}.terraformrc  
77-     const  creds  =  await  fs . readFile ( `${ process . env . HOME } /.terraformrc ` ,  {  encoding : 'utf8'  } ) ; 
70+     // expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc  
71+     const  creds  =  await  fs . readFile ( `${ process . env . RUNNER_TEMP } /setup-terraform.tfrc ` ,  {  encoding : 'utf8'  } ) ; 
7872    expect ( creds . indexOf ( credentialsHostname ) ) . toBeGreaterThan ( - 1 ) ; 
7973    expect ( creds . indexOf ( credentialsToken ) ) . toBeGreaterThan ( - 1 ) ; 
8074  } ) ; 
@@ -118,8 +112,8 @@ describe('Setup Terraform', () => {
118112    // downloaded CLI has been added to path 
119113    expect ( core . addPath ) . toHaveBeenCalled ( ) ; 
120114
121-     // expect credentials are in ${HOME}.terraformrc  
122-     const  creds  =  await  fs . readFile ( `${ process . env . HOME } / terraform.rc ` ,  {  encoding : 'utf8'  } ) ; 
115+     // expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc  
116+     const  creds  =  await  fs . readFile ( `${ process . env . RUNNER_TEMP } /setup- terraform.tfrc ` ,  {  encoding : 'utf8'  } ) ; 
123117    expect ( creds . indexOf ( credentialsHostname ) ) . toBeGreaterThan ( - 1 ) ; 
124118    expect ( creds . indexOf ( credentialsToken ) ) . toBeGreaterThan ( - 1 ) ; 
125119  } ) ; 
@@ -161,8 +155,8 @@ describe('Setup Terraform', () => {
161155    // downloaded CLI has been added to path 
162156    expect ( core . addPath ) . toHaveBeenCalled ( ) ; 
163157
164-     // expect credentials are in ${HOME}.terraformrc  
165-     const  creds  =  await  fs . readFile ( `${ process . env . HOME } /.terraformrc ` ,  {  encoding : 'utf8'  } ) ; 
158+     // expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc  
159+     const  creds  =  await  fs . readFile ( `${ process . env . RUNNER_TEMP } /setup-terraform.tfrc ` ,  {  encoding : 'utf8'  } ) ; 
166160    expect ( creds . indexOf ( credentialsHostname ) ) . toBeGreaterThan ( - 1 ) ; 
167161    expect ( creds . indexOf ( credentialsToken ) ) . toBeGreaterThan ( - 1 ) ; 
168162  } ) ; 
@@ -204,8 +198,8 @@ describe('Setup Terraform', () => {
204198    // downloaded CLI has been added to path 
205199    expect ( core . addPath ) . toHaveBeenCalled ( ) ; 
206200
207-     // expect credentials are in ${HOME}.terraformrc  
208-     const  creds  =  await  fs . readFile ( `${ process . env . HOME } /.terraformrc ` ,  {  encoding : 'utf8'  } ) ; 
201+     // expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc  
202+     const  creds  =  await  fs . readFile ( `${ process . env . RUNNER_TEMP } /setup-terraform.tfrc ` ,  {  encoding : 'utf8'  } ) ; 
209203    expect ( creds . indexOf ( credentialsHostname ) ) . toBeGreaterThan ( - 1 ) ; 
210204    expect ( creds . indexOf ( credentialsToken ) ) . toBeGreaterThan ( - 1 ) ; 
211205  } ) ; 
@@ -246,8 +240,8 @@ describe('Setup Terraform', () => {
246240
247241    // downloaded CLI has been added to path 
248242    expect ( core . addPath ) . toHaveBeenCalled ( ) ; 
249-     // expect credentials are in ${HOME}.terraformrc  
250-     const  creds  =  await  fs . readFile ( `${ process . env . HOME } /.terraformrc ` ,  {  encoding : 'utf8'  } ) ; 
243+     // expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc  
244+     const  creds  =  await  fs . readFile ( `${ process . env . RUNNER_TEMP } /setup-terraform.tfrc ` ,  {  encoding : 'utf8'  } ) ; 
251245    expect ( creds . indexOf ( credentialsHostname ) ) . toBeGreaterThan ( - 1 ) ; 
252246    expect ( creds . indexOf ( credentialsToken ) ) . toBeGreaterThan ( - 1 ) ; 
253247  } ) ; 
@@ -288,8 +282,8 @@ describe('Setup Terraform', () => {
288282
289283    // downloaded CLI has been added to path 
290284    expect ( core . addPath ) . toHaveBeenCalled ( ) ; 
291-     // expect credentials are in ${HOME}.terraformrc  
292-     const  creds  =  await  fs . readFile ( `${ process . env . HOME } /.terraformrc ` ,  {  encoding : 'utf8'  } ) ; 
285+     // expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc  
286+     const  creds  =  await  fs . readFile ( `${ process . env . RUNNER_TEMP } /setup-terraform.tfrc ` ,  {  encoding : 'utf8'  } ) ; 
293287    expect ( creds . indexOf ( credentialsHostname ) ) . toBeGreaterThan ( - 1 ) ; 
294288    expect ( creds . indexOf ( credentialsToken ) ) . toBeGreaterThan ( - 1 ) ; 
295289  } ) ; 
@@ -330,8 +324,8 @@ describe('Setup Terraform', () => {
330324
331325    // downloaded CLI has been added to path 
332326    expect ( core . addPath ) . toHaveBeenCalled ( ) ; 
333-     // expect credentials are in ${HOME}.terraformrc  
334-     const  creds  =  await  fs . readFile ( `${ process . env . HOME } /.terraformrc ` ,  {  encoding : 'utf8'  } ) ; 
327+     // expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc  
328+     const  creds  =  await  fs . readFile ( `${ process . env . RUNNER_TEMP } /setup-terraform.tfrc ` ,  {  encoding : 'utf8'  } ) ; 
335329    expect ( creds . indexOf ( credentialsHostname ) ) . toBeGreaterThan ( - 1 ) ; 
336330    expect ( creds . indexOf ( credentialsToken ) ) . toBeGreaterThan ( - 1 ) ; 
337331  } ) ; 
@@ -372,8 +366,8 @@ describe('Setup Terraform', () => {
372366
373367    // downloaded CLI has been added to path 
374368    expect ( core . addPath ) . toHaveBeenCalled ( ) ; 
375-     // expect credentials are in ${HOME}.terraformrc  
376-     const  creds  =  await  fs . readFile ( `${ process . env . HOME } /.terraformrc ` ,  {  encoding : 'utf8'  } ) ; 
369+     // expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc  
370+     const  creds  =  await  fs . readFile ( `${ process . env . RUNNER_TEMP } /setup-terraform.tfrc ` ,  {  encoding : 'utf8'  } ) ; 
377371    expect ( creds . indexOf ( credentialsHostname ) ) . toBeGreaterThan ( - 1 ) ; 
378372    expect ( creds . indexOf ( credentialsToken ) ) . toBeGreaterThan ( - 1 ) ; 
379373  } ) ; 
@@ -414,8 +408,8 @@ describe('Setup Terraform', () => {
414408
415409    // downloaded CLI has been added to path 
416410    expect ( core . addPath ) . toHaveBeenCalled ( ) ; 
417-     // expect credentials are in ${HOME}.terraformrc  
418-     const  creds  =  await  fs . readFile ( `${ process . env . HOME } /.terraformrc ` ,  {  encoding : 'utf8'  } ) ; 
411+     // expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc  
412+     const  creds  =  await  fs . readFile ( `${ process . env . RUNNER_TEMP } /setup-terraform.tfrc ` ,  {  encoding : 'utf8'  } ) ; 
419413    expect ( creds . indexOf ( credentialsHostname ) ) . toBeGreaterThan ( - 1 ) ; 
420414    expect ( creds . indexOf ( credentialsToken ) ) . toBeGreaterThan ( - 1 ) ; 
421415  } ) ; 
0 commit comments