This commit is contained in:
Colin Johnson
2012-07-04 05:27:10 +00:00
parent 52dcc5c58e
commit d1663f91e3
2 changed files with 92 additions and 44 deletions

View File

@@ -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