#!/bin/bash

usage() {
cat <<EOF
Usage: $0 [options]

    Options:
      devel       Run bats against development
      content     Run content tests (yum + puppet)
      proxy       Run proxy tests (requires content)
      virt-whom   Run virt-whom candlepin tests
EOF
}

[ $# -eq 0 ] && usage && exit 1

for arg do
  case $arg in
      help)
        usage
        exit 1
        ;;
      content)
        katello_content_tests=true
        ;;
      virt-whom)
        katello_virt_whom=true
        ;;
      proxy)
        katello_proxy=true
        ;;
   esac
done

BATS_ARGS="fb-test-katello.bats"

if [ "$katello_content_tests" == true ];
then
    BATS_ARGS="$BATS_ARGS fb-content-katello.bats"
fi

# Must have run content suite when testing the proxy
if [ "$katello_proxy" == true ];
then
    BATS_ARGS="$BATS_ARGS fb-proxy.bats"
fi

if [ "$katello_virt_whom" == true ];
then
    BATS_ARGS="$BATS_ARGS fb-virt-whom.bats"
fi

cd /opt/bats

bats $BATS_ARGS fb-finish.bats
