forked from apache/samza
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SAMZA-468; create an integration test suite for samza.
- Loading branch information
Navina Ramesh
authored and
Chris Riccomini
committed
Jan 14, 2015
1 parent
0ebfcbd
commit 6bbbaa5
Showing
27 changed files
with
949 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,4 @@ docs/learn/documentation/*/api/javadocs | |
.DS_Store | ||
out/ | ||
*.patch | ||
**.pyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/bin/bash -e | ||
# 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. | ||
|
||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
BASE_DIR=$DIR/.. | ||
TEST_DIR=$1 | ||
|
||
if test -z "$TEST_DIR"; then | ||
echo | ||
echo " USAGE:" | ||
echo | ||
echo " ${BASH_SOURCE[0]##*/} \"<dirname to run tests in>\" [zopkio args...]" | ||
echo | ||
exit 0 | ||
fi | ||
|
||
# always use absolute paths for ABS_TEST_DIR | ||
ABS_TEST_DIR=$(cd $(dirname $TEST_DIR); pwd)/$(basename $TEST_DIR) | ||
SCRIPTS_DIR=$ABS_TEST_DIR/scripts | ||
|
||
# safety check for virtualenv | ||
if [ -f $HOME/.pydistutils.cfg ]; then | ||
echo "Virtualenv can't run while $HOME/.pydistutils.cfg exists." | ||
echo "Please remove $HOME/.pydistutils.cfg, and try again." | ||
exit 0 | ||
fi | ||
|
||
# build integration test tarball | ||
./gradlew releaseTestJobs | ||
|
||
# create integration test directory | ||
mkdir -p $ABS_TEST_DIR | ||
rm -rf $SCRIPTS_DIR | ||
cp -r samza-test/src/main/python/ $SCRIPTS_DIR | ||
cp ./samza-test/build/distributions/samza-test*.tgz $ABS_TEST_DIR | ||
cd $ABS_TEST_DIR | ||
|
||
# setup virtualenv locally if it's not already there | ||
VIRTUAL_ENV=virtualenv-12.0.2 | ||
if [[ ! -d "${ABS_TEST_DIR}/${VIRTUAL_ENV}" ]] ; then | ||
curl -O https://pypi.python.org/packages/source/v/virtualenv/$VIRTUAL_ENV.tar.gz | ||
tar xvfz $VIRTUAL_ENV.tar.gz | ||
fi | ||
|
||
# build a clean virtual environment | ||
SAMZA_INTEGRATION_TESTS_DIR=$ABS_TEST_DIR/samza-integration-tests | ||
if [[ ! -d "${SAMZA_INTEGRATION_TESTS_DIR}" ]] ; then | ||
python $VIRTUAL_ENV/virtualenv.py $SAMZA_INTEGRATION_TESTS_DIR | ||
fi | ||
|
||
# activate the virtual environment | ||
source $SAMZA_INTEGRATION_TESTS_DIR/bin/activate | ||
|
||
# install zopkio and requests | ||
pip install -r $SCRIPTS_DIR/requirements.txt | ||
|
||
# treat all trailing parameters (after dirname) as zopkio switches | ||
shift | ||
SWITCHES="$*" | ||
|
||
# default to info-level debugging if not specified | ||
if [[ $SWITCHES != *"console-log-level"* ]]; then | ||
SWITCHES="$SWITCHES --console-log-level INFO" | ||
fi | ||
|
||
# run the tests | ||
zopkio --config-overrides remote_install_path=$ABS_TEST_DIR $SWITCHES $SCRIPTS_DIR/tests.py | ||
|
||
# go back to execution directory | ||
deactivate | ||
cd $DIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# 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. | ||
|
||
# Job | ||
job.factory.class=org.apache.samza.job.yarn.YarnJobFactory | ||
job.name=samza-negate-number | ||
|
||
# YARN | ||
yarn.container.count=1 | ||
yarn.container.memory.mb=1024 | ||
|
||
# Task | ||
task.class=org.apache.samza.test.integration.NegateNumberTask | ||
task.inputs=kafka.samza-test-topic | ||
task.checkpoint.factory=org.apache.samza.checkpoint.kafka.KafkaCheckpointManagerFactory | ||
task.checkpoint.replication.factor=1 | ||
task.checkpoint.system=kafka | ||
task.lifecycle.listener.generator.class=com.linkedin.samza.task.GeneratorLifecycleListenerFactory | ||
task.lifecycle.listener.generator.fabric=CORP-EAT1 | ||
task.opts=-Xmx6g | ||
task.command.class=org.apache.samza.job.ShellCommandBuilder | ||
|
||
# Serializers | ||
serializers.registry.string.class=org.apache.samza.serializers.StringSerdeFactory | ||
|
||
# Kafka System | ||
systems.kafka.samza.factory=org.apache.samza.system.kafka.KafkaSystemFactory | ||
systems.kafka.samza.msg.serde=string | ||
systems.kafka.samza.key.serde=string | ||
systems.kafka.samza.offset.default=oldest | ||
systems.kafka.consumer.zookeeper.connect=localhost:2181/ | ||
systems.kafka.producer.compression.codec=gzip | ||
systems.kafka.producer.metadata.broker.list=localhost:9092 | ||
systems.kafka.producer.request.required.acks=1 | ||
systems.kafka.producer.topic.metadata.refresh.interval.ms=86400000 | ||
systems.kafka.producer.producer.type=sync | ||
# Normally, we'd set this much higher, but we want things to look snappy in the demo. | ||
systems.kafka.producer.batch.num.messages=1 | ||
|
||
# negate-number | ||
streams.samza-test-topic.consumer.reset.offset=true |
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions
40
samza-test/src/main/java/org/apache/samza/test/integration/NegateNumberTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* 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.samza.test.integration; | ||
|
||
import org.apache.samza.system.IncomingMessageEnvelope; | ||
import org.apache.samza.system.OutgoingMessageEnvelope; | ||
import org.apache.samza.system.SystemStream; | ||
import org.apache.samza.task.MessageCollector; | ||
import org.apache.samza.task.StreamTask; | ||
import org.apache.samza.task.TaskCoordinator; | ||
|
||
/* | ||
* A simple test job that reads strings, converts them to integers, multiplies | ||
* by -1, and outputs to "samza-test-topic-output" stream. | ||
*/ | ||
public class NegateNumberTask implements StreamTask { | ||
public void process(IncomingMessageEnvelope envelope, MessageCollector collector, TaskCoordinator coordinator) { | ||
String input = (String) envelope.getMessage(); | ||
Integer number = Integer.valueOf(input); | ||
Integer output = number.intValue() * -1; | ||
collector.send(new OutgoingMessageEnvelope(new SystemStream("kafka", "samza-test-topic-output"), output.toString())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"url_kafka": "http://www.us.apache.org/dist/kafka/0.8.1.1/kafka_2.9.2-0.8.1.1.tgz", | ||
"url_zookeeper": "http://archive.apache.org/dist/zookeeper/zookeeper-3.4.3/zookeeper-3.4.3.tar.gz", | ||
"url_hadoop": "https://archive.apache.org/dist/hadoop/common/hadoop-2.4.0/hadoop-2.4.0.tar.gz" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"kafka_hosts": { | ||
"kafka_instance_0": "localhost" | ||
}, | ||
"kafka_port": 9092, | ||
"kafka_start_cmd": "kafka_2.9.2-0.8.1.1/bin/kafka-server-start.sh -daemon kafka_2.9.2-0.8.1.1/config/server.properties", | ||
"kafka_stop_cmd": "kafka_2.9.2-0.8.1.1/bin/kafka-server-stop.sh", | ||
"kafka_install_path": "deploy/kafka", | ||
"kafka_executable": "kafka_2.9.2-0.8.1.1.tgz", | ||
"kafka_post_install_cmds": [ | ||
"sed -i.bak 's/SIGINT/SIGTERM/g' kafka_2.9.2-0.8.1.1/bin/kafka-server-stop.sh", | ||
"sed -i.bak 's/^num\\.partitions *=.*/num.partitions=1/' kafka_2.9.2-0.8.1.1/config/server.properties", | ||
"sed -i.bak 's/.*log.dirs.*/log.dirs=data/g' kafka_2.9.2-0.8.1.1/config/server.properties" | ||
], | ||
"kafka_logs": [ | ||
"log-cleaner.log", | ||
"kafka_2.9.2-0.8.1.1/logs/controller.log", | ||
"kafka_2.9.2-0.8.1.1/logs/kafka-request.log", | ||
"kafka_2.9.2-0.8.1.1/logs/kafkaServer-gc.log", | ||
"kafka_2.9.2-0.8.1.1/logs/server.log", | ||
"kafka_2.9.2-0.8.1.1/logs/state-change.log" | ||
] | ||
} |
6 changes: 6 additions & 0 deletions
6
samza-test/src/main/python/configs/smoke-tests/smoke-tests.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"samza_executable": "samza-test_2.10-0.9.0-SNAPSHOT.tgz", | ||
"samza_install_path": "deploy/smoke_tests", | ||
"samza_config_factory": "org.apache.samza.config.factories.PropertiesConfigFactory", | ||
"samza_config_file": "config/negate-number.properties" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"yarn_site_template": "scripts/templates/yarn-site.xml", | ||
"yarn_rm_hosts": { | ||
"yarn_rm_instance_0": "localhost" | ||
}, | ||
"yarn_rm_start_cmd": "hadoop-2.4.0/sbin/yarn-daemon.sh start resourcemanager", | ||
"yarn_rm_stop_cmd": "hadoop-2.4.0/sbin/yarn-daemon.sh stop resourcemanager", | ||
"yarn_rm_install_path": "deploy/yarn_rm", | ||
"yarn_rm_post_install_cmds": [ | ||
"sed -i.bak '/<configuration>/a <property><name>yarn.nodemanager.vmem-pmem-ratio</name><value>10</value></property>' hadoop-2.4.0/etc/hadoop/yarn-site.xml", | ||
"mkdir -p hadoop-2.4.0/conf", | ||
"chmod 755 hadoop-2.4.0/conf", | ||
"cp hadoop-2.4.0/etc/hadoop/yarn-site.xml hadoop-2.4.0/conf/yarn-site.xml" | ||
], | ||
"yarn_rm_executable": "hadoop-2.4.0.tar.gz", | ||
"yarn_rm_logs": [ | ||
"hadoop-2.4.0/logs" | ||
], | ||
"yarn_nm_hosts": { | ||
"yarn_nm_instance_0": "localhost" | ||
}, | ||
"yarn_nm_start_cmd": "hadoop-2.4.0/sbin/yarn-daemon.sh start nodemanager", | ||
"yarn_nm_stop_cmd": "hadoop-2.4.0/sbin/yarn-daemon.sh stop nodemanager", | ||
"yarn_nm_install_path": "deploy/yarn_nm", | ||
"yarn_nm_post_install_cmds": [ | ||
"sed -i.bak '/<configuration>/a <property><name>yarn.nodemanager.vmem-pmem-ratio</name><value>10</value></property>' hadoop-2.4.0/etc/hadoop/yarn-site.xml", | ||
"mkdir -p hadoop-2.4.0/conf", | ||
"chmod 755 hadoop-2.4.0/conf", | ||
"cp hadoop-2.4.0/etc/hadoop/yarn-site.xml hadoop-2.4.0/conf/yarn-site.xml" | ||
], | ||
"yarn_nm_executable": "hadoop-2.4.0.tar.gz", | ||
"yarn_nm_logs": [ | ||
"hadoop-2.4.0/logs" | ||
], | ||
"yarn_driver_configs": { | ||
"yarn.resourcemanager.hostname": "localhost" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"zookeeper_hosts": { | ||
"zookeeper_instance_0": "localhost" | ||
}, | ||
"zookeeper_start_cmd": "zookeeper-3.4.3/bin/zkServer.sh start", | ||
"zookeeper_stop_cmd": "zookeeper-3.4.3/bin/zkServer.sh stop", | ||
"zookeeper_install_path": "deploy/zookeeper", | ||
"zookeeper_executable": "zookeeper-3.4.3.tar.gz", | ||
"zookeeper_post_install_cmds": [ | ||
"cp zookeeper-3.4.3/conf/zoo_sample.cfg zookeeper-3.4.3/conf/zoo.cfg", | ||
"sed -i.bak 's/.*dataDir=.*/dataDir=data/g' zookeeper-3.4.3/conf/zoo.cfg" | ||
], | ||
"zookeeper_logs": [ | ||
"zookeeper.out" | ||
] | ||
} |
Oops, something went wrong.