Skip to content

Commit

Permalink
Bash: fix errecho for multiple services (awsdocs#5345)
Browse files Browse the repository at this point in the history
fixes for errecho
general test fix
  • Loading branch information
meyertst-aws authored Sep 5, 2023
1 parent dec41fb commit e8c743a
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function test_failed {
# This function outputs everything sent to it to STDERR (standard error output).
###############################################################################
function errecho {
printf "%b\n" "$*" 2>&1
printf "%b\n" "$*" 1>&2
}

###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion aws-cli/bash-linux/iam/awsdocs_general.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ VERBOSE=false
# This function outputs everything sent to it to STDERR (standard error output).
###############################################################################
function errecho() {
printf "%s\n" "$*" 2>&1
printf "%s\n" "$*" 1>&2
}
# snippet-end:[aws-cli.bash-linux.iam.errecho]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function run_test() {

# Check to see if we got the expected error code.
if [[ "$expected_err_code" -ne "$err" ]]; then
test_failed "The test \"$description\" returned an unexpected error code: $err"
test_failed "The test \"$description\" returned an unexpected error code: $err. $test_command_response"
fi

# Check the error message, if we provided other than "".
Expand Down
2 changes: 1 addition & 1 deletion aws-cli/bash-linux/iam/tests/test_iam_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function main() {
# bashsupport disable=BP2001
export VERBOSE=false

source ./test_general.sh
source ./include_tests.sh
{
local current_directory
current_directory=$(pwd)
Expand Down
2 changes: 1 addition & 1 deletion aws-cli/bash-linux/medical-imaging/awsdocs_general.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ VERBOSE=false
# This function outputs everything sent to it to STDERR (standard error output).
###############################################################################
function errecho() {
printf "%s\n" "$*" 2>&1
printf "%s\n" "$*" 1>&2
}
# snippet-end:[aws-cli.bash-linux.medical-imaging.errecho]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function run_test() {

# Check to see if we got the expected error code.
if [[ "$expected_err_code" -ne "$err" ]]; then
test_failed "The test \"$description\" returned an unexpected error code: $err"
test_failed "The test \"$description\" returned an unexpected error code: $err. $test_command_response"
fi

# Check the error message, if we provided other than "".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export INTERACTIVE=false
# bashsupport disable=BP2001
export VERBOSE=false

source ./test_general.sh
source ./include_tests.sh
{
local current_directory
current_directory=$(pwd)
Expand Down
20 changes: 20 additions & 0 deletions aws-cli/bash-linux/run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

base_dir=$(pwd)

echo "Running tests for S3 Bucket Lifecycle Operations"
cd s3/bucket-lifecycle-operations/
./test_bucket_operations.sh
cd $base_dir

echo "Running IAM tests"
cd iam/tests
./test_iam_examples.sh
cd $base_dir

echo "Running medical-imaging tests"
cd medical-imaging/tests
./test_medical_imaging_examples.sh
cd $base_dir

echo "Done"
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function run_test() {

# Check to see if we got the expected error code.
if [[ "$expected_err_code" -ne "$err" ]]; then
test_failed "The test \"$description\" returned an unexpected error code: $err"
test_failed "The test \"$description\" returned an unexpected error code: $err. $test_command_response"
fi

# Check the error message, if we provided other than "".
Expand Down Expand Up @@ -101,7 +101,7 @@ function test_failed() {
# This function outputs everything sent to it to STDERR (standard error output).
###############################################################################
function errecho() {
printf "%s\n" "$*" 2>&1
printf "%s\n" "$*" 1>&2
}
# snippet-end:[aws-cli.bash-linux.s3.errecho]

Expand Down

0 comments on commit e8c743a

Please sign in to comment.