---
services: docker

env:
  - distro: centos7
  - distro: centos6
  - distro: ubuntu1604
  - distro: ubuntu1404
  - distro: ubuntu1204
  - distro: debian8

script:
  # Download test shim.
  - wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/
  - chmod +x ${PWD}/tests/test.sh

  # Run tests.
  - ${PWD}/tests/test.sh

  # # Check if TCP port 9123 is open.
  # - >
  #   sudo iptables -L -n
  #   | grep -q "ACCEPT.*dpt:9123"
  #   && (echo 'Port 9123 is open - pass' && exit 0)
  #   || (echo 'Port 9123 is not open - fail' && exit 1)

  # # Check running firewall has exit code 0
  # - >
  #   sudo service firewall status
  #   && (echo 'Status of running firewall is 0 - pass' && exit 0)
  #   || (echo 'Status of running firewall is not 0 - fail' && exit 1)

  # # Stop firewall
  # - >
  #   sudo service firewall stop
  #   && (echo 'Stopping firewall - pass' && exit 0)
  #   || (echo 'Stopping firewall - fail' && exit 1)

  # # Check stopped firewall has exit code 3
  # - >
  #   sudo service firewall status;
  #   EXIT=$?;
  #   if [ 3 -eq $EXIT ]; then
  #     echo 'Status of stopped firewall is 3 - pass' && exit 0;
  #   else
  #     echo 'Status of stopped firewall is not 3 - fail' && exit 1;
  #   fi

notifications:
  webhooks: https://galaxy.ansible.com/api/v1/notifications/