You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ge...@apache.org on 2018/04/27 14:13:36 UTC

lucene-solr:branch_7x: SOLR-11749: Fix logic errors in some assert funcs

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x 8b29e5eef -> b3f736d26


SOLR-11749: Fix logic errors in some assert funcs


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/b3f736d2
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/b3f736d2
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/b3f736d2

Branch: refs/heads/branch_7x
Commit: b3f736d2653143e5b4fc8dfa48f4dfde93f0e299
Parents: 8b29e5e
Author: Jason Gerlowski <ge...@apache.org>
Authored: Fri Apr 27 09:46:11 2018 -0400
Committer: Jason Gerlowski <ge...@apache.org>
Committed: Fri Apr 27 10:09:33 2018 -0400

----------------------------------------------------------------------
 solr/bin-test/utils/assert.sh | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b3f736d2/solr/bin-test/utils/assert.sh
----------------------------------------------------------------------
diff --git a/solr/bin-test/utils/assert.sh b/solr/bin-test/utils/assert.sh
index 7c0f323..a4bd56d 100644
--- a/solr/bin-test/utils/assert.sh
+++ b/solr/bin-test/utils/assert.sh
@@ -14,13 +14,16 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-ASSERT_SUCCEEDED=1
-ASSERT_FAILURE=0
+ASSERT_SUCCESS=0
+ASSERT_FAILURE=1
+
+TEST_SUCCESS=0
+TEST_FAILURE=1
 
 function assert_cmd_succeeded() {
   retval=$?
   
-  if [[ $? -ne 0 ]]; then
+  if [[ $retval -ne 0 ]]; then
     echo "Expected command $1 to succeed, but exited with $retval"
     return $ASSERT_FAILURE
   fi
@@ -31,7 +34,7 @@ function assert_cmd_succeeded() {
 function assert_cmd_failed() {
   retval=$?
   
-  if [[ $? -eq 0 ]]; then
+  if [[ $retval -eq 0 ]]; then
     echo "Expected command $1 to fail, but exited with $retval"
     return $ASSERT_FAILURE
   fi
@@ -67,9 +70,9 @@ function assert_collection_exists() {
   local coll_name=$1
   local coll_list=$(bin/solr zk ls /collections -z localhost:9983)
 
-  for coll in "$coll_list";
+  for coll in $coll_list;
   do
-    if [[ $(echo $coll | tr -d " ") -eq $coll_name ]]; then
+    if [[ $(echo $coll | tr -d " ") == $coll_name ]]; then
       return $ASSERT_SUCCESS
     fi
   done
@@ -81,9 +84,10 @@ function assert_collection_exists() {
 function assert_collection_doesnt_exist() {
   local coll_name=$1
   local coll_list=$(bin/solr zk ls /collections -z localhost:9983)
-  for coll in "$coll_list";
+  for coll in $coll_list;
   do
-    if [[ $(echo $coll | tr -d " ") -eq $coll_name ]]; then
+    echo "Comparing $coll to $coll_name"
+    if [[ $(echo $coll | tr -d " ") == "$coll_name" ]]; then
       echo "Expected not to find collection [$coll_name], but it exists"
       return $ASSERT_FAILURE
     fi
@@ -96,9 +100,9 @@ function assert_config_exists() {
   local config_name=$1
   local config_list=$(bin/solr zk ls /configs -z localhost:9983)
 
-  for config in "$config_list";
+  for config in $config_list;
   do
-    if [[ $(echo $config | tr -d " ") -eq $config_name ]]; then
+    if [[ $(echo $config | tr -d " ") == $config_name ]]; then
       return $ASSERT_SUCCESS
     fi
   done
@@ -111,9 +115,9 @@ function assert_config_doesnt_exist() {
   local config_name=$1
   local config_list=$(bin/solr zk ls /configs -z localhost:9983)
 
-  for config in "$config_list";
+  for config in $config_list;
   do
-    if [[ $(echo $config | tr -d " ") -eq $config_name ]]; then
+    if [[ $(echo $config | tr -d " ") == $config_name ]]; then
       echo "Expected not to find config [$config_name], but it exists"
       return $ASSERT_FAILURE
     fi