Skip to content

Commit

Permalink
test: update pulumi test
Browse files Browse the repository at this point in the history
  • Loading branch information
acrois committed Jan 26, 2024
1 parent a36c9ab commit ef8a02e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/cloudformation_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ console.log(`AWS CLI: ${awsCliVersion}`)

if (!awsCliVersion) throw 'Invalid AWS CLI version.';

await $`pwd`.cwd("../cloudformation")
$.cwd('./cloudformation')

const bucketName = 'my-cloudformation-bucket'
await $`aws cloudformation create-stack --stack-name my-stack --template-body file://template.yaml --parameters ParameterKey=BucketName,ParameterValue=${bucketName}`
Expand Down
13 changes: 9 additions & 4 deletions tests/pulumi_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,23 @@ console.log('Running Pulumi resource check...')
const pulumiVersion = (await $`pulumi version`.text()).trim()
console.log(`Pulumi: ${pulumiVersion}`)

if (!pulumiVersion) throw 'Invalid Pulumi version.';
if (!pulumiVersion) throw 'Invalid Pulumi version.'

const awsCliVersion = (await $`aws --version`.text()).trim()
console.log(`AWS CLI: ${awsCliVersion}`)

if (!awsCliVersion) throw 'Invalid AWS CLI version.';

await $`pwd`.cwd("../pulumi")
const installRequirements = (await $`pip install -r requirements.txt`.text()).trim()
$.cwd('./pulumi')

const pipResults = await $`pip install -r requirements.txt`
if (pipResults.exitCode !== 0) throw pipResults.stderr.toString()

const pulumiResults = await $`pulumi up --yes`
if (pulumiResults.exitCode !== 0) throw pulumiResults.stderr.toString()

const bucketName = (await $`pulumi stack output bucket_name`.text()).trim()
console.log(`Checking if S3 bucket ${bucketName} exists...`)

await $`aws s3 ls s3://${bucketName}`
const bucketResults = await $`aws s3 ls s3://${bucketName}`
if (bucketResults.exitCode !== 0) throw bucketResults.stderr.toString()
4 changes: 2 additions & 2 deletions tests/terraform_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ console.log(`AWS CLI: ${awsCliVersion}`)

if (!awsCliVersion) throw 'Invalid AWS CLI version.';

await $`pwd`.cwd("../terraform")
$.cwd('./terraform')

const bucketName = (await $`terraform output bucket_name`.text()).trim()
const bucketName = (await $`terraform output -raw bucket_name`.text()).trim()
console.log(`Checking if S3 bucket ${bucketName} exists...`)

await $`aws s3 ls s3://${bucketName}`

0 comments on commit ef8a02e

Please sign in to comment.