Skip to content

Commit

Permalink
Run tests and mongo-orchestration
Browse files Browse the repository at this point in the history
  • Loading branch information
ehershey authored and jyemin committed May 12, 2016
1 parent d17af84 commit 9e876c3
Showing 1 changed file with 69 additions and 126 deletions.
195 changes: 69 additions & 126 deletions .evg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,13 @@
#########################################

java_driver_variables:

topology_test_list: &topology_tests
- name: "integration-test-latest"
# - name: "integration-test-latest-replica-set"
# - name: "integration-test-latest-sharded"

## Scripts that are shared between buildvariants
scripts:
mongo_orchestration:
windows: &mongo_orchestration_windows
start_mongo_orchestration: |
trap 'set +o errexit; mongo-orchestration --pidfile c:\\mo.pid stop;' EXIT
pidfile=/cygdrive/c/mo.pid
if [ -f $pidfile ]; then
echo "Existing pidfile $pidfile"
cat $pidfile
mongo-orchestration --pidfile c:\\mo.pid stop
rm -f $pidfile
fi
ls -la
fsutil volume diskfree c:
if [ ! -d /cygdrive/c/tmp/mongoc-test-certificates ]; then
mkdir -p /cygdrive/c/tmp/mongoc-test-certificates
fi
echo "Starting Mongo Orchestration..."
echo "{ \"releases\": { \"default\": \"c:\\\\mongodb\\\\bin\" }}" > orchestration.config
mongo-orchestration -f orchestration.config -e default -s wsgiref start --socket-timeout-ms=60000 --bind=127.0.0.1 --enable-majority-read-concern --pidfile c:\\mo.pid
sleep 10
cat c:\\mo.pid
cat orchestration.config
curl -s http://localhost:8889/
unix: &mongo_orchestration_unix
start_mongo_orchestration: |
trap 'set +o errexit; mongo-orchestration --pidfile /data/mo.pid stop;' EXIT
pidfile=/data/mo.pid
if [ -f $pidfile ]; then
echo "Existing pidfile $pidfile"
cat $pidfile
mongo-orchestration --pidfile /data/mo.pid stop;
rm -f $pidfile
fi
df -h
ls -la
if [ ! -d /tmp/mongoc-test-certificates ]; then
mkdir /tmp/mongoc-test-certificates
fi
echo "Starting Mongo Orchestration..."
echo "{ \"releases\": { \"default\": \"`pwd`/mongodb/bin\" } }" > orchestration.config
TMPDIR=/data/db mongo-orchestration -f orchestration.config -e default start --socket-timeout-ms=60000 --bind=127.0.0.1 --enable-majority-read-concern --pidfile $pidfile
curl -s http://localhost:8889/
start_topology_command: &start_topology_command
start_topology: |
curl -s --data @"$ORCHESTRATION_FILE" "$ORCHESTRATION_URL"
./mongodb/bin/mongo $MONGO_SHELL_CONNECTION_FLAGS --eval 'printjson(db.serverBuildInfo())' admin
./mongodb/bin/mongo $MONGO_SHELL_CONNECTION_FLAGS --eval 'printjson(db.adminCommand({getCmdLineOpts:1}))' admin
./mongodb/bin/mongo $MONGO_SHELL_CONNECTION_FLAGS --eval 'printjson(db.isMaster())' admin
## Common download urls (merge in as hashes)
mongo_download_url_prefixes:
linux64: &mongo_url_linux64
mongo_url_prefix: "http://downloads.mongodb.org/linux/mongodb-linux-x86_64-"
ubuntu1404: &mongo_url_ubuntu1404
mongo_url_platform: "ubuntu1404-"
<<: *mongo_url_linux64

#######################################
# Functions #
Expand All @@ -70,36 +21,58 @@ functions:
params:
directory: "mongo-java-driver"

"start_mongod":
command: shell.exec
params:
background: true
working_dir: "."
script: |
wget -O mongodb.tgz https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-latest.tgz
tar --extract --file mongodb.tgz --strip-components=2 --wildcards --no-anchored "*/bin/mongod"
mkdir -p /data/log
mkdir -p /data/db
./mongod --logpath=/data/log --dbpath=/data/db --pidfilepath=/data/pid
"stop_mongod":
command: shell.exec
params:
working_dir: "."
script:
kill -TERM $(cat /data/pid)


#######################################
# Pre Task #
#######################################
"set topology standalone no auth" :
command: expansions.update
params:
updates:
- key: "orchestration_file"
value: "basic.json"
- key: "topology_type"
value: "server"

"set version latest" :
command: expansions.update
params:
updates:
- key: "mongo_url"
value: ${mongo_url_prefix}${mongo_url_platform|}latest.${mongo_url_extension|tgz}

pre:
- command: shell.exec
"fetch mongodb" :
command: shell.exec
params:
working_dir: "mongo-java-driver"
script: |
set -o verbose
set -o errexit
ls -la
curl -s ${mongo_url} --output mongo-archive.${ext|tgz}
${decompress} mongo-archive.${ext|tgz}
mv mongodb* mongodb
chmod +x ./mongodb/bin/mongod${extension}
if [ ${windows|false} = true ]; then
rm -rf /cygdrive/c/mongodb
cp -r mongodb /cygdrive/c/mongodb
fi
"run tests" :
command: shell.exec
params:
working_dir: "mongo-java-driver"
script: |
rm -rf "mongo-java-driver"
rm mongod
export ORCHESTRATION_FILE="orchestration_configs/${topology_type}s/${orchestration_file}"
mkdir -p $(dirname "$ORCHESTRATION_FILE")
# Borrow MO config from the C driver
#
curl --location "https://raw.githubusercontent.com/mongodb/mongo-c-driver/master/orchestration_configs/${topology_type}s/${orchestration_file}" > "$ORCHESTRATION_FILE"
export ORCHESTRATION_URL="http://localhost:8889/v1/${topology_type}s"
export MONGO_ORCHESTRATION_HOME=/tmp/mongo-java-test-certificates
${start_mongo_orchestration}
${start_topology}
./gradlew --stacktrace --info test
#######################################
# Tasks #
Expand All @@ -123,51 +96,15 @@ tasks:
- command: git.apply_patch
params:
directory: "mongo-java-driver"
# - command: shell.exec
# params:
# working_dir: "mongo-java-driver"
# script: |
# ./gradlew -PxmlReports.enabled=true --info -x test clean check jar testClasses javadoc
- func: "start_mongod"
# - command: shell.exec
# params:
# working_dir: "mongo-java-driver"
# script: |
# ./gradlew --stacktrace --info -x classes -x testClasses --rerun-tasks test
- command: shell.exec
params:
working_dir: "mongo-java-driver"
script: |
./gradlew --stacktrace --info test
- func: "stop_mongod"

- func: "set topology standalone no auth"
- func: "set version latest"
- func: "fetch mongodb"
- func: "run tests"

scripts:
## Scripts that are shared between buildvariants
scripts:
mongo_orchestration:
windows: &mongo_orchestration_windows
start_mongo_orchestration: |
trap 'set +o errexit; mongo-orchestration --pidfile c:\\mo.pid stop;' EXIT
pidfile=/cygdrive/c/mo.pid
if [ -f $pidfile ]; then
echo "Existing pidfile $pidfile"
cat $pidfile
mongo-orchestration --pidfile c:\\mo.pid stop
rm -f $pidfile
fi
ls -la
fsutil volume diskfree c:
if [ ! -d /cygdrive/c/tmp/mongoc-test-certificates ]; then
mkdir -p /cygdrive/c/tmp/mongoc-test-certificates
fi
echo "Starting Mongo Orchestration..."
echo "{ \"releases\": { \"default\": \"c:\\\\mongodb\\\\bin\" }}" > orchestration.config
mongo-orchestration -f orchestration.config -e default -s wsgiref start --socket-timeout-ms=60000 --bind=127.0.0.1 --enable-majority-read-concern --pidfile c:\\mo.pid
sleep 10
cat c:\\mo.pid
cat orchestration.config
curl -s http://localhost:8889/
unix: &mongo_orchestration_unix
start_mongo_orchestration: |
trap 'set +o errexit; mongo-orchestration --pidfile /data/mo.pid stop;' EXIT
Expand All @@ -180,8 +117,8 @@ scripts:
fi
df -h
ls -la
if [ ! -d /tmp/mongoc-test-certificates ]; then
mkdir /tmp/mongoc-test-certificates
if [ ! -d /tmp/mongo-java-test-certificates ]; then
mkdir /tmp/mongo-java-test-certificates
fi
echo "Starting Mongo Orchestration..."
echo "{ \"releases\": { \"default\": \"`pwd`/mongodb/bin\" } }" > orchestration.config
Expand All @@ -202,7 +139,13 @@ buildvariants:
- name: ubuntu-1404
display_name: "Ubuntu-1404"
expansions:
<<: *start_topology_command
<<: *mongo_url_ubuntu1404 # sets ${mongo_url_prefix}
<<: *mongo_orchestration_unix # sets start_topology and start_mongo_orchestration
run_on:
- ubuntu1404-build
- ubuntu1404-driversoffsite
tasks:
- name: compileAndAnalyze
- name: test
depends_on:
- name: compileAndAnalyze

0 comments on commit 9e876c3

Please sign in to comment.