You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by aw...@apache.org on 2019/01/16 00:20:41 UTC

[cassandra] branch cassandra-3.0 updated: Add a script to make running the cqlsh tests in cassandra repo easier

This is an automated email from the ASF dual-hosted git repository.

aweisberg pushed a commit to branch cassandra-3.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-3.0 by this push:
     new a9d1af9  Add a script to make running the cqlsh tests in cassandra repo easier
a9d1af9 is described below

commit a9d1af96b515c06f56b49fd9894c3f7216aa099d
Author: Dinesh A. Joshi <di...@apple.com>
AuthorDate: Fri Jan 4 12:43:34 2019 -0800

    Add a script to make running the cqlsh tests in cassandra repo easier
    
    Patch by Dinesh Joshi; Reviewed by Ariel Weisberg for CASSANDRA-14951
---
 CHANGES.txt                    |   1 +
 pylib/cassandra-cqlsh-tests.sh | 100 +++++++++++++++++++++++++++++++++++++++++
 pylib/cqlshlib/setup.cfg       |   4 ++
 pylib/requirements.txt         |  21 +++++++++
 4 files changed, 126 insertions(+)

diff --git a/CHANGES.txt b/CHANGES.txt
index bb8b54c..5faac66 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.18
+ * Add a script to make running the cqlsh tests in cassandra repo easier (CASSANDRA-14951)
  * If SizeEstimatesRecorder misses a 'onDropTable' notification, the size_estimates table will never be cleared for that table. (CASSANDRA-14905)
  * Counters fail to increment in 2.1/2.2 to 3.X mixed version clusters (CASSANDRA-14958)
  * Streaming needs to synchronise access to LifecycleTransaction (CASSANDRA-14554)
diff --git a/pylib/cassandra-cqlsh-tests.sh b/pylib/cassandra-cqlsh-tests.sh
new file mode 100755
index 0000000..1fb3aa0
--- /dev/null
+++ b/pylib/cassandra-cqlsh-tests.sh
@@ -0,0 +1,100 @@
+#!/bin/bash -x
+
+################################
+#
+# Prep
+#
+################################
+
+WORKSPACE=$1
+
+if [ "${WORKSPACE}" = "" ]; then
+    echo "Specify Cassandra source directory"
+    exit
+fi
+
+export PYTHONIOENCODING="utf-8"
+export PYTHONUNBUFFERED=true
+export CASS_DRIVER_NO_EXTENSIONS=true
+export CASS_DRIVER_NO_CYTHON=true
+export CCM_MAX_HEAP_SIZE="2048M"
+export CCM_HEAP_NEWSIZE="200M"
+export CCM_CONFIG_DIR=${WORKSPACE}/.ccm
+export NUM_TOKENS="32"
+export CASSANDRA_DIR=${WORKSPACE}
+
+# Loop to prevent failure due to maven-ant-tasks not downloading a jar..
+for x in $(seq 1 3); do
+    ant -buildfile ${CASSANDRA_DIR}/build.xml realclean jar
+    RETURN="$?"
+    if [ "${RETURN}" -eq "0" ]; then
+        break
+    fi
+done
+# Exit, if we didn't build successfully
+if [ "${RETURN}" -ne "0" ]; then
+    echo "Build failed with exit code: ${RETURN}"
+    exit ${RETURN}
+fi
+
+# Set up venv with dtest dependencies
+set -e # enable immediate exit if venv setup fails
+virtualenv --python=python2 --no-site-packages venv
+source venv/bin/activate
+pip install -r ${CASSANDRA_DIR}/pylib/requirements.txt
+pip freeze
+
+if [ "$cython" = "yes" ]; then
+    pip install "Cython>=0.20,<0.25"
+    cd pylib/; python setup.py build_ext --inplace
+    cd ${WORKSPACE}
+fi
+
+################################
+#
+# Main
+#
+################################
+
+ccm remove test || true # in case an old ccm cluster is left behind
+ccm create test -n 1 --install-dir=${CASSANDRA_DIR}
+ccm updateconf "enable_user_defined_functions: true"
+
+version_from_build=$(ccm node1 versionfrombuild)
+export pre_or_post_cdc=$(python -c """from distutils.version import LooseVersion
+print \"postcdc\" if LooseVersion(\"${version_from_build}\") >= \"3.8\" else \"precdc\"
+""")
+case "${pre_or_post_cdc}" in
+    postcdc)
+        ccm updateconf "cdc_enabled: true"
+        ;;
+    precdc)
+        :
+        ;;
+    *)
+        echo "${pre_or_post_cdc}" is an invalid value.
+        exit 1
+        ;;
+esac
+
+ccm start --wait-for-binary-proto
+
+cd ${CASSANDRA_DIR}/pylib/cqlshlib/
+
+set +e # disable immediate exit from this point
+nosetests
+
+ccm remove
+mv nosetests.xml ${WORKSPACE}/cqlshlib.xml
+
+################################
+#
+# Clean
+#
+################################
+
+# /virtualenv
+deactivate
+
+# Exit cleanly for usable "Unstable" status
+exit 0
diff --git a/pylib/cqlshlib/setup.cfg b/pylib/cqlshlib/setup.cfg
new file mode 100644
index 0000000..6c523ee
--- /dev/null
+++ b/pylib/cqlshlib/setup.cfg
@@ -0,0 +1,4 @@
+[nosetests]
+verbosity=3
+detailed-errors=1
+with-xunit=1
diff --git a/pylib/requirements.txt b/pylib/requirements.txt
new file mode 100644
index 0000000..a9b6217
--- /dev/null
+++ b/pylib/requirements.txt
@@ -0,0 +1,21 @@
+# See python driver docs: futures and six have to be installed before
+# cythonizing the driver, perhaps only on old pips.
+# http://datastax.github.io/python-driver/installation.html#cython-based-extensions
+futures
+six
+-e git+https://github.com/datastax/python-driver.git@cassandra-test#egg=cassandra-driver
+# Used ccm version is tracked by cassandra-test branch in ccm repo. Please create a PR there for fixes or upgrades to new releases.
+-e git+https://github.com/riptano/ccm.git@cassandra-test#egg=ccm
+cql
+decorator
+docopt
+enum34
+flaky
+mock
+nose
+nose-test-select
+parse
+pycodestyle
+psutil
+pycassa
+thrift==0.9.3


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org