|
| 1 | +@rest |
| 2 | +Feature: [Stability test] Executor Dropdowns |
| 3 | + |
| 4 | + Background: |
| 5 | + |
| 6 | + Given I open a ssh connection to '${DCOS_CLI_HOST}' with user 'root' and password 'stratio' |
| 7 | + #Check dispatcher and spark-coverage are deployed |
| 8 | + Then in less than '20' seconds, checking each '10' seconds, the command output 'dcos task | grep "${SPARK_FW_NAME}\." | grep R | wc -l' contains '1' |
| 9 | + Then in less than '20' seconds, checking each '10' seconds, the command output 'dcos task | grep spark-coverage | grep R | wc -l' contains '1' |
| 10 | + |
| 11 | + #Obtain mesos master |
| 12 | + Given I open a ssh connection to '${DCOS_IP}' with user 'root' and password 'stratio' |
| 13 | + Given I run 'getent hosts leader.mesos | awk '{print $1}'' in the ssh connection and save the value in environment variable 'MESOS_MASTER' |
| 14 | + |
| 15 | + #Clean all drivers from spark-dispatcher |
| 16 | + Then I clean all the drivers in the dispatcher with name '${SPARK_FW_NAME}' in dcos host '${CLUSTER_ID}.labs.stratio.com' with mesos master '!{MESOS_MASTER}:5050' with user 'admin' and password '1234' |
| 17 | + |
| 18 | + Scenario:[Kafka Executor Dropdowns][01] Launch Kafka job, and kill executor to check if another is launched |
| 19 | + |
| 20 | + #Now launch the work |
| 21 | + Given I set sso token using host '${CLUSTER_ID}.labs.stratio.com' with user 'admin' and password '1234' |
| 22 | + And I securely send requests to '${CLUSTER_ID}.labs.stratio.com:443' |
| 23 | + |
| 24 | + When I send a 'POST' request to '/service/${SPARK_FW_NAME}/v1/submissions/create' based on 'schemas/pf/SparkCoverage/kafka_curl.json' as 'json' with: |
| 25 | + | $.appResource | UPDATE | http://spark-coverage.marathon.mesos:9000/jobs/kafka-${COVERAGE_VERSION}.jar | n/a | |
| 26 | + | $.sparkProperties['spark.jars'] | UPDATE | http://spark-coverage.marathon.mesos:9000/jobs/kafka-${COVERAGE_VERSION}.jar | n/a | |
| 27 | + | $.sparkProperties['spark.mesos.executor.docker.image'] | UPDATE | ${SPARK_DOCKER_IMAGE}:${STRATIO_SPARK_VERSION} | n/a | |
| 28 | + | $.appArgs[0] | UPDATE | gosec1.node.paas.labs.stratio.com:9092 | n/a | |
| 29 | + |
| 30 | + Then the service response status must be '200' and its response must contain the text '"success" : true' |
| 31 | + |
| 32 | + #Save the driver launched id |
| 33 | + Then I save the value from field in service response 'submissionId' in variable 'driverKafka' |
| 34 | + |
| 35 | + #Wait until the executor is running |
| 36 | + Then in less than '200' seconds, checking each '10' seconds, the command output 'curl -s !{MESOS_MASTER}:5050/frameworks | jq '.frameworks[] | select((.name | contains("AT-kafka")) and (.id | contains("!{driverKafka}"))) | .tasks | .[] | .state' | grep "TASK_RUNNING" ' contains 'RUNNING' |
| 37 | + |
| 38 | + #Get the host where the Executor is deployed |
| 39 | + Then I run 'curl -s !{MESOS_MASTER}:5050/frameworks | jq '.frameworks[] | select((.name | contains("AT-kafka")) and (.id | contains("!{driverKafka}"))) | .tasks | .[] |.slave_id' | tr -d '"'' in the ssh connection and save the value in environment variable 'SLAVE_ID' |
| 40 | + Then I run 'curl -s !{MESOS_MASTER}:5050/slaves | jq '.slaves[] | select(.id=="!{SLAVE_ID}") | .hostname' | tr -d '"'' in the ssh connection and save the value in environment variable 'EXECUTOR_IP' |
| 41 | + |
| 42 | + #Ssh into the host, get Spark docker executor and kill them |
| 43 | + Then I run 'echo !{EXECUTOR_IP}' in the ssh connection |
| 44 | + Then I open a ssh connection to '!{EXECUTOR_IP}' with user 'root' and password 'stratio' |
| 45 | + |
| 46 | + #Wait first for having a running docker |
| 47 | + Then I run 'docker ps | grep ${SPARK_DOCKER_IMAGE}:${STRATIO_SPARK_VERSION} | cut -d ' ' -f 1 | while read x; do cmd=$(docker inspect $x | jq '.[]|.Args'); echo $x $cmd; done | grep org.apache.spark.executor.CoarseGrainedExecutorBackend | cut -d ' ' -f 1' in the ssh connection and save the value in environment variable 'DOCKER_ID' |
| 48 | + Then I run 'docker rm -f !{DOCKER_ID}' in the ssh connection |
| 49 | + |
| 50 | + #Check there are a TASK_FAILED (killed by us) |
| 51 | + Then in less than '200' seconds, checking each '10' seconds, the command output 'curl -s !{MESOS_MASTER}:5050/frameworks | jq '.frameworks[] | select((.name | contains("AT-kafka")) and (.id | contains("!{driverKafka}"))) | .completed_tasks | .[] | .state' | grep FAILED | wc -l' contains '1' |
| 52 | + |
| 53 | + #Check a new Task has launched |
| 54 | + Then in less than '200' seconds, checking each '10' seconds, the command output 'curl -s !{MESOS_MASTER}:5050/frameworks | jq '.frameworks[] | select((.name | contains("AT-kafka")) and (.id | contains("!{driverKafka}"))) | .tasks | .[] | .state'' contains 'TASK_RUNNING' |
| 55 | + |
| 56 | + #Check we are processing windows, getting an initial value, and seeing if it's being incremented after few seconds |
| 57 | + Given I open a ssh connection to '${DCOS_CLI_HOST}' with user 'root' and password 'stratio' |
| 58 | + Then I run 'dcos task log !{driverKafka} stdout --lines=1000000 | grep "###" | wc -l' in the ssh connection and save the value in environment variable 'PREVIOUS_WINDOW' |
| 59 | + Then in less than '100' seconds, checking each '10' seconds, the command output 'if [ $(dcos task log !{driverKafka} stdout --lines=1000000 | grep "###" | wc -l) -gt "!{PREVIOUS_WINDOW}" ]; then echo "true"; fi' contains 'true' |
| 60 | + |
| 61 | + #Now kill the process |
| 62 | + #(We send a JSON because the step from cucumber, doesn't support empty posts submissions) |
| 63 | + Then I set sso token using host '${CLUSTER_ID}.labs.stratio.com' with user 'admin' and password '1234' |
| 64 | + Then I securely send requests to '${CLUSTER_ID}.labs.stratio.com:443' |
| 65 | + Then I send a 'POST' request to '/service/${SPARK_FW_NAME}/v1/submissions/kill/!{driverKafka}' based on 'schemas/pf/SparkCoverage/kafka_curl.json' as 'json' with: |
| 66 | + | $.appResource | UPDATE | http://spark-coverage.marathon.mesos:9000/jobs/kafka-${COVERAGE_VERSION}.jar | n/a | |
| 67 | + |
| 68 | + Then the service response status must be '200' and its response must contain the text '"success" : true' |
| 69 | + |
| 70 | + #Check exit is clean |
| 71 | + Then in less than '200' seconds, checking each '10' seconds, the command output 'curl -s !{MESOS_MASTER}:5050/frameworks | jq '.frameworks[] | select(.name == "${SPARK_FW_NAME}") | .completed_tasks | map(select(.name | contains ("AT-kafka"))) | map(select(.id == "!{driverKafka}")) | .[] | .state' | grep "TASK_KILLED" | wc -l' contains '1' |
| 72 | + |
| 73 | + Then in less than '10' seconds, checking each '5' seconds, the command output 'curl -s !{MESOS_MASTER}:5050/frameworks | jq '.frameworks[] | select(.name == "${SPARK_FW_NAME}") | .completed_tasks | map(select(.name | contains ("AT-kafka"))) | map(select(.id == "!{driverKafka}")) | .[] | .statuses' | grep "TASK_RUNNING" | wc -l' contains '1' |
| 74 | + Then in less than '10' seconds, checking each '5' seconds, the command output 'curl -s !{MESOS_MASTER}:5050/frameworks | jq '.frameworks[] | select(.name == "${SPARK_FW_NAME}") | .completed_tasks | map(select(.name | contains ("AT-kafka"))) | map(select(.id == "!{driverKafka}")) | .[] | .statuses' | grep "TASK_FAILED" | wc -l' contains '0' |
| 75 | + Then in less than '10' seconds, checking each '5' seconds, the command output 'curl -s !{MESOS_MASTER}:5050/frameworks | jq '.frameworks[] | select(.name == "${SPARK_FW_NAME}") | .completed_tasks | map(select(.name | contains ("AT-kafka"))) | map(select(.id == "!{driverKafka}")) | .[] | .statuses' | grep "TASK_KILLED" | wc -l' contains '1' |
| 76 | + |
| 77 | + |
| 78 | + |
0 commit comments