Skip to content

Instantly share code, notes, and snippets.

@myouju
Last active October 7, 2016 06:42
Show Gist options
  • Save myouju/9131e12a03ed8e32ae25 to your computer and use it in GitHub Desktop.
Save myouju/9131e12a03ed8e32ae25 to your computer and use it in GitHub Desktop.
drone.ioでhiveをunit testする
image: localhost/maeno/hadoop
script:
# execute unittest
- export PATH=$HADOOP_PREFIX/bin:$HIVE_HOME/bin:$PATH
- UNIT_TEST_LIST=`find ./test -name "setup.hql"|xargs -Idir dirname dir|sort -u`
- for u in `echo $UNIT_TEST_LIST`;do sh /tmp/run-unittest.sh ${u}; done
- if [ ${DRONE_BRANCH} != "master" ]; then exit 0; fi
- mkdir -p ~/.aws/
- echo -e "[profile release]\nregion = ap-northeast-1\naws_access_key_id = $$AWS_KEY\naws_secret_access_key = $$AWS_SECRET" | tee ~/.aws/config
- aws --profile release s3 cp src/ s3://<s3 bucket>/hiveql/ --recursive --exclude "*" --include "*.q"
notify:
webhook:
on_success: true
on_failure: true
urls:
- http://<bot host>/send?room=<room>
FROM labianchin/hadoop
MAINTAINER yuki-maeno
# yum package install
RUN yum -y install wget git
RUN wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
RUN yum -y install apache-maven
# unit test tool install
RUN git clone https://github.com/kawaa/Beetest.git /tmp/Beetest
WORKDIR /tmp/Beetest
RUN mvn -P full package
ADD run-unittest.sh /tmp/run-unittest.sh
# install aws-cli for deploy
RUN yum -y install python-setuptools
RUN easy_install pip
RUN pip install awscli
ENV HOME /root
RUN rm -fr /root/.ssh
CMD /bin/bash -c 'echo "export PATH=$HADOOP_PREFIX/bin:$HIVE_HOME/bin:$PATH" >> ~/.bashrc' && /bin/bash
#!/bin/bash
TEST_CASE=$1
CONFIG=/tmp/Beetest/src/examples/local-config
JAR_FILE=/tmp/Beetest/target/Beetest*-jar-with-dependencies.jar
export HADOOP_CONF_DIR=$(dirname ${CONFIG})
hadoop jar ${JAR_FILE} com.spotify.beetest.TestQueryExecutor ${TEST_CASE} ${CONFIG}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment