You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ak...@apache.org on 2016/05/18 09:50:01 UTC
[4/9] ignite git commit: IGNITE-1371 Implemented Cassandra cache
store.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b33eb027/modules/cassandra/src/test/bootstrap/aws/tests/tests-report.sh
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/bootstrap/aws/tests/tests-report.sh b/modules/cassandra/src/test/bootstrap/aws/tests/tests-report.sh
new file mode 100644
index 0000000..762dc6f
--- /dev/null
+++ b/modules/cassandra/src/test/bootstrap/aws/tests/tests-report.sh
@@ -0,0 +1,590 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#profile=/home/ignite/.bash_profile
+profile=/root/.bash_profile
+
+. $profile
+
+validate()
+{
+ if [ -z "$TESTS_TYPE" ]; then
+ terminate "Tests type 'ignite' or 'cassandra' should be specified"
+ fi
+
+ if [ "$TESTS_TYPE" != "ignite" ] && [ "$TESTS_TYPE" != "cassandra" ]; then
+ terminate "Incorrect tests type specified: $TESTS_TYPE"
+ fi
+
+ if [ -z "$S3_TESTS_SUCCESS_URL" ]; then
+ terminate "Tests success URL doesn't specified"
+ fi
+
+ if [[ "$S3_TESTS_SUCCESS_URL" != */ ]]; then
+ S3_TESTS_SUCCESS_URL=${S3_TESTS_SUCCESS_URL}/
+ fi
+
+ if [ -z "$S3_TESTS_FAILURE_URL" ]; then
+ terminate "Tests failure URL doesn't specified"
+ fi
+
+ if [[ "$S3_TESTS_FAILURE_URL" != */ ]]; then
+ S3_TESTS_FAILURE_URL=${S3_TESTS_FAILURE_URL}/
+ fi
+
+ if [ -z "$S3_TESTS_RUNNING_URL" ]; then
+ terminate "Tests running URL doesn't specified"
+ fi
+
+ if [[ "$S3_TESTS_RUNNING_URL" != */ ]]; then
+ S3_TESTS_RUNNING_URL=${S3_TESTS_RUNNING_URL}/
+ fi
+
+ if [ -z "$S3_TESTS_WAITING_URL" ]; then
+ terminate "Tests waiting URL doesn't specified"
+ fi
+
+ if [[ "$S3_TESTS_WAITING_URL" != */ ]]; then
+ S3_TESTS_WAITING_URL=${S3_TESTS_WAITING_URL}/
+ fi
+
+ if [ -z "$S3_IGNITE_SUCCESS_URL" ]; then
+ terminate "Ignite success URL doesn't specified"
+ fi
+
+ if [[ "$S3_IGNITE_SUCCESS_URL" != */ ]]; then
+ S3_IGNITE_SUCCESS_URL=${S3_IGNITE_SUCCESS_URL}/
+ fi
+
+ if [ -z "$S3_IGNITE_FAILURE_URL" ]; then
+ terminate "Ignite failure URL doesn't specified"
+ fi
+
+ if [[ "$S3_IGNITE_FAILURE_URL" != */ ]]; then
+ S3_IGNITE_FAILURE_URL=${S3_IGNITE_FAILURE_URL}/
+ fi
+
+ if [ -z "$S3_CASSANDRA_SUCCESS_URL" ]; then
+ terminate "Cassandra success URL doesn't specified"
+ fi
+
+ if [[ "$S3_CASSANDRA_SUCCESS_URL" != */ ]]; then
+ S3_CASSANDRA_SUCCESS_URL=${S3_CASSANDRA_SUCCESS_URL}/
+ fi
+
+ if [ -z "$S3_CASSANDRA_FAILURE_URL" ]; then
+ terminate "Cassandra failure URL doesn't specified"
+ fi
+
+ if [[ "$S3_CASSANDRA_FAILURE_URL" != */ ]]; then
+ S3_CASSANDRA_FAILURE_URL=${S3_CASSANDRA_FAILURE_URL}/
+ fi
+
+ if [ -z "$S3_TEST_NODES_DISCOVERY_URL" ]; then
+ terminate "Tests S3 discovery URL doesn't specified"
+ fi
+
+ if [[ "$S3_TEST_NODES_DISCOVERY_URL" != */ ]]; then
+ S3_TEST_NODES_DISCOVERY_URL=${S3_TEST_NODES_DISCOVERY_URL}/
+ fi
+
+ if [ -z "$S3_CASSANDRA_NODES_DISCOVERY_URL" ]; then
+ terminate "Cassandra S3 discovery URL doesn't specified"
+ fi
+
+ if [[ "$S3_CASSANDRA_NODES_DISCOVERY_URL" != */ ]]; then
+ S3_CASSANDRA_NODES_DISCOVERY_URL=${S3_CASSANDRA_NODES_DISCOVERY_URL}/
+ fi
+
+ if [ -z "$S3_IGNITE_NODES_DISCOVERY_URL" ]; then
+ terminate "Ignite S3 discovery URL doesn't specified"
+ fi
+
+ if [[ "$S3_CASSANDRA_NODES_DISCOVERY_URL" != */ ]]; then
+ S3_CASSANDRA_NODES_DISCOVERY_URL=${S3_CASSANDRA_NODES_DISCOVERY_URL}/
+ fi
+
+ if [ -z "$S3_IGNITE_NODES_DISCOVERY_URL" ]; then
+ terminate "Ignite S3 discovery URL doesn't specified"
+ fi
+
+ if [[ "$S3_IGNITE_NODES_DISCOVERY_URL" != */ ]]; then
+ S3_IGNITE_NODES_DISCOVERY_URL=${S3_IGNITE_NODES_DISCOVERY_URL}/
+ fi
+}
+
+reportTestsSummary()
+{
+ echo "[INFO] Preparing tests results summary"
+
+ TESTS_SUMMARY_DIR=/opt/ignite-cassandra-tests/tests-summary
+ SUCCEED_NODES_FILE=$TESTS_SUMMARY_DIR/succeed-nodes
+ SUCCEED_NODES_DIR=$TESTS_SUMMARY_DIR/succeed
+ FAILED_NODES_FILE=$TESTS_SUMMARY_DIR/failed-nodes
+ FAILED_NODES_DIR=$TESTS_SUMMARY_DIR/failed
+ REPORT_FILE=$TESTS_SUMMARY_DIR/report.txt
+
+ rm -Rf $TESTS_SUMMARY_DIR
+ mkdir -p $TESTS_SUMMARY_DIR
+ mkdir -p $SUCCEED_NODES_DIR
+ mkdir -p $FAILED_NODES_DIR
+
+ aws s3 ls $S3_TESTS_SUCCESS_URL | sed -r "s/PRE //g" | sed -r "s/ //g" | sed -r "s/\///g" > $SUCCEED_NODES_FILE
+ aws s3 ls $S3_TESTS_FAILURE_URL | sed -r "s/PRE //g" | sed -r "s/ //g" | sed -r "s/\///g" > $FAILED_NODES_FILE
+
+ succeedCount=$(cat $SUCCEED_NODES_FILE | wc -l)
+ failedCount=$(cat $FAILED_NODES_FILE | wc -l)
+ count=$(( $succeedCount+$failedCount ))
+
+ echo "Test type : $TESTS_TYPE" > $REPORT_FILE
+ echo "Test nodes count : $count" >> $REPORT_FILE
+ echo "Test nodes succeed: $succeedCount" >> $REPORT_FILE
+ echo "Test nodes failed : $failedCount" >> $REPORT_FILE
+ echo "----------------------------------------------------------------------------------------------" >> $REPORT_FILE
+
+ if [ $succeedCount -gt 0 ]; then
+ echo "Succeed test nodes |" >> $REPORT_FILE
+ echo "-------------------" >> $REPORT_FILE
+ cat $SUCCEED_NODES_FILE >> $REPORT_FILE
+ echo "----------------------------------------------------------------------------------------------" >> $REPORT_FILE
+
+ aws s3 sync --delete $S3_TESTS_SUCCESS_URL $SUCCEED_NODES_DIR
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to get succeed tests details"
+ else
+ reportSucceedTestsStatistics "$REPORT_FILE" "$SUCCEED_NODES_DIR"
+ fi
+ fi
+
+ if [ $failedCount -gt 0 ]; then
+ echo "Failed test nodes |" >> $REPORT_FILE
+ echo "------------------" >> $REPORT_FILE
+ cat $FAILED_NODES_FILE >> $REPORT_FILE
+ echo "----------------------------------------------------------------------------------------------" >> $REPORT_FILE
+
+ aws sync --delete $S3_TESTS_FAILURE_URL $FAILED_NODES_DIR
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to get failed tests details"
+ else
+ reportFailedTestsDetailes "$REPORT_FILE" "$FAILED_NODES_DIR"
+ fi
+ fi
+
+ rm -f $HOME/tests-summary.zip
+
+ pushd $TESTS_SUMMARY_DIR
+
+ zip -r -9 $HOME/tests-summary.zip .
+ code=$?
+
+ rm -Rf $TESTS_SUMMARY_DIR
+
+ popd
+
+ if [ $code -ne 0 ]; then
+ echo "-------------------------------------------------------------------------------------"
+ echo "[ERROR] Failed to create tests summary zip archive $HOME/tests-summary.zip for $TESTS_SUMMARY_DIR"
+ echo "-------------------------------------------------------------------------------------"
+ return 1
+ fi
+
+ aws s3 cp --sse AES256 $HOME/tests-summary.zip $S3_TESTS_SUMMARY_URL
+ if [ $? -ne 0 ]; then
+ echo "-------------------------------------------------------------------------------------"
+ echo "[ERROR] Failed to uploat tests summary archive to: $S3_TESTS_SUMMARY_URL"
+ echo "-------------------------------------------------------------------------------------"
+ else
+ echo "-------------------------------------------------------------------------------------"
+ echo "[INFO] Tests results summary uploaded to: $S3_TESTS_SUMMARY_URL"
+ echo "-------------------------------------------------------------------------------------"
+ fi
+
+ rm -f $HOME/tests-summary.zip
+}
+
+reportSucceedTestsStatistics()
+{
+ writeMsg=0
+ writeErrors=0
+ writeSpeed=0
+ blkWriteMsg=0
+ blkWriteErrors=0
+ blkWriteSpeed=0
+ readMsg=0
+ readErrors=0
+ readSpeed=0
+ blkReadMsg=0
+ blkReadErrors=0
+ blkReadSpeed=0
+
+ writeErrNodes=
+ blkWriteErrNodes=
+ readErrNodes=
+ blkReadErrNodes=
+
+ tmpFile=`mktemp`
+
+ for dir in $2/*
+ do
+ node=$(echo $dir | sed -r "s/^.*\///g")
+ echo "-------------------------------------------------------------------------------------"
+ echo "[INFO] Gathering statistics from $node test node"
+ echo "-------------------------------------------------------------------------------------"
+
+ logFile=$(ls $dir | grep "${TESTS_TYPE}-load-tests.log" | head -1)
+ if [ -z "$logFile" ]; then
+ echo "[WARN] Node $node marked as succeeded, but it doesn't have \"${TESTS_TYPE}-load-tests.log\" tests results summary file"
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "Node $node marked as succeeded," >> $tmpFile
+ echo "but it doesn't have \"${TESTS_TYPE}-load-tests.log\" tests results summary file" >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ continue
+ fi
+
+ logFile=$dir/$logFile
+ if [ ! -f "$logFile" ]; then
+ echo "[WARN] Node $node marked as succeeded, but it doesn't have \"${TESTS_TYPE}-load-tests.log\" tests results summary file"
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "Node $node marked as succeeded," >> $tmpFile
+ echo "but it doesn't have \"${TESTS_TYPE}-load-tests.log\" tests results summary file" >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ continue
+ fi
+
+ cnt=$(cat $logFile | grep "^WRITE messages" | sed -r "s/WRITE messages: //g" | xargs)
+ if [ -n "$cnt" ]; then
+ writeMsg=$(( $writeMsg+$cnt ))
+ if [ $cnt -ne 0 ]; then
+ echo "[INFO] WRITE messages: $cnt"
+ else
+ echo "[WARN] WRITE messages count is zero for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "WRITE messages count is zero for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+ else
+ echo "[WARN] Failed to detect WRITE messages count for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "Failed to detect WRITE messages count for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+
+ cnt=$(cat $logFile | grep "^WRITE errors" | sed -r "s/WRITE errors: //g" | sed -r "s/,.*//g" | xargs)
+ if [ -n "$cnt" ]; then
+ echo "[INFO] WRITE errors: $cnt"
+ writeErrors=$(( $writeErrors+$cnt ))
+ if [ $cnt -ne 0 ]; then
+ if [ -n "$writeErrNodes" ]; then
+ writeErrNodes="${writeErrNodes}, "
+ fi
+ writeErrNodes="${writeErrNodes}${node}"
+ fi
+ else
+ echo "[WARN] Failed to detect WRITE errors count for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "Failed to detect WRITE errors count for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+
+ cnt=$(cat $logFile | grep "^WRITE speed" | sed -r "s/WRITE speed: //g" | sed -r "s/ msg\/sec//g" | xargs)
+ if [ -n "$cnt" ]; then
+ writeSpeed=$(( $writeSpeed+$cnt ))
+ if [ $cnt -ne 0 ]; then
+ echo "[INFO] WRITE speed: $cnt msg/sec"
+ else
+ echo "[WARN] WRITE speed is zero for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "WRITE speed is zero for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+ else
+ echo "[WARN] Failed to detect WRITE speed for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "Failed to detect WRITE speed for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+
+ cnt=$(cat $logFile | grep "^BULK_WRITE messages" | sed -r "s/BULK_WRITE messages: //g" | xargs)
+ if [ -n "$cnt" ]; then
+ blkWriteMsg=$(( $blkWriteMsg+$cnt ))
+ if [ $cnt -ne 0 ]; then
+ echo "[INFO] BULK_WRITE messages: $cnt"
+ else
+ echo "[WARN] BULK_WRITE messages count is zero for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "BULK_WRITE messages count is zero for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+ else
+ echo "[WARN] Failed to detect BULK_WRITE messages count for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "Failed to detect BULK_WRITE messages count for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+
+ cnt=$(cat $logFile | grep "^BULK_WRITE errors" | sed -r "s/BULK_WRITE errors: //g" | sed -r "s/,.*//g" | xargs)
+ if [ -n "$cnt" ]; then
+ blkWriteErrors=$(( $blkWriteErrors+$cnt ))
+ echo "[INFO] BULK_WRITE errors: $cnt"
+ if [ $cnt -ne 0 ]; then
+ if [ -n "$blkWriteErrNodes" ]; then
+ blkWriteErrNodes="${blkWriteErrNodes}, "
+ fi
+ blkWriteErrNodes="${blkWriteErrNodes}${node}"
+ fi
+ else
+ echo "[WARN] Failed to detect BULK_WRITE errors count for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "Failed to detect BULK_WRITE errors count for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+
+ cnt=$(cat $logFile | grep "^BULK_WRITE speed" | sed -r "s/BULK_WRITE speed: //g" | sed -r "s/ msg\/sec//g" | xargs)
+ if [ -n "$cnt" ]; then
+ blkWriteSpeed=$(( $blkWriteSpeed+$cnt ))
+ if [ $cnt -ne 0 ]; then
+ echo "[INFO] BULK_WRITE speed: $cnt msg/sec"
+ else
+ echo "[WARN] BULK_WRITE speed is zero for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "BULK_WRITE speed is zero for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+ else
+ echo "[WARN] Failed to detect BULK_WRITE speed for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "Failed to detect BULK_WRITE speed for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+
+ cnt=$(cat $logFile | grep "^READ messages" | sed -r "s/READ messages: //g" | xargs)
+ if [ -n "$cnt" ]; then
+ readMsg=$(( $readMsg+$cnt ))
+ if [ $cnt -ne 0 ]; then
+ echo "[INFO] READ messages: $cnt"
+ else
+ echo "[WARN] READ messages count is zero for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "READ messages count is zero for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+ else
+ echo "[WARN] Failed to detect READ messages count for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "Failed to detect READ messages count for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+
+ cnt=$(cat $logFile | grep "^READ errors" | sed -r "s/READ errors: //g" | sed -r "s/,.*//g" | xargs)
+ if [ -n "$cnt" ]; then
+ readErrors=$(( $readErrors+$cnt ))
+ echo "[INFO] READ errors: $cnt"
+ if [ $cnt -ne 0 ]; then
+ if [ -n "$readErrNodes" ]; then
+ blkWriteErrNodes="${readErrNodes}, "
+ fi
+ readErrNodes="${readErrNodes}${node}"
+ fi
+ else
+ echo "[WARN] Failed to detect READ errors count for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "Failed to detect READ errors count for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+
+ cnt=$(cat $logFile | grep "^READ speed" | sed -r "s/READ speed: //g" | sed -r "s/ msg\/sec//g" | xargs)
+ if [ -n "$cnt" ]; then
+ readSpeed=$(( $readSpeed+$cnt ))
+ if [ $cnt -ne 0 ]; then
+ echo "[INFO] READ speed: $cnt msg/sec"
+ else
+ echo "[WARN] READ speed is zero for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "READ speed is zero for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+ else
+ echo "[WARN] Failed to detect READ speed for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "Failed to detect READ speed for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+
+ cnt=$(cat $logFile | grep "^BULK_READ messages" | sed -r "s/BULK_READ messages: //g" | xargs)
+ if [ -n "$cnt" ]; then
+ blkReadMsg=$(( $blkReadMsg+$cnt ))
+ if [ $cnt -ne 0 ]; then
+ echo "[INFO] BULK_READ messages: $cnt"
+ else
+ echo "[WARN] BULK_READ messages count is zero for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "BULK_READ messages count is zero for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+ else
+ echo "[WARN] Failed to detect BULK_READ messages count for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "Failed to detect BULK_READ messages count for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+
+ cnt=$(cat $logFile | grep "^BULK_READ errors" | sed -r "s/BULK_READ errors: //g" | sed -r "s/,.*//g" | xargs)
+ if [ -n "$cnt" ]; then
+ blkReadErrors=$(( $blkReadErrors+$cnt ))
+ echo "[INFO] BULK_READ errors: $cnt"
+ if [ $cnt -ne 0 ]; then
+ if [ -n "$blkReadErrNodes" ]; then
+ blkReadErrNodes="${blkReadErrNodes}, "
+ fi
+ blkReadErrNodes="${blkReadErrNodes}${node}"
+ fi
+ else
+ echo "[WARN] Failed to detect BULK_READ errors count for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "Failed to detect BULK_READ errors count for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+
+ cnt=$(cat $logFile | grep "^BULK_READ speed" | sed -r "s/BULK_READ speed: //g" | sed -r "s/ msg\/sec//g" | xargs)
+ if [ -n "$cnt" ]; then
+ blkReadSpeed=$(( $blkReadSpeed+$cnt ))
+ if [ $cnt -ne 0 ]; then
+ echo "[INFO] BULK_READ speed: $cnt msg/sec"
+ else
+ echo "[WARN] BULK_READ speed is zero for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "BULK_READ speed is zero for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+ else
+ echo "[WARN] Failed to detect BULK_READ speed for $node node. This test probably failed."
+ echo "WARNING |" >> $tmpFile
+ echo "--------" >> $tmpFile
+ echo "Failed to detect BULK_READ speed for $node node. This test probably failed." >> $tmpFile
+ echo "----------------------------------------------------------------------------------------------" >> $tmpFile
+ fi
+ done
+
+ echo "-------------------------------------------------------------------------------------"
+
+ echo "WRITE test metrics |" >> $1
+ echo "-------------------" >> $1
+ echo "Messages: $writeMsg" >> $1
+ echo "Speed : $writeSpeed msg/sec" >> $1
+ echo "Errors : $writeErrors" >> $1
+ echo "----------------------------------------------------------------------------------------------" >> $1
+
+ echo "BULK_WRITE test metrics |" >> $1
+ echo "------------------------" >> $1
+ echo "Messages: $blkWriteMsg" >> $1
+ echo "Speed : $blkWriteSpeed msg/sec" >> $1
+ echo "Errors : $blkWriteErrors" >> $1
+ echo "----------------------------------------------------------------------------------------------" >> $1
+
+ echo "READ test metrics |" >> $1
+ echo "------------------" >> $1
+ echo "Messages: $readMsg" >> $1
+ echo "Speed : $readSpeed msg/sec" >> $1
+ echo "Errors : $readErrors" >> $1
+ echo "----------------------------------------------------------------------------------------------" >> $1
+
+ echo "BULK_READ test metrics |" >> $1
+ echo "-----------------------" >> $1
+ echo "Messages: $blkReadMsg" >> $1
+ echo "Speed : $blkReadSpeed msg/sec" >> $1
+ echo "Errors : $blkReadErrors" >> $1
+ echo "----------------------------------------------------------------------------------------------" >> $1
+
+ if [ -n "$writeErrNodes" ]; then
+ echo "Nodes having WRITE errors |" >> $1
+ echo "-------------------------------" >> $1
+ echo "$writeErrNodes" >> $1
+ echo "----------------------------------------------------------------------------------------------" >> $1
+ fi
+
+ if [ -n "$blkWriteErrNodes" ]; then
+ echo "Nodes having BULK_WRITE errors |" >> $1
+ echo "-------------------------------" >> $1
+ echo "$blkWriteErrNodes" >> $1
+ echo "----------------------------------------------------------------------------------------------" >> $1
+ fi
+
+ if [ -n "$readErrNodes" ]; then
+ echo "Nodes having READ errors |" >> $1
+ echo "-------------------------------" >> $1
+ echo "$readErrNodes" >> $1
+ echo "----------------------------------------------------------------------------------------------" >> $1
+ fi
+
+ if [ -n "$blkReadErrNodes" ]; then
+ echo "Nodes having BULK_READ errors |" >> $1
+ echo "-------------------------------" >> $1
+ echo "$blkReadErrNodes" >> $1
+ echo "----------------------------------------------------------------------------------------------" >> $1
+ fi
+
+ cat $tmpFile >> $1
+
+ rm -f $tmpFile
+}
+
+reportFailedTestsDetailes()
+{
+ for dir in $2/*
+ do
+ node=$(echo $dir | sed -r "s/^.*\///g")
+ if [ -z "$node" ]; then
+ continue
+ fi
+
+ echo "----------------------------------------------------------------------------------------------" >> $1
+ echo "Error details for node: $node" >> $1
+ echo "----------------------------------------------------------------------------------------------" >> $1
+
+ if [ -f "$dir/__error__" ]; then
+ cat $dir/__error__ >> $1
+ else
+ echo "N/A" >> $1
+ fi
+ done
+}
+
+validate
+reportTestsSummary
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b33eb027/modules/cassandra/src/test/bootstrap/aws/tests/tests-run.sh
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/bootstrap/aws/tests/tests-run.sh b/modules/cassandra/src/test/bootstrap/aws/tests/tests-run.sh
new file mode 100644
index 0000000..74a769a
--- /dev/null
+++ b/modules/cassandra/src/test/bootstrap/aws/tests/tests-run.sh
@@ -0,0 +1,715 @@
+#!/bin/bash
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#profile=/home/ignite/.bash_profile
+profile=/root/.bash_profile
+
+. $profile
+
+terminate()
+{
+ if [[ "$S3_TESTS_SUCCESS_URL" != */ ]]; then
+ S3_TESTS_SUCCESS_URL=${S3_TESTS_SUCCESS_URL}/
+ fi
+
+ if [[ "$S3_TESTS_FAILURE_URL" != */ ]]; then
+ S3_TESTS_FAILURE_URL=${S3_TESTS_FAILURE_URL}/
+ fi
+
+ msg=$HOST_NAME
+
+ if [ -n "$1" ]; then
+ echo "[ERROR] $1"
+ echo "[ERROR]-----------------------------------------------------"
+ echo "[ERROR] Tests execution failed"
+ echo "[ERROR]-----------------------------------------------------"
+ msg=$1
+ reportFolder=${S3_TESTS_FAILURE_URL}${HOST_NAME}
+ reportFile=$reportFolder/__error__
+ else
+ echo "[INFO]-----------------------------------------------------"
+ echo "[INFO] Tests execution successfully completed"
+ echo "[INFO]-----------------------------------------------------"
+ reportFolder=${S3_TESTS_SUCCESS_URL}${HOST_NAME}
+ reportFile=$reportFolder/__success__
+ fi
+
+ echo $msg > /opt/ignite-cassandra-tests/tests-result
+
+ aws s3 rm --recursive $reportFolder
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed drop report folder: $reportFolder"
+ fi
+
+ if [ -d "/opt/ignite-cassandra-tests/logs" ]; then
+ aws s3 sync --sse AES256 /opt/ignite-cassandra-tests/logs $reportFolder
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to export tests logs to: $reportFolder"
+ fi
+ fi
+
+ aws s3 cp --sse AES256 /opt/ignite-cassandra-tests/tests-result $reportFile
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to report tests results to: $reportFile"
+ fi
+
+ aws s3 rm ${S3_TESTS_RUNNING_URL}${HOST_NAME}
+ aws s3 rm ${S3_TESTS_WAITING_URL}${HOST_NAME}
+
+ if [ "$FIRST_NODE" == "true" ]; then
+ waitAllTestNodesCompleted
+ removeFirstNodeLock
+ reportScript=$(readlink -m $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/tests-report.sh)
+ $reportScript
+
+ if [ -n "$S3_LOGS_TRIGGER_URL" ]; then
+ aws s3 cp --sse AES256 /opt/ignite-cassandra-tests/hostname $S3_LOGS_TRIGGER_URL
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to trigger logs collection"
+ fi
+ fi
+ fi
+
+ rm -Rf /opt/ignite-cassandra-tests/tests-result /opt/ignite-cassandra-tests/hostname
+
+ if [ -n "$1" ]; then
+ exit 1
+ fi
+
+ exit 0
+}
+
+cleanupMetadata()
+{
+ echo "[INFO] Running cleanup"
+ aws s3 rm $S3_TESTS_SUMMARY_URL
+ aws s3 rm --recursive $S3_TEST_NODES_DISCOVERY_URL
+ aws s3 rm --recursive $S3_TESTS_RUNNING_URL
+ aws s3 rm --recursive $S3_TESTS_WAITING_URL
+ aws s3 rm --recursive $S3_TESTS_SUCCESS_URL
+ aws s3 rm --recursive $S3_TESTS_FAILURE_URL
+ echo "[INFO] Cleanup completed"
+}
+
+registerTestNode()
+{
+ aws s3 cp --sse AES256 /opt/ignite-cassandra-tests/hostname ${S3_TEST_NODES_DISCOVERY_URL}${HOST_NAME}
+ if [ $? -ne 0 ]; then
+ terminate "Failed to create test node registration flag: ${S3_TEST_NODES_DISCOVERY_URL}${HOST_NAME}"
+ fi
+}
+
+createRunningFlag()
+{
+ aws s3 cp --sse AES256 /opt/ignite-cassandra-tests/hostname ${S3_TESTS_RUNNING_URL}${HOST_NAME}
+ if [ $? -ne 0 ]; then
+ terminate "Failed to create tests running flag: ${S3_TESTS_RUNNING_URL}${HOST_NAME}"
+ fi
+}
+
+dropRunningFlag()
+{
+ exists=$(aws s3 ls ${S3_TESTS_RUNNING_URL}${HOST_NAME})
+ if [ -z "$exists" ]; then
+ return 0
+ fi
+
+ aws s3 rm ${S3_TESTS_RUNNING_URL}${HOST_NAME}
+ if [ $? -ne 0 ]; then
+ terminate "Failed to drop tests running flag: ${S3_TESTS_RUNNING_URL}${HOST_NAME}"
+ fi
+}
+
+createWaitingFlag()
+{
+ aws s3 cp --sse AES256 /opt/ignite-cassandra-tests/hostname ${S3_TESTS_WAITING_URL}${HOST_NAME}
+ if [ $? -ne 0 ]; then
+ terminate "Failed to create tests waiting flag: ${S3_TESTS_WAITING_URL}${HOST_NAME}"
+ fi
+}
+
+dropWaitingFlag()
+{
+ exists=$(aws s3 ls ${S3_TESTS_WAITING_URL}${HOST_NAME})
+ if [ -z "$exists" ]; then
+ return 0
+ fi
+
+ aws s3 rm ${S3_TESTS_WAITING_URL}${HOST_NAME}
+ if [ $? -ne 0 ]; then
+ terminate "Failed to drop tests waiting flag: ${S3_TESTS_WAITING_URL}${HOST_NAME}"
+ fi
+}
+
+dropTestsSummary()
+{
+ exists=$(aws s3 ls $S3_TESTS_SUMMARY_URL)
+ if [ -z "$exists" ]; then
+ return 0
+ fi
+
+ aws s3 rm $S3_TESTS_SUMMARY_URL
+ if [ $? -ne 0 ]; then
+ terminate "Failed to drop tests summary info: $S3_TESTS_SUMMARY_URL"
+ fi
+}
+
+validate()
+{
+ if [ -z "$TESTS_TYPE" ]; then
+ terminate "Tests type 'ignite' or 'cassandra' should be specified"
+ fi
+
+ if [ "$TESTS_TYPE" != "ignite" ] && [ "$TESTS_TYPE" != "cassandra" ]; then
+ terminate "Incorrect tests type specified: $TESTS_TYPE"
+ fi
+
+ if [ -z "$S3_TESTS_SUCCESS_URL" ]; then
+ terminate "Tests success URL doesn't specified"
+ fi
+
+ if [[ "$S3_TESTS_SUCCESS_URL" != */ ]]; then
+ S3_TESTS_SUCCESS_URL=${S3_TESTS_SUCCESS_URL}/
+ fi
+
+ if [ -z "$S3_TESTS_FAILURE_URL" ]; then
+ terminate "Tests failure URL doesn't specified"
+ fi
+
+ if [[ "$S3_TESTS_FAILURE_URL" != */ ]]; then
+ S3_TESTS_FAILURE_URL=${S3_TESTS_FAILURE_URL}/
+ fi
+
+ if [ -z "$S3_TESTS_RUNNING_URL" ]; then
+ terminate "Tests running URL doesn't specified"
+ fi
+
+ if [[ "$S3_TESTS_RUNNING_URL" != */ ]]; then
+ S3_TESTS_RUNNING_URL=${S3_TESTS_RUNNING_URL}/
+ fi
+
+ if [ -z "$S3_TESTS_WAITING_URL" ]; then
+ terminate "Tests waiting URL doesn't specified"
+ fi
+
+ if [[ "$S3_TESTS_WAITING_URL" != */ ]]; then
+ S3_TESTS_WAITING_URL=${S3_TESTS_WAITING_URL}/
+ fi
+
+ if [ -z "$S3_IGNITE_SUCCESS_URL" ]; then
+ terminate "Ignite success URL doesn't specified"
+ fi
+
+ if [[ "$S3_IGNITE_SUCCESS_URL" != */ ]]; then
+ S3_IGNITE_SUCCESS_URL=${S3_IGNITE_SUCCESS_URL}/
+ fi
+
+ if [ -z "$S3_IGNITE_FAILURE_URL" ]; then
+ terminate "Ignite failure URL doesn't specified"
+ fi
+
+ if [[ "$S3_IGNITE_FAILURE_URL" != */ ]]; then
+ S3_IGNITE_FAILURE_URL=${S3_IGNITE_FAILURE_URL}/
+ fi
+
+ if [ -z "$S3_CASSANDRA_SUCCESS_URL" ]; then
+ terminate "Cassandra success URL doesn't specified"
+ fi
+
+ if [[ "$S3_CASSANDRA_SUCCESS_URL" != */ ]]; then
+ S3_CASSANDRA_SUCCESS_URL=${S3_CASSANDRA_SUCCESS_URL}/
+ fi
+
+ if [ -z "$S3_CASSANDRA_FAILURE_URL" ]; then
+ terminate "Cassandra failure URL doesn't specified"
+ fi
+
+ if [[ "$S3_CASSANDRA_FAILURE_URL" != */ ]]; then
+ S3_CASSANDRA_FAILURE_URL=${S3_CASSANDRA_FAILURE_URL}/
+ fi
+
+ if [ -z "$S3_TEST_NODES_DISCOVERY_URL" ]; then
+ terminate "Tests S3 discovery URL doesn't specified"
+ fi
+
+ if [[ "$S3_TEST_NODES_DISCOVERY_URL" != */ ]]; then
+ S3_TEST_NODES_DISCOVERY_URL=${S3_TEST_NODES_DISCOVERY_URL}/
+ fi
+
+ if [ -z "$S3_CASSANDRA_NODES_DISCOVERY_URL" ]; then
+ terminate "Cassandra S3 discovery URL doesn't specified"
+ fi
+
+ if [[ "$S3_CASSANDRA_NODES_DISCOVERY_URL" != */ ]]; then
+ S3_CASSANDRA_NODES_DISCOVERY_URL=${S3_CASSANDRA_NODES_DISCOVERY_URL}/
+ fi
+
+ if [ -z "$S3_IGNITE_NODES_DISCOVERY_URL" ]; then
+ terminate "Ignite S3 discovery URL doesn't specified"
+ fi
+
+ if [[ "$S3_CASSANDRA_NODES_DISCOVERY_URL" != */ ]]; then
+ S3_CASSANDRA_NODES_DISCOVERY_URL=${S3_CASSANDRA_NODES_DISCOVERY_URL}/
+ fi
+
+ if [ -z "$S3_IGNITE_NODES_DISCOVERY_URL" ]; then
+ terminate "Ignite S3 discovery URL doesn't specified"
+ fi
+
+ if [[ "$S3_IGNITE_NODES_DISCOVERY_URL" != */ ]]; then
+ S3_IGNITE_NODES_DISCOVERY_URL=${S3_IGNITE_NODES_DISCOVERY_URL}/
+ fi
+}
+
+setupCassandraSeeds()
+{
+ if [ $CASSANDRA_NODES_COUNT -eq 0 ]; then
+ return 0
+ fi
+
+ CASSANDRA_SEEDS1=
+ CASSANDRA_SEEDS2=
+
+ echo "[INFO] Setting up Cassandra seeds"
+
+ echo "[INFO] Looking for Cassandra seeds in: $S3_CASSANDRA_NODES_DISCOVERY_URL"
+
+ startTime=$(date +%s)
+
+ while true; do
+ seeds=$(aws s3 ls $S3_CASSANDRA_NODES_DISCOVERY_URL | grep -v PRE | sed -r "s/^.* //g")
+ if [ -n "$seeds" ]; then
+ seeds=($seeds)
+ length=${#seeds[@]}
+
+ if [ $length -lt 4 ]; then
+ seed1=${seeds[0]}
+ seed2=${seeds[1]}
+ seed3=${seeds[2]}
+ else
+ pos1=$(($RANDOM%$length))
+ pos2=$(($RANDOM%$length))
+ pos3=$(($RANDOM%$length))
+ seed1=${seeds[${pos1}]}
+ seed2=${seeds[${pos2}]}
+ seed3=${seeds[${pos3}]}
+ fi
+
+ CASSANDRA_SEEDS1="<value>$seed1<\/value>"
+ CASSANDRA_SEEDS2="$seed1"
+
+ if [ "$seed2" != "$seed1" ] && [ -n "$seed2" ]; then
+ CASSANDRA_SEEDS1="$CASSANDRA_SEEDS1<value>$seed2<\/value>"
+ CASSANDRA_SEEDS2="${CASSANDRA_SEEDS2},$seed2"
+ fi
+
+ if [ "$seed3" != "$seed2" ] && [ "$seed3" != "$seed1" ] && [ -n "$seed3" ]; then
+ CASSANDRA_SEEDS1="$CASSANDRA_SEEDS1<value>$seed3<\/value>"
+ CASSANDRA_SEEDS2="${CASSANDRA_SEEDS2},$seed3"
+ fi
+
+ echo "[INFO] Using Cassandra seeds: $CASSANDRA_SEEDS2"
+
+ echo "contact.points=$CASSANDRA_SEEDS2" > /opt/ignite-cassandra-tests/settings/org/apache/ignite/tests/cassandra/connection.properties
+
+ cat /opt/ignite-cassandra-tests/bootstrap/aws/tests/ignite-cassandra-client-template.xml | sed -r "s/\\\$\{CASSANDRA_SEEDS\}/$CASSANDRA_SEEDS1/g" > /opt/ignite-cassandra-tests/bootstrap/aws/tests/ignite-cassandra-client-template1.xml
+
+ return 0
+ fi
+
+ currentTime=$(date +%s)
+ duration=$(( $currentTime-$startTime ))
+ duration=$(( $duration/60 ))
+
+ if [ $duration -gt $NODE_STARTUP_TIME ]; then
+ terminate "${NODE_STARTUP_TIME}min timeout expired, but no Cassandra nodes is up and running"
+ fi
+
+ echo "[INFO] Waiting for the first Cassandra node to start and publish its seed, time passed ${duration}min"
+
+ sleep 1m
+ done
+}
+
+setupIgniteSeeds()
+{
+ if [ $IGNITE_NODES_COUNT -eq 0 ]; then
+ return 0
+ fi
+
+ echo "[INFO] Setting up Ignite seeds"
+
+ echo "[INFO] Looking for Ignite seeds in: $S3_IGNITE_NODES_DISCOVERY_URL"
+
+ startTime=$(date +%s)
+
+ while true; do
+ seeds=$(aws s3 ls $S3_IGNITE_NODES_DISCOVERY_URL | grep -v PRE | sed -r "s/^.* //g")
+ if [ -n "$seeds" ]; then
+ seeds=($seeds)
+ length=${#seeds[@]}
+
+ if [ $length -lt 4 ]; then
+ seed1=${seeds[0]}
+ seed2=${seeds[1]}
+ seed3=${seeds[2]}
+ else
+ pos1=$(($RANDOM%$length))
+ pos2=$(($RANDOM%$length))
+ pos3=$(($RANDOM%$length))
+ seed1=${seeds[${pos1}]}
+ seed2=${seeds[${pos2}]}
+ seed3=${seeds[${pos3}]}
+ fi
+
+ IGNITE_SEEDS="<value>$seed1<\/value>"
+
+ if [ "$seed2" != "$seed1" ] && [ -n "$seed2" ]; then
+ IGNITE_SEEDS="$IGNITE_SEEDS<value>$seed2<\/value>"
+ fi
+
+ if [ "$seed3" != "$seed2" ] && [ "$seed3" != "$seed1" ] && [ -n "$seed3" ]; then
+ IGNITE_SEEDS="$IGNITE_SEEDS<value>$seed3<\/value>"
+ fi
+
+ echo "[INFO] Using Ignite seeds: $IGNITE_SEEDS"
+
+ cat /opt/ignite-cassandra-tests/bootstrap/aws/tests/ignite-cassandra-client-template1.xml | sed -r "s/\\\$\{IGNITE_SEEDS\}/$IGNITE_SEEDS/g" > /opt/ignite-cassandra-tests/settings/org/apache/ignite/tests/persistence/primitive/ignite-remote-client-config.xml
+ rm -f /opt/ignite-cassandra-tests/bootstrap/aws/tests/ignite-cassandra-client-template1.xml
+
+ return 0
+ fi
+
+ currentTime=$(date +%s)
+ duration=$(( $currentTime-$startTime ))
+ duration=$(( $duration/60 ))
+
+ if [ $duration -gt $NODE_STARTUP_TIME ]; then
+ terminate "${NODE_STARTUP_TIME}min timeout expired, but no Ignite nodes is up and running"
+ fi
+
+ echo "[INFO] Waiting for the first Ignite node to start and publish its seed, time passed ${duration}min"
+
+ sleep 1m
+ done
+}
+
+tryToGetFirstNodeLock()
+{
+ echo "[INFO] Trying to get first node lock"
+
+ checkFirstNodeLockExist
+ if [ $? -ne 0 ]; then
+ return 1
+ fi
+
+ createFirstNodeLock
+
+ sleep 5s
+
+ rm -Rf /opt/ignite-cassandra-tests/first-node-lock
+
+ aws s3 cp $S3_TESTS_FIRST_NODE_LOCK_URL /opt/ignite-cassandra-tests/first-node-lock
+ if [ $? -ne 0 ]; then
+ echo "[WARN] Failed to check just created first node lock"
+ return 1
+ fi
+
+ first_host=$(cat /opt/ignite-cassandra-tests/first-node-lock)
+
+ rm -f /opt/ignite-cassandra-tests/first-node-lock
+
+ if [ "$first_host" != "$HOST_NAME" ]; then
+ echo "[INFO] Node $first_host has discarded previously created first node lock"
+ return 1
+ fi
+
+ echo "[INFO] Congratulations, got first node lock"
+
+ return 0
+}
+
+checkFirstNodeLockExist()
+{
+ echo "[INFO] Checking for the first node lock"
+
+ lockExists=$(aws s3 ls $S3_TESTS_FIRST_NODE_LOCK_URL)
+ if [ -n "$lockExists" ]; then
+ echo "[INFO] First node lock already exists"
+ return 1
+ fi
+
+ echo "[INFO] First node lock doesn't exist yet"
+
+ return 0
+}
+
+createFirstNodeLock()
+{
+ aws s3 cp --sse AES256 /opt/ignite-cassandra-tests/hostname $S3_TESTS_FIRST_NODE_LOCK_URL
+ if [ $? -ne 0 ]; then
+ terminate "Failed to create first node lock"
+ fi
+ echo "[INFO] Created first node lock"
+}
+
+removeFirstNodeLock()
+{
+ exists=$(aws s3 ls $S3_TESTS_FIRST_NODE_LOCK_URL)
+ if [ -z "$exists" ]; then
+ return 0
+ fi
+
+ aws s3 rm $S3_TESTS_FIRST_NODE_LOCK_URL
+ if [ $? -ne 0 ]; then
+ echo "[ERROR] Failed to remove first node lock"
+ return 1
+ fi
+
+ echo "[INFO] Removed first node lock"
+}
+
+waitAllIgniteNodesReady()
+{
+ if [ $IGNITE_NODES_COUNT -eq 0 ]; then
+ return 0
+ fi
+
+ echo "[INFO] Waiting for all $IGNITE_NODES_COUNT Ignite nodes up and running"
+
+ while true; do
+ successCount=$(aws s3 ls $S3_IGNITE_SUCCESS_URL | wc -l)
+ failureCount=$(aws s3 ls $S3_IGNITE_FAILURE_URL | wc -l)
+
+ if [ $successCount -ge $IGNITE_NODES_COUNT ]; then
+ break
+ fi
+
+ if [ "$failureCount" != "0" ]; then
+ terminate "$failureCount Ignite nodes are failed to start. Thus it doesn't make sense to run tests."
+ fi
+
+ echo "[INFO] Waiting extra 1min"
+
+ sleep 1m
+ done
+
+ echo "[INFO] Congratulation, all $IGNITE_NODES_COUNT Ignite nodes are up and running"
+}
+
+waitAllCassandraNodesReady()
+{
+ if [ $CASSANDRA_NODES_COUNT -eq 0 ]; then
+ return 0
+ fi
+
+ echo "[INFO] Waiting for all $CASSANDRA_NODES_COUNT Cassandra nodes up and running"
+
+ while true; do
+ successCount=$(aws s3 ls $S3_CASSANDRA_SUCCESS_URL | wc -l)
+ failureCount=$(aws s3 ls $S3_CASSANDRA_FAILURE_URL | wc -l)
+
+ if [ $successCount -ge $CASSANDRA_NODES_COUNT ]; then
+ break
+ fi
+
+ if [ "$failureCount" != "0" ]; then
+ terminate "$failureCount Cassandra nodes are failed to start. Thus it doesn't make sense to run tests."
+ fi
+
+ echo "[INFO] Waiting extra 1min"
+
+ sleep 1m
+ done
+
+ echo "[INFO] Congratulation, all $CASSANDRA_NODES_COUNT Cassandra nodes are up and running"
+}
+
+waitFirstTestNodeRegistered()
+{
+ echo "[INFO] Waiting for the first test node to register"
+
+ while true; do
+ first_host=
+
+ exists=$(aws s3 ls $S3_TESTS_FIRST_NODE_LOCK_URL)
+ if [ -n "$exists" ]; then
+ rm -Rf /opt/ignite-cassandra-tests/first-node-lock
+
+ aws s3 cp $S3_TESTS_FIRST_NODE_LOCK_URL /opt/ignite-cassandra-tests/first-node-lock
+ if [ $? -ne 0 ]; then
+ terminate "Failed to check existing first node lock"
+ fi
+
+ first_host=$(cat /opt/ignite-cassandra-tests/first-node-lock)
+
+ rm -Rf /opt/ignite-cassandra-tests/first-node-lock
+ fi
+
+ if [ -n "$first_host" ]; then
+ exists=$(aws s3 ls ${S3_TEST_NODES_DISCOVERY_URL}${first_host})
+ if [ -n "$exists" ]; then
+ break
+ fi
+ fi
+
+ echo "[INFO] Waiting extra 1min"
+
+ sleep 1m
+ done
+
+ echo "[INFO] First test node registered"
+}
+
+waitAllTestNodesReady()
+{
+ createWaitingFlag
+
+ echo "[INFO] Waiting for all $TEST_NODES_COUNT test nodes up and running"
+
+ while true; do
+
+ nodesCount=$(aws s3 ls $S3_TEST_NODES_DISCOVERY_URL | wc -l)
+
+ if [ $nodesCount -ge $TEST_NODES_COUNT ]; then
+ break
+ fi
+
+ echo "[INFO] Waiting extra 1min"
+
+ sleep 1m
+ done
+
+ echo "[INFO] Congratulation, all $TEST_NODES_COUNT test nodes are up and running"
+
+ dropWaitingFlag
+ createRunningFlag
+}
+
+waitAllTestNodesCompleted()
+{
+ echo "[INFO] Waiting for all $TEST_NODES_COUNT test nodes to complete their tests"
+
+ while true; do
+ successCount=$(aws s3 ls $S3_TESTS_SUCCESS_URL | wc -l)
+ failureCount=$(aws s3 ls $S3_TESTS_FAILURE_URL | wc -l)
+ count=$(( $successCount+$failureCount ))
+
+ if [ $count -ge $TEST_NODES_COUNT ]; then
+ break
+ fi
+
+ echo "[INFO] Waiting extra 1min"
+
+ sleep 1m
+ done
+
+ echo "[INFO] Congratulation, all $TEST_NODES_COUNT test nodes have completed their tests"
+}
+
+# Time (in minutes) to wait for Ignite/Cassandra node up and running and register it in S3
+NODE_STARTUP_TIME=10
+
+HOST_NAME=$(hostname -f | tr '[:upper:]' '[:lower:]')
+echo $HOST_NAME > /opt/ignite-cassandra-tests/hostname
+
+validate
+
+FIRST_NODE="false"
+
+tryToGetFirstNodeLock
+
+if [ $? -eq 0 ]; then
+ FIRST_NODE="true"
+fi
+
+dropRunningFlag
+dropWaitingFlag
+
+echo "[INFO]-----------------------------------------------------------------"
+
+if [ "$FIRST_NODE" == "true" ]; then
+ echo "[INFO] Running tests from first node"
+ dropTestsSummary
+else
+ echo "[INFO] Running tests"
+fi
+
+echo "[INFO]-----------------------------------------------------------------"
+echo "[INFO] Tests type: $TESTS_TYPE"
+echo "[INFO] Test nodes count: $TEST_NODES_COUNT"
+echo "[INFO] Ignite nodes count: $IGNITE_NODES_COUNT"
+echo "[INFO] Cassandra nodes count: $CASSANDRA_NODES_COUNT"
+echo "[INFO] Tests summary URL: $S3_TESTS_SUMMARY_URL"
+echo "[INFO] Tests first node lock URL: $S3_TESTS_FIRST_NODE_LOCK_URL"
+echo "[INFO] Tests package download URL: $TESTS_PACKAGE_DONLOAD_URL"
+echo "[INFO] Test node discovery URL: $S3_TEST_NODES_DISCOVERY_URL"
+echo "[INFO] Ignite node discovery URL: $S3_IGNITE_NODES_DISCOVERY_URL"
+echo "[INFO] Cassandra node discovery URL: $S3_CASSANDRA_NODES_DISCOVERY_URL"
+echo "[INFO] Tests running URL: $S3_TESTS_RUNNING_URL"
+echo "[INFO] Tests waiting URL: $S3_TESTS_WAITING_URL"
+echo "[INFO] Tests success URL: $S3_TESTS_SUCCESS_URL"
+echo "[INFO] Tests failure URL: $S3_TESTS_FAILURE_URL"
+echo "[INFO] Ignite success URL: $S3_IGNITE_SUCCESS_URL"
+echo "[INFO] Ignite failure URL: $S3_IGNITE_FAILURE_URL"
+echo "[INFO] Cassandra success URL: $S3_CASSANDRA_SUCCESS_URL"
+echo "[INFO] Cassandra failure URL: $S3_CASSANDRA_FAILURE_URL"
+echo "[INFO] Logs trigger URL: $S3_LOGS_TRIGGER_URL"
+echo "[INFO] JAVA_HOME: $JAVA_HOME"
+echo "[INFO] PATH: $PATH"
+echo "[INFO]-----------------------------------------------------------------"
+
+echo "admin.user=cassandra" > /opt/ignite-cassandra-tests/settings/org/apache/ignite/tests/cassandra/credentials.properties
+echo "admin.password=cassandra" >> /opt/ignite-cassandra-tests/settings/org/apache/ignite/tests/cassandra/credentials.properties
+echo "regular.user=cassandra" >> /opt/ignite-cassandra-tests/settings/org/apache/ignite/tests/cassandra/credentials.properties
+echo "regular.password=cassandra" >> /opt/ignite-cassandra-tests/settings/org/apache/ignite/tests/cassandra/credentials.properties
+
+waitAllCassandraNodesReady
+waitAllIgniteNodesReady
+
+setupCassandraSeeds
+setupIgniteSeeds
+
+if [ "$FIRST_NODE" != "true" ]; then
+ waitFirstTestNodeRegistered
+else
+ cleanupMetadata
+fi
+
+registerTestNode
+
+waitAllTestNodesReady
+
+cd /opt/ignite-cassandra-tests
+
+if [ "$TESTS_TYPE" == "ignite" ]; then
+ echo "[INFO] Running Ignite load tests"
+ ./ignite-load-tests.sh
+ result=$?
+else
+ echo "[INFO] Running Cassandra load tests"
+ ./cassandra-load-tests.sh
+ result=$?
+fi
+
+if [ $result -ne 0 ]; then
+ terminate ""
+fi
+
+terminate
http://git-wip-us.apache.org/repos/asf/ignite/blob/b33eb027/modules/cassandra/src/test/java/org/apache/ignite/tests/CassandraDirectPersistenceLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/java/org/apache/ignite/tests/CassandraDirectPersistenceLoadTest.java b/modules/cassandra/src/test/java/org/apache/ignite/tests/CassandraDirectPersistenceLoadTest.java
new file mode 100644
index 0000000..c031bfb
--- /dev/null
+++ b/modules/cassandra/src/test/java/org/apache/ignite/tests/CassandraDirectPersistenceLoadTest.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.tests;
+
+import org.apache.ignite.tests.load.LoadTestDriver;
+import org.apache.ignite.tests.load.cassandra.BulkReadWorker;
+import org.apache.ignite.tests.load.cassandra.BulkWriteWorker;
+import org.apache.ignite.tests.load.cassandra.ReadWorker;
+import org.apache.ignite.tests.load.cassandra.WriteWorker;
+import org.apache.ignite.tests.utils.CacheStoreHelper;
+import org.apache.ignite.tests.utils.CassandraHelper;
+import org.apache.ignite.tests.utils.TestsHelper;
+import org.apache.log4j.Logger;
+
+/**
+ * Load tests for {@link org.apache.ignite.cache.store.cassandra.CassandraCacheStore} implementation of
+ * {@link org.apache.ignite.cache.store.CacheStore} which allows to store Ignite cache data into Cassandra tables.
+ */
+public class CassandraDirectPersistenceLoadTest extends LoadTestDriver {
+ /** */
+ private static final Logger LOGGER = Logger.getLogger("CassandraLoadTests");
+
+ /**
+ *
+ * @param args Test arguments.
+ */
+ public static void main(String[] args) {
+ try {
+ LOGGER.info("Cassandra load tests execution started");
+
+ LoadTestDriver driver = new CassandraDirectPersistenceLoadTest();
+
+ /**
+ * Load test scripts could be executed from several machines. Current implementation can correctly,
+ * handle situation when Cassandra keyspace/table was dropped - for example by the same load test
+ * started a bit later on another machine. Moreover there is a warm up period for each load test.
+ * Thus all the delays related to keyspaces/tables recreation actions will not affect performance metrics,
+ * but it will be produced lots of "trash" output in the logs (related to correct handling of such
+ * exceptional situation and keyspace/table recreation).
+ *
+ * Thus dropping test keyspaces at the beginning of the tests makes sense only for Unit tests,
+ * but not for Load tests.
+ **/
+
+ //CassandraHelper.dropTestKeyspaces();
+
+ driver.runTest("WRITE", WriteWorker.class, WriteWorker.LOGGER_NAME);
+
+ driver.runTest("BULK_WRITE", BulkWriteWorker.class, BulkWriteWorker.LOGGER_NAME);
+
+ driver.runTest("READ", ReadWorker.class, ReadWorker.LOGGER_NAME);
+
+ driver.runTest("BULK_READ", BulkReadWorker.class, BulkReadWorker.LOGGER_NAME);
+
+ /**
+ * Load test script executed on one machine could complete earlier that the same load test executed from
+ * another machine. Current implementation can correctly handle situation when Cassandra keyspace/table
+ * was dropped (simply recreate it). But dropping keyspace/table during load tests execution and subsequent
+ * recreation of such objects can have SIGNIFICANT EFFECT on final performance metrics.
+ *
+ * Thus dropping test keyspaces at the end of the tests makes sense only for Unit tests,
+ * but not for Load tests.
+ */
+
+ //CassandraHelper.dropTestKeyspaces(); // REVIEW This line is commented by purpose?
+
+ LOGGER.info("Cassandra load tests execution completed");
+ }
+ catch (Throwable e) {
+ LOGGER.error("Cassandra load tests execution failed", e);
+ throw new RuntimeException("Cassandra load tests execution failed", e);
+ }
+ finally {
+ CassandraHelper.releaseCassandraResources();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Logger logger() {
+ return LOGGER;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Object setup(String logName) {
+ return CacheStoreHelper.createCacheStore(
+ TestsHelper.getLoadTestsCacheName(),
+ TestsHelper.getLoadTestsPersistenceSettings(),
+ CassandraHelper.getAdminDataSrc(),
+ Logger.getLogger(logName));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b33eb027/modules/cassandra/src/test/java/org/apache/ignite/tests/CassandraDirectPersistenceTest.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/java/org/apache/ignite/tests/CassandraDirectPersistenceTest.java b/modules/cassandra/src/test/java/org/apache/ignite/tests/CassandraDirectPersistenceTest.java
new file mode 100644
index 0000000..26cca68
--- /dev/null
+++ b/modules/cassandra/src/test/java/org/apache/ignite/tests/CassandraDirectPersistenceTest.java
@@ -0,0 +1,371 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.tests;
+
+import java.util.Collection;
+import java.util.Map;
+import org.apache.ignite.cache.store.CacheStore;
+import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
+import org.apache.ignite.tests.pojos.Person;
+import org.apache.ignite.tests.pojos.PersonId;
+import org.apache.ignite.tests.utils.CacheStoreHelper;
+import org.apache.ignite.tests.utils.CassandraHelper;
+import org.apache.ignite.tests.utils.TestsHelper;
+import org.apache.log4j.Logger;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.springframework.core.io.ClassPathResource;
+
+/**
+ * Unit tests for {@link org.apache.ignite.cache.store.cassandra.CassandraCacheStore} implementation of
+ * {@link org.apache.ignite.cache.store.CacheStore} which allows to store Ignite cache data into Cassandra tables.
+ */
+public class CassandraDirectPersistenceTest {
+ /** */
+ private static final Logger LOGGER = Logger.getLogger(CassandraDirectPersistenceTest.class.getName());
+
+ /** */
+ @BeforeClass
+ public static void setUpClass() {
+ if (CassandraHelper.useEmbeddedCassandra()) {
+ try {
+ CassandraHelper.startEmbeddedCassandra(LOGGER);
+ }
+ catch (Throwable e) {
+ throw new RuntimeException("Failed to start embedded Cassandra instance", e);
+ }
+ }
+
+ LOGGER.info("Testing admin connection to Cassandra");
+ CassandraHelper.testAdminConnection();
+
+ LOGGER.info("Testing regular connection to Cassandra");
+ CassandraHelper.testRegularConnection();
+
+ LOGGER.info("Dropping all artifacts from previous tests execution session");
+ CassandraHelper.dropTestKeyspaces();
+
+ LOGGER.info("Start tests execution");
+ }
+
+ /** */
+ @AfterClass
+ public static void tearDownClass() {
+ try {
+ CassandraHelper.dropTestKeyspaces();
+ }
+ finally {
+ CassandraHelper.releaseCassandraResources();
+
+ if (CassandraHelper.useEmbeddedCassandra()) {
+ try {
+ CassandraHelper.stopEmbeddedCassandra();
+ }
+ catch (Throwable e) {
+ LOGGER.error("Failed to stop embedded Cassandra instance", e);
+ }
+ }
+ }
+ }
+
+ /** */
+ @Test
+ @SuppressWarnings("unchecked")
+ public void primitiveStrategyTest() {
+ CacheStore store1 = CacheStoreHelper.createCacheStore("longTypes",
+ new ClassPathResource("org/apache/ignite/tests/persistence/primitive/persistence-settings-1.xml"),
+ CassandraHelper.getAdminDataSrc());
+
+ CacheStore store2 = CacheStoreHelper.createCacheStore("stringTypes",
+ new ClassPathResource("org/apache/ignite/tests/persistence/primitive/persistence-settings-2.xml"),
+ CassandraHelper.getAdminDataSrc());
+
+ Collection<CacheEntryImpl<Long, Long>> longEntries = TestsHelper.generateLongsEntries();
+ Collection<CacheEntryImpl<String, String>> strEntries = TestsHelper.generateStringsEntries();
+
+ Collection<Long> fakeLongKeys = TestsHelper.getKeys(longEntries);
+ fakeLongKeys.add(-1L);
+ fakeLongKeys.add(-2L);
+ fakeLongKeys.add(-3L);
+ fakeLongKeys.add(-4L);
+
+ Collection<String> fakeStrKeys = TestsHelper.getKeys(strEntries);
+ fakeStrKeys.add("-1");
+ fakeStrKeys.add("-2");
+ fakeStrKeys.add("-3");
+ fakeStrKeys.add("-4");
+
+ LOGGER.info("Running PRIMITIVE strategy write tests");
+
+ LOGGER.info("Running single operation write tests");
+ store1.write(longEntries.iterator().next());
+ store2.write(strEntries.iterator().next());
+ LOGGER.info("Single operation write tests passed");
+
+ LOGGER.info("Running bulk operation write tests");
+ store1.writeAll(longEntries);
+ store2.writeAll(strEntries);
+ LOGGER.info("Bulk operation write tests passed");
+
+ LOGGER.info("PRIMITIVE strategy write tests passed");
+
+ LOGGER.info("Running PRIMITIVE strategy read tests");
+
+ LOGGER.info("Running single operation read tests");
+
+ LOGGER.info("Running real keys read tests");
+
+ Long longVal = (Long)store1.load(longEntries.iterator().next().getKey());
+ if (!longEntries.iterator().next().getValue().equals(longVal))
+ throw new RuntimeException("Long values was incorrectly deserialized from Cassandra");
+
+ String strVal = (String)store2.load(strEntries.iterator().next().getKey());
+ if (!strEntries.iterator().next().getValue().equals(strVal))
+ throw new RuntimeException("String values was incorrectly deserialized from Cassandra");
+
+ LOGGER.info("Running fake keys read tests");
+
+ longVal = (Long)store1.load(-1L);
+ if (longVal != null)
+ throw new RuntimeException("Long value with fake key '-1' was found in Cassandra");
+
+ strVal = (String)store2.load("-1");
+ if (strVal != null)
+ throw new RuntimeException("String value with fake key '-1' was found in Cassandra");
+
+ LOGGER.info("Single operation read tests passed");
+
+ LOGGER.info("Running bulk operation read tests");
+
+ LOGGER.info("Running real keys read tests");
+
+ Map longValues = store1.loadAll(TestsHelper.getKeys(longEntries));
+ if (!TestsHelper.checkCollectionsEqual(longValues, longEntries))
+ throw new RuntimeException("Long values was incorrectly deserialized from Cassandra");
+
+ Map strValues = store2.loadAll(TestsHelper.getKeys(strEntries));
+ if (!TestsHelper.checkCollectionsEqual(strValues, strEntries))
+ throw new RuntimeException("String values was incorrectly deserialized from Cassandra");
+
+ LOGGER.info("Running fake keys read tests");
+
+ longValues = store1.loadAll(fakeLongKeys);
+ if (!TestsHelper.checkCollectionsEqual(longValues, longEntries))
+ throw new RuntimeException("Long values was incorrectly deserialized from Cassandra");
+
+ strValues = store2.loadAll(fakeStrKeys);
+ if (!TestsHelper.checkCollectionsEqual(strValues, strEntries))
+ throw new RuntimeException("String values was incorrectly deserialized from Cassandra");
+
+ LOGGER.info("Bulk operation read tests passed");
+
+ LOGGER.info("PRIMITIVE strategy read tests passed");
+
+ LOGGER.info("Running PRIMITIVE strategy delete tests");
+
+ LOGGER.info("Deleting real keys");
+
+ store1.delete(longEntries.iterator().next().getKey());
+ store1.deleteAll(TestsHelper.getKeys(longEntries));
+
+ store2.delete(strEntries.iterator().next().getKey());
+ store2.deleteAll(TestsHelper.getKeys(strEntries));
+
+ LOGGER.info("Deleting fake keys");
+
+ store1.delete(-1L);
+ store2.delete("-1");
+
+ store1.deleteAll(fakeLongKeys);
+ store2.deleteAll(fakeStrKeys);
+
+ LOGGER.info("PRIMITIVE strategy delete tests passed");
+ }
+
+ /** */
+ @Test
+ @SuppressWarnings("unchecked")
+ public void blobStrategyTest() {
+ CacheStore store1 = CacheStoreHelper.createCacheStore("longTypes",
+ new ClassPathResource("org/apache/ignite/tests/persistence/blob/persistence-settings-1.xml"),
+ CassandraHelper.getAdminDataSrc());
+
+ CacheStore store2 = CacheStoreHelper.createCacheStore("personTypes",
+ new ClassPathResource("org/apache/ignite/tests/persistence/blob/persistence-settings-2.xml"),
+ CassandraHelper.getAdminDataSrc());
+
+ CacheStore store3 = CacheStoreHelper.createCacheStore("personTypes",
+ new ClassPathResource("org/apache/ignite/tests/persistence/blob/persistence-settings-3.xml"),
+ CassandraHelper.getAdminDataSrc());
+
+ Collection<CacheEntryImpl<Long, Long>> longEntries = TestsHelper.generateLongsEntries();
+ Collection<CacheEntryImpl<Long, Person>> personEntries = TestsHelper.generateLongsPersonsEntries();
+
+ LOGGER.info("Running BLOB strategy write tests");
+
+ LOGGER.info("Running single operation write tests");
+ store1.write(longEntries.iterator().next());
+ store2.write(personEntries.iterator().next());
+ store3.write(personEntries.iterator().next());
+ LOGGER.info("Single operation write tests passed");
+
+ LOGGER.info("Running bulk operation write tests");
+ store1.writeAll(longEntries);
+ store2.writeAll(personEntries);
+ store3.writeAll(personEntries);
+ LOGGER.info("Bulk operation write tests passed");
+
+ LOGGER.info("BLOB strategy write tests passed");
+
+ LOGGER.info("Running BLOB strategy read tests");
+
+ LOGGER.info("Running single operation read tests");
+
+ Long longVal = (Long)store1.load(longEntries.iterator().next().getKey());
+ if (!longEntries.iterator().next().getValue().equals(longVal))
+ throw new RuntimeException("Long values was incorrectly deserialized from Cassandra");
+
+ Person personVal = (Person)store2.load(personEntries.iterator().next().getKey());
+ if (!personEntries.iterator().next().getValue().equals(personVal))
+ throw new RuntimeException("Person values was incorrectly deserialized from Cassandra");
+
+ personVal = (Person)store3.load(personEntries.iterator().next().getKey());
+ if (!personEntries.iterator().next().getValue().equals(personVal))
+ throw new RuntimeException("Person values was incorrectly deserialized from Cassandra");
+
+ LOGGER.info("Single operation read tests passed");
+
+ LOGGER.info("Running bulk operation read tests");
+
+ Map longValues = store1.loadAll(TestsHelper.getKeys(longEntries));
+ if (!TestsHelper.checkCollectionsEqual(longValues, longEntries))
+ throw new RuntimeException("Long values was incorrectly deserialized from Cassandra");
+
+ Map personValues = store2.loadAll(TestsHelper.getKeys(personEntries));
+ if (!TestsHelper.checkPersonCollectionsEqual(personValues, personEntries, false))
+ throw new RuntimeException("Person values was incorrectly deserialized from Cassandra");
+
+ personValues = store3.loadAll(TestsHelper.getKeys(personEntries));
+ if (!TestsHelper.checkPersonCollectionsEqual(personValues, personEntries, false))
+ throw new RuntimeException("Person values was incorrectly deserialized from Cassandra");
+
+ LOGGER.info("Bulk operation read tests passed");
+
+ LOGGER.info("BLOB strategy read tests passed");
+
+ LOGGER.info("Running BLOB strategy delete tests");
+
+ store1.delete(longEntries.iterator().next().getKey());
+ store1.deleteAll(TestsHelper.getKeys(longEntries));
+
+ store2.delete(personEntries.iterator().next().getKey());
+ store2.deleteAll(TestsHelper.getKeys(personEntries));
+
+ store3.delete(personEntries.iterator().next().getKey());
+ store3.deleteAll(TestsHelper.getKeys(personEntries));
+
+ LOGGER.info("BLOB strategy delete tests passed");
+ }
+
+ /** */
+ @Test
+ @SuppressWarnings("unchecked")
+ public void pojoStrategyTest() {
+ CacheStore store1 = CacheStoreHelper.createCacheStore("longTypes",
+ new ClassPathResource("org/apache/ignite/tests/persistence/pojo/persistence-settings-1.xml"),
+ CassandraHelper.getAdminDataSrc());
+
+ CacheStore store2 = CacheStoreHelper.createCacheStore("personTypes",
+ new ClassPathResource("org/apache/ignite/tests/persistence/pojo/persistence-settings-2.xml"),
+ CassandraHelper.getAdminDataSrc());
+
+ CacheStore store3 = CacheStoreHelper.createCacheStore("personTypes",
+ new ClassPathResource("org/apache/ignite/tests/persistence/pojo/persistence-settings-3.xml"),
+ CassandraHelper.getAdminDataSrc());
+
+ Collection<CacheEntryImpl<Long, Person>> entries1 = TestsHelper.generateLongsPersonsEntries();
+ Collection<CacheEntryImpl<PersonId, Person>> entries2 = TestsHelper.generatePersonIdsPersonsEntries();
+ Collection<CacheEntryImpl<PersonId, Person>> entries3 = TestsHelper.generatePersonIdsPersonsEntries();
+
+ LOGGER.info("Running POJO strategy write tests");
+
+ LOGGER.info("Running single operation write tests");
+ store1.write(entries1.iterator().next());
+ store2.write(entries2.iterator().next());
+ store3.write(entries3.iterator().next());
+ LOGGER.info("Single operation write tests passed");
+
+ LOGGER.info("Running bulk operation write tests");
+ store1.writeAll(entries1);
+ store2.writeAll(entries2);
+ store3.writeAll(entries3);
+ LOGGER.info("Bulk operation write tests passed");
+
+ LOGGER.info("POJO strategy write tests passed");
+
+ LOGGER.info("Running POJO strategy read tests");
+
+ LOGGER.info("Running single operation read tests");
+
+ Person person = (Person)store1.load(entries1.iterator().next().getKey());
+ if (!entries1.iterator().next().getValue().equalsPrimitiveFields(person))
+ throw new RuntimeException("Person values was incorrectly deserialized from Cassandra");
+
+ person = (Person)store2.load(entries2.iterator().next().getKey());
+ if (!entries2.iterator().next().getValue().equalsPrimitiveFields(person))
+ throw new RuntimeException("Person values was incorrectly deserialized from Cassandra");
+
+ person = (Person)store3.load(entries3.iterator().next().getKey());
+ if (!entries3.iterator().next().getValue().equals(person))
+ throw new RuntimeException("Person values was incorrectly deserialized from Cassandra");
+
+ LOGGER.info("Single operation read tests passed");
+
+ LOGGER.info("Running bulk operation read tests");
+
+ Map persons = store1.loadAll(TestsHelper.getKeys(entries1));
+ if (!TestsHelper.checkPersonCollectionsEqual(persons, entries1, true))
+ throw new RuntimeException("Person values was incorrectly deserialized from Cassandra");
+
+ persons = store2.loadAll(TestsHelper.getKeys(entries2));
+ if (!TestsHelper.checkPersonCollectionsEqual(persons, entries2, true))
+ throw new RuntimeException("Person values was incorrectly deserialized from Cassandra");
+
+ persons = store3.loadAll(TestsHelper.getKeys(entries3));
+ if (!TestsHelper.checkPersonCollectionsEqual(persons, entries3, false))
+ throw new RuntimeException("Person values was incorrectly deserialized from Cassandra");
+
+ LOGGER.info("Bulk operation read tests passed");
+
+ LOGGER.info("POJO strategy read tests passed");
+
+ LOGGER.info("Running POJO strategy delete tests");
+
+ store1.delete(entries1.iterator().next().getKey());
+ store1.deleteAll(TestsHelper.getKeys(entries1));
+
+ store2.delete(entries2.iterator().next().getKey());
+ store2.deleteAll(TestsHelper.getKeys(entries2));
+
+ store3.delete(entries3.iterator().next().getKey());
+ store3.deleteAll(TestsHelper.getKeys(entries3));
+
+ LOGGER.info("POJO strategy delete tests passed");
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b33eb027/modules/cassandra/src/test/java/org/apache/ignite/tests/DDLGeneratorTest.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/java/org/apache/ignite/tests/DDLGeneratorTest.java b/modules/cassandra/src/test/java/org/apache/ignite/tests/DDLGeneratorTest.java
new file mode 100644
index 0000000..5de3097
--- /dev/null
+++ b/modules/cassandra/src/test/java/org/apache/ignite/tests/DDLGeneratorTest.java
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.tests;
+
+import java.net.URL;
+import org.apache.ignite.cache.store.cassandra.utils.DDLGenerator;
+import org.junit.Test;
+
+/**
+ * DDLGenerator test.
+ */
+public class DDLGeneratorTest {
+ @Test
+ @SuppressWarnings("unchecked")
+ /** */
+ public void generatorTest() {
+ ClassLoader clsLdr = DDLGeneratorTest.class.getClassLoader();
+
+ URL url1 = clsLdr.getResource("org/apache/ignite/tests/persistence/primitive/persistence-settings-1.xml");
+ String file1 = url1.getFile(); // TODO IGNITE-1371 Possible NPE
+
+ URL url2 = clsLdr.getResource("org/apache/ignite/tests/persistence/pojo/persistence-settings-3.xml");
+ String file2 = url2.getFile(); // TODO IGNITE-1371 Possible NPE
+
+ DDLGenerator.main(new String[]{file1, file2});
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b33eb027/modules/cassandra/src/test/java/org/apache/ignite/tests/IgnitePersistentStoreLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/java/org/apache/ignite/tests/IgnitePersistentStoreLoadTest.java b/modules/cassandra/src/test/java/org/apache/ignite/tests/IgnitePersistentStoreLoadTest.java
new file mode 100644
index 0000000..bfcf751
--- /dev/null
+++ b/modules/cassandra/src/test/java/org/apache/ignite/tests/IgnitePersistentStoreLoadTest.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.tests;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.Ignition;
+import org.apache.ignite.tests.load.LoadTestDriver;
+import org.apache.ignite.tests.load.ignite.BulkReadWorker;
+import org.apache.ignite.tests.load.ignite.BulkWriteWorker;
+import org.apache.ignite.tests.load.ignite.ReadWorker;
+import org.apache.ignite.tests.load.ignite.WriteWorker;
+import org.apache.ignite.tests.utils.CassandraHelper;
+import org.apache.ignite.tests.utils.TestsHelper;
+import org.apache.log4j.Logger;
+
+/**
+ * Load tests for Ignite caches which utilizing {@link org.apache.ignite.cache.store.cassandra.CassandraCacheStore}
+ * to store cache data into Cassandra tables
+ */
+public class IgnitePersistentStoreLoadTest extends LoadTestDriver {
+ /** */
+ private static final Logger LOGGER = Logger.getLogger("IgniteLoadTests");
+
+ /**
+ * test starter.
+ *
+ * @param args Test arguments.
+ */
+ public static void main(String[] args) {
+ try {
+ LOGGER.info("Ignite load tests execution started");
+
+ LoadTestDriver driver = new IgnitePersistentStoreLoadTest();
+
+ /**
+ * Load test scripts could be executed from several machines. Current implementation can correctly,
+ * handle situation when Cassandra keyspace/table was dropped - for example by the same load test
+ * started a bit later on another machine. Moreover there is a warm up period for each load test.
+ * Thus all the delays related to keyspaces/tables recreation actions will not affect performance metrics,
+ * but it will be produced lots of "trash" output in the logs (related to correct handling of such
+ * exceptional situation and keyspace/table recreation).
+ *
+ * Thus dropping test keyspaces makes sense only for Unit tests, but not for Load tests.
+ **/
+
+ //CassandraHelper.dropTestKeyspaces();
+
+ driver.runTest("WRITE", WriteWorker.class, WriteWorker.LOGGER_NAME);
+
+ driver.runTest("BULK_WRITE", BulkWriteWorker.class, BulkWriteWorker.LOGGER_NAME);
+
+ driver.runTest("READ", ReadWorker.class, ReadWorker.LOGGER_NAME);
+
+ driver.runTest("BULK_READ", BulkReadWorker.class, BulkReadWorker.LOGGER_NAME);
+
+ /**
+ * Load test script executed on one machine could complete earlier that the same load test executed from
+ * another machine. Current implementation can correctly handle situation when Cassandra keyspace/table
+ * was dropped (simply recreate it). But dropping keyspace/table during load tests execution and subsequent
+ * recreation of such objects can have SIGNIFICANT EFFECT on final performance metrics.
+ *
+ * Thus dropping test keyspaces at the end of the tests makes sense only for Unit tests,
+ * but not for Load tests.
+ */
+
+ //CassandraHelper.dropTestKeyspaces();
+
+ LOGGER.info("Ignite load tests execution completed");
+ }
+ catch (Throwable e) {
+ LOGGER.error("Ignite load tests execution failed", e);
+ throw new RuntimeException("Ignite load tests execution failed", e);
+ }
+ finally {
+ CassandraHelper.releaseCassandraResources();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Logger logger() {
+ return LOGGER;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected Object setup(String logName) {
+ return Ignition.start(TestsHelper.getLoadTestsIgniteConfig());
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void tearDown(Object obj) {
+ Ignite ignite = (Ignite)obj;
+
+ if (ignite != null)
+ ignite.close();
+ }
+}