-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5afff33
commit e62a56c
Showing
17 changed files
with
364 additions
and
275 deletions.
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
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,95 @@ | ||
#! /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. | ||
#-------------------------------------------------------------------- | ||
|
||
# Helper script that does the actual work of launching the cluster. | ||
# A script in each module sets the module-specific context, the | ||
# TEST_DIR. | ||
|
||
#set -x | ||
|
||
if [ -z "$TEST_DIR" ]; then | ||
echo "This is an internal script. Run cluster.sh in each module." | ||
exit 1 | ||
fi | ||
|
||
# 'up' command by default, else whatever is the argument | ||
CMD='up' | ||
if [ $# -ge 1 ]; then | ||
CMD=$1 | ||
fi | ||
|
||
# All commands need env vars. | ||
|
||
ENV_FILE=$TEST_DIR/../it-image/target/env.sh | ||
if [ ! -f $ENV_FILE ]; then | ||
echo "Please build the Docker test image before testing" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
source $ENV_FILE | ||
|
||
export SHARED_DIR=$TEST_DIR/target/shared | ||
|
||
# Permissions in some build setups are screwed up. See above. The user | ||
# which runs Docker does not have permission to write into the /shared | ||
# directory. Force ownership to allow writing. | ||
chmod -R a+rwx ${IT_MODULE}/target/shared | ||
|
||
# Dummies just to get the compose files to shut up | ||
# TODO: Remove after conversion | ||
export OVERRIDE_ENV= | ||
export DRUID_INTEGRATION_TEST_GROUP=dummy | ||
|
||
# Print environment for debugging | ||
#env | ||
|
||
# Dump lots of information to debug Docker failures when run inside | ||
# of a build environment where we can't inspect Docker directly. | ||
function show_status { | ||
echo "====================================" | ||
ls -l target/shared | ||
echo "docker ps -a" | ||
docker ps -a | ||
# Was: --filter status=exited | ||
for id in $(docker ps -a --format "{{.ID}}"); do | ||
echo "====================================" | ||
echo "Logs for Container ID $id" | ||
docker logs $id | tail -n 20 | ||
done | ||
echo "====================================" | ||
} | ||
|
||
cd $TEST_DIR/druid-cluster | ||
if [ "$CMD" == 'up' ]; then | ||
# Must start with an empty DB to keep MySQL happy | ||
rm -rf $SHARED_DIR/db | ||
mkdir -p $SHARED_DIR/logs | ||
mkdir -p $SHARED_DIR/tasklogs | ||
mkdir -p $SHARED_DIR/db | ||
mkdir -p $SHARED_DIR/kafka | ||
mkdir -p $SHARED_DIR/resources | ||
cp $TEST_DIR/../assets/log4j2.xml $SHARED_DIR/resources | ||
chmod -R a+rwx $SHARED_DIR | ||
docker-compose up -d | ||
#show_status | ||
elif [ "$CMD" == 'status' ]; then | ||
show_status | ||
else | ||
#show_status | ||
docker-compose $CMD | ||
fi |
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
Oops, something went wrong.