#!/bin/bash
set -e

cd $(dirname $0)/..

trap "rm -rf /scratch/*" exit

if [ -d "/scratch" ]; then
    rsync -a --exclude .tox ./ /scratch
fi

pushd /scratch/integration

# Start rancher-catalog-service and wait for it to start.
/usr/bin/rancher-catalog-service -catalogUrl ../ -refreshInterval 7200 > /dev/null 2>&1 &
sleep 10
tox -e flake8,py27
popd