Skip to content

Commit

Permalink
Adjust 02a tests to new error output format
Browse files Browse the repository at this point in the history
Add options "zP" to grep in message checking functions in testing_lib
  • Loading branch information
LegenJCdary committed Feb 16, 2023
1 parent 64e1458 commit 2af9aac
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions tests/02a-checkrun.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ echo -e " ___ ____ _ _\n / _ \___ \ __ _
check_run_ok "ansible-deployer show --debug" "\[DEBUG\]: load_configuration called"

# Check different output options
check_message_in_output "ansible-deployer run --task task_with_ansible_fail --stage testing --infrastructure testInfra" "\[ERROR\]:\n TASK \[Run ll\]"
check_message_in_output "ansible-deployer run --task task_with_ansible_fail --stage testing --infrastructure testInfra --debug" "\[DEBUG\]:\n TASK \[Run ll\]"
check_message_not_in_output "ansible-deployer run --task task_with_ansible_fail --stage testing --infrastructure testInfra --raw-runner-output" "\[ERROR\]:\n TASK \[Run ll\]"
check_message_in_output "ansible-deployer run --task task_with_ansible_fail --stage testing --infrastructure testInfra --raw-runner-output --debug" "\[DEBUG\]:\n TASK \[Run ll\]"
check_message_in_output "ansible-deployer run --task task_with_ansible_fail --stage testing --infrastructure testInfra" "\[ERROR\]:.*\n.* TASK \[Run ll\]"
check_message_in_output "ansible-deployer run --task task_with_ansible_fail --stage testing --infrastructure testInfra --debug" "\[DEBUG\]:.*\n.* TASK \[Run ll\]"
check_message_not_in_output "ansible-deployer run --task task_with_ansible_fail --stage testing --infrastructure testInfra --raw-runner-output" "\[ERROR\]:.*\n.* TASK \[Run ll\]"
check_message_in_output "ansible-deployer run --task task_with_ansible_fail --stage testing --infrastructure testInfra --raw-runner-output --debug" "\[DEBUG\]:.*\n.* TASK \[Run ll\]"

echo -e " ___ ____ _ _\n / _ \___ \ __ _ ___| |__ ___ ___| | ___ __ _ _ _ __\n | | | |__) / _\` | _____ / __| '_ \ / _ \/ __| |/ / '__| | | | '_ \ \n | |_| / __/ (_| | |_____| | (__| | | | __/ (__| <| | | |_| | | | |\n \___/_____\__,_| \___|_| |_|\___|\___|_|\_\_| \__,_|_| |_|\n \n _ _ _ _ _ _\n | (_)_ __ ___ (_) |_ ___ _ __ | |_(_) ___ _ __\n | | | '_ \` _ \| | __| / _ \| '_ \| __| |/ _ \| '_ \ \n | | | | | | | | | |_ | (_) | |_) | |_| | (_) | | | |\n |_|_|_| |_| |_|_|\__| \___/| .__/ \__|_|\___/|_| |_|\n |_|\n"
# Check --limit option
Expand Down
8 changes: 4 additions & 4 deletions tests/02a-checkrun_short.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ echo -e " ___ ____ _ _
check_run_ok "ansible-deployer show -d" "\[DEBUG\]: load_configuration called"

# Check different output options
check_message_in_output "ansible-deployer run -t task_with_ansible_fail -s testing -i testInfra" "\[ERROR\]:\n TASK \[Run ll\]"
check_message_in_output "ansible-deployer run -t task_with_ansible_fail -s testing -i testInfra -d" "\[DEBUG\]:\n TASK \[Run ll\]"
check_message_not_in_output "ansible-deployer run -t task_with_ansible_fail -s testing -i testInfra --raw-runner-output" "\[ERROR\]:\n TASK \[Run ll\]"
check_message_in_output "ansible-deployer run -t task_with_ansible_fail -s testing -i testInfra --raw-runner-output -d" "\[DEBUG\]:\n TASK \[Run ll\]"
check_message_in_output "ansible-deployer run -t task_with_ansible_fail -s testing -i testInfra" "\[ERROR\]:.*\n.* TASK \[Run ll\]"
check_message_in_output "ansible-deployer run -t task_with_ansible_fail -s testing -i testInfra -d" "\[DEBUG\]:.*\n.* TASK \[Run ll\]"
check_message_not_in_output "ansible-deployer run -t task_with_ansible_fail -s testing -i testInfra --raw-runner-output" "\[ERROR\]:.*\n.* TASK \[Run ll\]"
check_message_in_output "ansible-deployer run -t task_with_ansible_fail -s testing -i testInfra --raw-runner-output -d" "\[DEBUG\]:.*\n.* TASK \[Run ll\]"

echo -e " ___ ____ _ _ _ _\n / _ \___ \ __ _ ___| |__ ___ ___| | ___ __ _ _ _ __ ___| |__ ___ _ __| |_\n | | | |__) / _\` | _____ / __| '_ \ / _ \/ __| |/ / '__| | | | '_ \ / __| '_ \ / _ \| '__| __|\n | |_| / __/ (_| | |_____| | (__| | | | __/ (__| <| | | |_| | | | | \__ \ | | | (_) | | | |_\n \___/_____\__,_| \___|_| |_|\___|\___|_|\_\_| \__,_|_| |_| |___/_| |_|\___/|_| \__|\n \n _ _ _ _ _ _\n | (_)_ __ ___ (_) |_ ___ _ __ | |_(_) ___ _ __\n | | | '_ \` _ \| | __| / _ \| '_ \| __| |/ _ \| '_ \ \n | | | | | | | | | |_ | (_) | |_) | |_| | (_) | | | |\n |_|_|_| |_| |_|_|\__| \___/| .__/ \__|_|\___/|_| |_|\n |_|\n"
# Check --limit option
Expand Down
4 changes: 2 additions & 2 deletions tests/testing_lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ check_message_in_output() {
CMD=$1
EXPTEXT=$2
echo "Check: $CMD"
eval "$CMD |& grep '$EXPTEXT'"
eval "$CMD |& grep -zP '$EXPTEXT'"
if [ $? -eq 0 ]
then
echo "OK: '${CMD}' returned '${EXPTEXT}'"
Expand All @@ -35,7 +35,7 @@ check_message_not_in_output() {
CMD=$1
EXPTEXT=$2
echo "Check: $CMD"
eval "$CMD |& grep '$EXPTEXT'"
eval "$CMD |& grep -zP '$EXPTEXT'"
if [ $? -eq 0 ]
then
echo "FAILED: '${CMD}' returned '${EXPTEXT}'"
Expand Down

0 comments on commit 2af9aac

Please sign in to comment.