now able to use option for credential file (https://github.com/colinbjohnson/aws-missing-tools/issues/2).
This commit is contained in:
@@ -1,26 +1,42 @@
|
||||
#!/bin/bash
|
||||
#set EC2CC_RB_APPLICATION prior to running
|
||||
EC2CC_RB_APPLICATION=/Temp/aws-missing-tools/ec2-cost-calculate-rb/ec2-cost-calculate.rb
|
||||
EC2CC_RB_APPLICATION=/Temp/ec2-cost-calculate.rb
|
||||
echo
|
||||
echo " -Test: Credentials File Checking"
|
||||
echo " -Test: Condition - Prerequisite File Does Not Exist"
|
||||
echo " -Test: Condition - Credential File Does Not Exist"
|
||||
AWS_CREDENTIAL_FILE_BAK=$AWS_CREDENTIAL_FILE #backup of credential location
|
||||
export AWS_CREDENTIAL_FILE=/var/tmp/nofile.txt
|
||||
$EC2CC_RB_APPLICATION
|
||||
echo "Exit Code: $?"
|
||||
echo " -Test Condition: Prerequisite Success"
|
||||
echo " -Test Condition: Credential File Success"
|
||||
export AWS_CREDENTIAL_FILE=$AWS_CREDENTIAL_FILE_BAK
|
||||
$EC2CC_RB_APPLICATION
|
||||
echo
|
||||
|
||||
echo " -Test Condition: Credential File Custom Location Selected, File Does Not Exist"
|
||||
$EC2CC_RB_APPLICATION --awscredentialfile /var/tmp/nofile.txt
|
||||
echo "Exit Code: $?"
|
||||
echo " -Test Condition: Credential File Custom Location Selected, File Exists, Incorrent Format"
|
||||
tmpfile_bad_format=`mktemp /tmp/ec2cc.XXXXXX` || exit 1
|
||||
echo "No Contents" >> $tmpfile_bad_format
|
||||
$EC2CC_RB_APPLICATION --awscredentialfile $tmpfile_bad_format
|
||||
rm -f $tmpfile
|
||||
echo "Exit Code: $?"
|
||||
echo " -Test Condition: Credential File From Custom Location Selected, File Exists, Correct Format"
|
||||
tmpfile_good_format=`mktemp /tmp/ec2cc.XXXXXX` || exit 1
|
||||
cp $AWS_CREDENTIAL_FILE $tmpfile_good_format
|
||||
$EC2CC_RB_APPLICATION --awscredentialfile $tmpfile_good_format
|
||||
rm -f $tmpfile_good_format
|
||||
echo "Exit Code: $?"
|
||||
##### Simple Run Test
|
||||
echo " -Test: Simple Execution"
|
||||
$EC2CC_RB_APPLICATION
|
||||
echo "Exit Code: $?"
|
||||
##### Invalid Options Provided
|
||||
echo " -Test: Invalid Option Provided"
|
||||
$EC2CC_RB_APPLICATION --option
|
||||
echo "Exit Code: $?"
|
||||
##### Invalid Options Provided
|
||||
echo " -Test: Invalid Option Provided"
|
||||
$EC2CC_RB_APPLICATION --option invalid
|
||||
echo "Exit Code: $?"
|
||||
echo
|
||||
|
||||
Reference in New Issue
Block a user