ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [01/53] [abbrv] ignite git commit: IGNITE-3293 AWS bootstrap scripts patch for Ignite-Cassandra - Fixes #794.
Date Fri, 19 Aug 2016 11:48:18 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-3299 6743e50dd -> 3d8ffbe66


http://git-wip-us.apache.org/repos/asf/ignite/blob/ee8ac73f/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
deleted file mode 100644
index 74a769a..0000000
--- a/modules/cassandra/src/test/bootstrap/aws/tests/tests-run.sh
+++ /dev/null
@@ -1,715 +0,0 @@
-#!/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/ee8ac73f/modules/cassandra/src/test/java/org/apache/ignite/tests/LoadTestsCassandraArtifactsCreator.java
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/java/org/apache/ignite/tests/LoadTestsCassandraArtifactsCreator.java
b/modules/cassandra/src/test/java/org/apache/ignite/tests/LoadTestsCassandraArtifactsCreator.java
new file mode 100644
index 0000000..4fdb96f
--- /dev/null
+++ b/modules/cassandra/src/test/java/org/apache/ignite/tests/LoadTestsCassandraArtifactsCreator.java
@@ -0,0 +1,104 @@
+/*
+ * 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.cache.store.cassandra.persistence.KeyValuePersistenceSettings;
+import org.apache.ignite.tests.utils.CassandraHelper;
+import org.apache.ignite.tests.utils.TestsHelper;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Recreates all required Cassandra database objects (keyspace, table, indexes) for load
tests
+ */
+public class LoadTestsCassandraArtifactsCreator {
+    /**
+     * Recreates Cassandra artifacts required for load tests
+     * @param args not used
+     */
+    public static void main(String[] args) {
+        try {
+            System.out.println("[INFO] Recreating Cassandra artifacts (keyspace, table, indexes)
for load tests");
+
+            KeyValuePersistenceSettings perSettings =
+                    new KeyValuePersistenceSettings(TestsHelper.getLoadTestsPersistenceSettings());
+
+            System.out.println("[INFO] Dropping test keyspace: " + perSettings.getKeyspace());
+
+            try {
+                CassandraHelper.dropTestKeyspaces();
+            } catch (Throwable e) {
+                throw new RuntimeException("Failed to drop test keyspace: " + perSettings.getKeyspace(),
e);
+            }
+
+            System.out.println("[INFO] Test keyspace '" + perSettings.getKeyspace() + "'
was successfully dropped");
+
+            System.out.println("[INFO] Creating test keyspace: " + perSettings.getKeyspace());
+
+            try {
+                CassandraHelper.executeWithAdminCredentials(perSettings.getKeyspaceDDLStatement());
+            } catch (Throwable e) {
+                throw new RuntimeException("Failed to create test keyspace: " + perSettings.getKeyspace(),
e);
+            }
+
+            System.out.println("[INFO] Test keyspace '" + perSettings.getKeyspace() + "'
was successfully created");
+
+            System.out.println("[INFO] Creating test table: " + perSettings.getTable());
+
+            try {
+                CassandraHelper.executeWithAdminCredentials(perSettings.getTableDDLStatement());
+            } catch (Throwable e) {
+                throw new RuntimeException("Failed to create test table: " + perSettings.getTable(),
e);
+            }
+
+            System.out.println("[INFO] Test table '" + perSettings.getTable() + "' was successfully
created");
+
+            List<String> statements = perSettings.getIndexDDLStatements();
+            if (statements == null)
+                statements = new LinkedList<>();
+
+            for (String statement : statements) {
+                System.out.println("[INFO] Creating test table index:");
+                System.out.println(statement);
+
+                try {
+                    CassandraHelper.executeWithAdminCredentials(statement);
+                } catch (Throwable e) {
+                    throw new RuntimeException("Failed to create test table index", e);
+                }
+
+                System.out.println("[INFO] Test table index was successfully created");
+            }
+
+            System.out.println("[INFO] All required Cassandra artifacts were successfully
recreated");
+        }
+        catch (Throwable e) {
+            System.out.println("[ERROR] Failed to recreate Cassandra artifacts");
+            e.printStackTrace(System.out);
+
+            if (e instanceof RuntimeException)
+                throw (RuntimeException)e;
+            else
+                throw new RuntimeException(e);
+        }
+        finally {
+            CassandraHelper.releaseCassandraResources();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee8ac73f/modules/cassandra/src/test/resources/org/apache/ignite/tests/cassandra/connection-settings.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/resources/org/apache/ignite/tests/cassandra/connection-settings.xml
b/modules/cassandra/src/test/resources/org/apache/ignite/tests/cassandra/connection-settings.xml
index f7eb372..aec602e 100644
--- a/modules/cassandra/src/test/resources/org/apache/ignite/tests/cassandra/connection-settings.xml
+++ b/modules/cassandra/src/test/resources/org/apache/ignite/tests/cassandra/connection-settings.xml
@@ -26,7 +26,11 @@
     <bean id="cassandraAdminCredentials" class="org.apache.ignite.tests.utils.CassandraAdminCredentials"/>
     <bean id="cassandraRegularCredentials" class="org.apache.ignite.tests.utils.CassandraRegularCredentials"/>
 
-    <bean id="loadBalancingPolicy" class="com.datastax.driver.core.policies.RoundRobinPolicy"/>
+    <bean id="loadBalancingPolicy" class="com.datastax.driver.core.policies.TokenAwarePolicy">
+        <constructor-arg type="com.datastax.driver.core.policies.LoadBalancingPolicy">
+            <bean class="com.datastax.driver.core.policies.RoundRobinPolicy"/>
+        </constructor-arg>
+    </bean>
 
     <bean id="contactPoints" class="org.apache.ignite.tests.utils.CassandraHelper" factory-method="getContactPointsArray"/>
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee8ac73f/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/blob/ignite-config.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/blob/ignite-config.xml
b/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/blob/ignite-config.xml
index 9aa5c84..fbf38e9 100644
--- a/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/blob/ignite-config.xml
+++ b/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/blob/ignite-config.xml
@@ -40,12 +40,6 @@
     <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
         <property name="cacheConfiguration">
             <list>
-                <!-- Partitioned cache example configuration (Atomic mode). -->
-                <bean class="org.apache.ignite.configuration.CacheConfiguration">
-                    <property name="atomicityMode" value="ATOMIC"/>
-                    <property name="backups" value="1"/>
-                </bean>
-
                 <!-- Configuring persistence for "cache1" cache -->
                 <bean class="org.apache.ignite.configuration.CacheConfiguration">
                     <property name="name" value="cache1"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee8ac73f/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/pojo/ignite-config.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/pojo/ignite-config.xml
b/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/pojo/ignite-config.xml
index 8dcfffd..cc1e8a6 100644
--- a/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/pojo/ignite-config.xml
+++ b/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/pojo/ignite-config.xml
@@ -45,12 +45,6 @@
     <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
         <property name="cacheConfiguration">
             <list>
-                <!-- Partitioned cache example configuration (Atomic mode). -->
-                <bean class="org.apache.ignite.configuration.CacheConfiguration">
-                    <property name="atomicityMode" value="ATOMIC"/>
-                    <property name="backups" value="1"/>
-                </bean>
-
                 <!-- Configuring persistence for "cache1" cache -->
                 <bean class="org.apache.ignite.configuration.CacheConfiguration">
                     <property name="name" value="cache1"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee8ac73f/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-config.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-config.xml
b/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-config.xml
index fb6b055..13e0922 100644
--- a/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-config.xml
+++ b/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-config.xml
@@ -40,12 +40,6 @@
     <bean id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
         <property name="cacheConfiguration">
             <list>
-                <!-- Partitioned cache example configuration (Atomic mode). -->
-                <bean class="org.apache.ignite.configuration.CacheConfiguration">
-                    <property name="atomicityMode" value="ATOMIC"/>
-                    <property name="backups" value="1"/>
-                </bean>
-
                 <!-- Configuring persistence for "cache1" cache -->
                 <bean class="org.apache.ignite.configuration.CacheConfiguration">
                     <property name="name" value="cache1"/>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee8ac73f/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-client-config.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-client-config.xml
b/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-client-config.xml
index 50b2164..5b5bb59 100644
--- a/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-client-config.xml
+++ b/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-client-config.xml
@@ -24,7 +24,11 @@
         http://www.springframework.org/schema/util
         http://www.springframework.org/schema/util/spring-util.xsd">
 
-    <bean id="loadBalancingPolicy" class="com.datastax.driver.core.policies.RoundRobinPolicy"/>
+    <bean id="loadBalancingPolicy" class="com.datastax.driver.core.policies.TokenAwarePolicy">
+        <constructor-arg type="com.datastax.driver.core.policies.LoadBalancingPolicy">
+            <bean class="com.datastax.driver.core.policies.RoundRobinPolicy"/>
+        </constructor-arg>
+    </bean>
 
     <util:list id="contactPoints" value-type="java.lang.String">
         <value>cassandra-node-1.abc.com</value>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee8ac73f/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-server-config.xml
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-server-config.xml
b/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-server-config.xml
index 1dc6f8a..8d71aec 100644
--- a/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-server-config.xml
+++ b/modules/cassandra/src/test/resources/org/apache/ignite/tests/persistence/primitive/ignite-remote-server-config.xml
@@ -25,7 +25,11 @@
         http://www.springframework.org/schema/util/spring-util.xsd">
 
     <!-- Cassandra connection settings -->
-    <bean id="loadBalancingPolicy" class="com.datastax.driver.core.policies.RoundRobinPolicy"/>
+    <bean id="loadBalancingPolicy" class="com.datastax.driver.core.policies.TokenAwarePolicy">
+        <constructor-arg type="com.datastax.driver.core.policies.LoadBalancingPolicy">
+            <bean class="com.datastax.driver.core.policies.RoundRobinPolicy"/>
+        </constructor-arg>
+    </bean>
 
     <util:list id="contactPoints" value-type="java.lang.String">
         <value>cassandra-node-1.abc.com</value>

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee8ac73f/modules/cassandra/src/test/scripts/recreate-cassandra-artifacts.bat
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/scripts/recreate-cassandra-artifacts.bat b/modules/cassandra/src/test/scripts/recreate-cassandra-artifacts.bat
new file mode 100644
index 0000000..47b0a22
--- /dev/null
+++ b/modules/cassandra/src/test/scripts/recreate-cassandra-artifacts.bat
@@ -0,0 +1,39 @@
+echo off
+
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements.  See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License.  You may obtain a copy of the License at
+rem
+rem      http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+
+echo.
+
+set TESTS_CLASSPATH="%~dp0\lib*;%~dp0settings"
+
+call %~dp0jvm-opts.bat %*
+
+call java %JVM_OPTS% -cp "%TESTS_CLASSPATH%" "org.apache.ignite.tests.LoadTestsCassandraArtifactsCreator"
+
+if %errorLevel% NEQ 0 (
+    echo.
+    echo --------------------------------------------------------------------------------
+    echo [ERROR] Failed to recreate Cassandra artifacts
+    echo --------------------------------------------------------------------------------
+    echo.
+    exit /b %errorLevel%
+)
+
+echo.
+echo --------------------------------------------------------------------------------
+echo [INFO] Cassandra artifacts were successfully recreated
+echo --------------------------------------------------------------------------------
+echo.

http://git-wip-us.apache.org/repos/asf/ignite/blob/ee8ac73f/modules/cassandra/src/test/scripts/recreate-cassandra-artifacts.sh
----------------------------------------------------------------------
diff --git a/modules/cassandra/src/test/scripts/recreate-cassandra-artifacts.sh b/modules/cassandra/src/test/scripts/recreate-cassandra-artifacts.sh
new file mode 100644
index 0000000..b0f99be
--- /dev/null
+++ b/modules/cassandra/src/test/scripts/recreate-cassandra-artifacts.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# 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.
+#
+
+TESTS_ROOT=$(readlink -m $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))
+TESTS_CLASSPATH="$TESTS_ROOT/lib/*:$TESTS_ROOT/settings"
+
+. $TESTS_ROOT/jvm-opt.sh $@
+
+java $JVM_OPTS -cp "$TESTS_CLASSPATH" "org.apache.ignite.tests.LoadTestsCassandraArtifactsCreator"
+
+if [ $? -ne 0 ]; then
+    echo
+    echo "--------------------------------------------------------------------------------"
+    echo "[ERROR] Failed to recreate Cassandra artifacts"
+    echo "--------------------------------------------------------------------------------"
+    echo
+    exit 1
+fi
+
+echo
+echo "--------------------------------------------------------------------------------"
+echo "[INFO] Cassandra artifacts were successfully recreated"
+echo "--------------------------------------------------------------------------------"
+echo


Mime
View raw message