mirror of
https://github.com/hashicorp/setup-terraform.git
synced 2025-12-17 08:52:37 +00:00
Merge f872146a9f into 92e4d08fe1
This commit is contained in:
commit
fefd48d0f9
4 changed files with 44 additions and 70 deletions
|
|
@ -28,18 +28,12 @@ const setup = require('../lib/setup-terraform');
|
|||
// .fn(console.error);
|
||||
|
||||
describe('Setup Terraform', () => {
|
||||
const HOME = process.env.HOME;
|
||||
const APPDATA = process.env.APPDATA;
|
||||
|
||||
beforeEach(() => {
|
||||
process.env.HOME = '/tmp/asdf';
|
||||
process.env.APPDATA = '/tmp/asdf';
|
||||
process.env.RUNNER_TEMP = '/tmp/asdf';
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await io.rmRF(process.env.HOME);
|
||||
process.env.HOME = HOME;
|
||||
process.env.APPDATA = APPDATA;
|
||||
await io.rmRF(process.env.RUNNER_TEMP);
|
||||
});
|
||||
|
||||
test('gets specific version and adds token and hostname on linux, amd64', async () => {
|
||||
|
|
@ -78,8 +72,8 @@ describe('Setup Terraform', () => {
|
|||
|
||||
// downloaded CLI has been added to path
|
||||
expect(core.addPath).toHaveBeenCalled();
|
||||
// expect credentials are in ${HOME}.terraformrc
|
||||
const creds = await fs.readFile(`${process.env.HOME}/.terraformrc`, { encoding: 'utf8' });
|
||||
// expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc
|
||||
const creds = await fs.readFile(`${process.env.RUNNER_TEMP}/setup-terraform.tfrc`, { encoding: 'utf8' });
|
||||
expect(creds.indexOf(credentialsHostname)).toBeGreaterThan(-1);
|
||||
expect(creds.indexOf(credentialsToken)).toBeGreaterThan(-1);
|
||||
});
|
||||
|
|
@ -123,8 +117,8 @@ describe('Setup Terraform', () => {
|
|||
// downloaded CLI has been added to path
|
||||
expect(core.addPath).toHaveBeenCalled();
|
||||
|
||||
// expect credentials are in ${HOME}.terraformrc
|
||||
const creds = await fs.readFile(`${process.env.HOME}/terraform.rc`, { encoding: 'utf8' });
|
||||
// expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc
|
||||
const creds = await fs.readFile(`${process.env.RUNNER_TEMP}/setup-terraform.tfrc`, { encoding: 'utf8' });
|
||||
expect(creds.indexOf(credentialsHostname)).toBeGreaterThan(-1);
|
||||
expect(creds.indexOf(credentialsToken)).toBeGreaterThan(-1);
|
||||
});
|
||||
|
|
@ -166,8 +160,8 @@ describe('Setup Terraform', () => {
|
|||
// downloaded CLI has been added to path
|
||||
expect(core.addPath).toHaveBeenCalled();
|
||||
|
||||
// expect credentials are in ${HOME}.terraformrc
|
||||
const creds = await fs.readFile(`${process.env.HOME}/.terraformrc`, { encoding: 'utf8' });
|
||||
// expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc
|
||||
const creds = await fs.readFile(`${process.env.RUNNER_TEMP}/setup-terraform.tfrc`, { encoding: 'utf8' });
|
||||
expect(creds.indexOf(credentialsHostname)).toBeGreaterThan(-1);
|
||||
expect(creds.indexOf(credentialsToken)).toBeGreaterThan(-1);
|
||||
});
|
||||
|
|
@ -209,8 +203,8 @@ describe('Setup Terraform', () => {
|
|||
// downloaded CLI has been added to path
|
||||
expect(core.addPath).toHaveBeenCalled();
|
||||
|
||||
// expect credentials are in ${HOME}.terraformrc
|
||||
const creds = await fs.readFile(`${process.env.HOME}/.terraformrc`, { encoding: 'utf8' });
|
||||
// expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc
|
||||
const creds = await fs.readFile(`${process.env.RUNNER_TEMP}/setup-terraform.tfrc`, { encoding: 'utf8' });
|
||||
expect(creds.indexOf(credentialsHostname)).toBeGreaterThan(-1);
|
||||
expect(creds.indexOf(credentialsToken)).toBeGreaterThan(-1);
|
||||
});
|
||||
|
|
@ -251,8 +245,8 @@ describe('Setup Terraform', () => {
|
|||
|
||||
// downloaded CLI has been added to path
|
||||
expect(core.addPath).toHaveBeenCalled();
|
||||
// expect credentials are in ${HOME}.terraformrc
|
||||
const creds = await fs.readFile(`${process.env.HOME}/.terraformrc`, { encoding: 'utf8' });
|
||||
// expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc
|
||||
const creds = await fs.readFile(`${process.env.RUNNER_TEMP}/setup-terraform.tfrc`, { encoding: 'utf8' });
|
||||
expect(creds.indexOf(credentialsHostname)).toBeGreaterThan(-1);
|
||||
expect(creds.indexOf(credentialsToken)).toBeGreaterThan(-1);
|
||||
});
|
||||
|
|
@ -293,8 +287,8 @@ describe('Setup Terraform', () => {
|
|||
|
||||
// downloaded CLI has been added to path
|
||||
expect(core.addPath).toHaveBeenCalled();
|
||||
// expect credentials are in ${HOME}.terraformrc
|
||||
const creds = await fs.readFile(`${process.env.HOME}/.terraformrc`, { encoding: 'utf8' });
|
||||
// expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc
|
||||
const creds = await fs.readFile(`${process.env.RUNNER_TEMP}/setup-terraform.tfrc`, { encoding: 'utf8' });
|
||||
expect(creds.indexOf(credentialsHostname)).toBeGreaterThan(-1);
|
||||
expect(creds.indexOf(credentialsToken)).toBeGreaterThan(-1);
|
||||
});
|
||||
|
|
@ -335,8 +329,8 @@ describe('Setup Terraform', () => {
|
|||
|
||||
// downloaded CLI has been added to path
|
||||
expect(core.addPath).toHaveBeenCalled();
|
||||
// expect credentials are in ${HOME}.terraformrc
|
||||
const creds = await fs.readFile(`${process.env.HOME}/.terraformrc`, { encoding: 'utf8' });
|
||||
// expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc
|
||||
const creds = await fs.readFile(`${process.env.RUNNER_TEMP}/setup-terraform.tfrc`, { encoding: 'utf8' });
|
||||
expect(creds.indexOf(credentialsHostname)).toBeGreaterThan(-1);
|
||||
expect(creds.indexOf(credentialsToken)).toBeGreaterThan(-1);
|
||||
});
|
||||
|
|
@ -377,8 +371,8 @@ describe('Setup Terraform', () => {
|
|||
|
||||
// downloaded CLI has been added to path
|
||||
expect(core.addPath).toHaveBeenCalled();
|
||||
// expect credentials are in ${HOME}.terraformrc
|
||||
const creds = await fs.readFile(`${process.env.HOME}/.terraformrc`, { encoding: 'utf8' });
|
||||
// expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc
|
||||
const creds = await fs.readFile(`${process.env.RUNNER_TEMP}/setup-terraform.tfrc`, { encoding: 'utf8' });
|
||||
expect(creds.indexOf(credentialsHostname)).toBeGreaterThan(-1);
|
||||
expect(creds.indexOf(credentialsToken)).toBeGreaterThan(-1);
|
||||
});
|
||||
|
|
@ -419,8 +413,8 @@ describe('Setup Terraform', () => {
|
|||
|
||||
// downloaded CLI has been added to path
|
||||
expect(core.addPath).toHaveBeenCalled();
|
||||
// expect credentials are in ${HOME}.terraformrc
|
||||
const creds = await fs.readFile(`${process.env.HOME}/.terraformrc`, { encoding: 'utf8' });
|
||||
// expect credentials are in ${RUNNER_TEMP}/setup-terraform.tfrc
|
||||
const creds = await fs.readFile(`${process.env.RUNNER_TEMP}/setup-terraform.tfrc`, { encoding: 'utf8' });
|
||||
expect(creds.indexOf(credentialsHostname)).toBeGreaterThan(-1);
|
||||
expect(creds.indexOf(credentialsToken)).toBeGreaterThan(-1);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue