From ccd7153b9d9df01609b8557c2131f2e8786527ed Mon Sep 17 00:00:00 2001 From: Matthias Radestock Date: Thu, 28 May 2015 12:29:58 +0100 Subject: [PATCH] refactor: remove excessive escaping --- test/130_expose_test.sh | 6 +++--- test/200_dns_test.sh | 2 +- test/500_weave_multi_cidr_test.sh | 6 +++--- test/config.sh | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/130_expose_test.sh b/test/130_expose_test.sh index 9ea46c68..5079deb4 100755 --- a/test/130_expose_test.sh +++ b/test/130_expose_test.sh @@ -26,9 +26,9 @@ check_container_connectivity() { exec_on1 "c1 $PING $C2" exec_on1 "c3 $PING $C4" exec_on1 "c5 $PING $C6" - exec_on1 "c1 sh -c \"! $PING $C3\"" - exec_on1 "c3 sh -c \"! $PING $C5\"" - exec_on1 "c5 sh -c \"! $PING $C1\"" + exec_on1 "c1 sh -c '! $PING $C3'" + exec_on1 "c3 sh -c '! $PING $C5'" + exec_on1 "c5 sh -c '! $PING $C1'" } start_suite "exposing weave network to host" diff --git a/test/200_dns_test.sh b/test/200_dns_test.sh index c39305ee..6ccfb627 100755 --- a/test/200_dns_test.sh +++ b/test/200_dns_test.sh @@ -15,6 +15,6 @@ start_container_with_dns $HOST1 $C1/24 --name=c1 assert_dns_record $HOST1 c1 $NAME $C2 -assert_raises "exec_on $HOST1 c1 dig MX $NAME | grep -q \"status: NXDOMAIN\"" +assert_raises "exec_on $HOST1 c1 dig MX $NAME | grep -q 'status: NXDOMAIN'" end_suite diff --git a/test/500_weave_multi_cidr_test.sh b/test/500_weave_multi_cidr_test.sh index 3514cfa3..1e8a63a5 100755 --- a/test/500_weave_multi_cidr_test.sh +++ b/test/500_weave_multi_cidr_test.sh @@ -11,7 +11,7 @@ assert_container_cidrs() { CIDRS="$@" # Assert container has attached CIDRs - assert_raises "weave_on $HOST ps | grep \"^$CID [^ ]* $CIDRS$\"" + assert_raises "weave_on $HOST ps | grep '^$CID [^ ]* $CIDRS$'" } # assert_zone_records [ ...] @@ -21,11 +21,11 @@ assert_zone_records() { FQDN=$1; shift # Assert correct number of records exist - assert "weave_on $HOST status | grep \"^$CID\" | grep -oE \"\b([0-9]{1,3}\.){3}[0-9]{1,3}\b\" | wc -l" $# + assert "weave_on $HOST status | grep '^$CID' | grep -oE '\b([0-9]{1,3}\.){3}[0-9]{1,3}\b' | wc -l" $# # Assert correct records exist for IP; do - assert_raises "weave_on $HOST status | grep \"$CID\" | grep \"$IP\" | grep \"$FQDN\"" + assert_raises "weave_on $HOST status | grep '$CID' | grep '$IP' | grep '$FQDN'" done } diff --git a/test/config.sh b/test/config.sh index 1ea8018e..190fb90e 100644 --- a/test/config.sh +++ b/test/config.sh @@ -125,9 +125,9 @@ assert_dns_record() { [[ -z "$DEBUG" ]] || greyly echo "Checking whether $name exists at $host:$container" got_ip=$(exec_on $host $container getent hosts $name) - assert_raises "echo \"$got_ip\" | grep -q \"$exp_ips_regex\"" + assert_raises "echo '$got_ip' | grep -q '$exp_ips_regex'" - [[ -z "$DEBUG" ]] || greyly echo "Checking whether the IPs \"$@\" exists at $host:$container" + [[ -z "$DEBUG" ]] || greyly echo "Checking whether the IPs '$@' exists at $host:$container" for ip in "$@" ; do assert "exec_on $host $container getent hosts $ip | tr -s ' '" "$ip $name" done @@ -139,7 +139,7 @@ assert_no_dns_record() { container=$2 name=$3 - [[ -z "$DEBUG" ]] || greyly echo "Checking if \"$name\" does not exist at $host:$container" + [[ -z "$DEBUG" ]] || greyly echo "Checking if '$name' does not exist at $host:$container" assert_raises "exec_on $host $container getent hosts $name" 2 }