lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [02/50] [abbrv] lucene-solr:jira/solr-11779: SOLR-11749: Fix logic errors in some assert funcs
Date Tue, 08 May 2018 21:14:48 GMT
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/43c086a0
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/43c086a0
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/43c086a0

Branch: refs/heads/jira/solr-11779
Commit: 43c086a002b3488a6fdd6a71ce1879a2538cce4e
Parents: e263ae30
Author: Jason Gerlowski <gerlowskija@apache.org>
Authored: Fri Apr 27 09:46:11 2018 -0400
Committer: Jason Gerlowski <gerlowskija@apache.org>
Committed: Fri Apr 27 09:46:11 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/43c086a0/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


Mime
View raw message