2016-07-27 10:01:24 -07:00
sudo : required
# Trusty distribution is much faster when sudo is required
dist : trusty
services :
- docker
2016-03-18 20:57:35 +00:00
language : go
go :
- 1.6
2016-07-27 10:01:24 -07:00
# In the Travis VM-based build environment, IPv6 networking is not
# enabled by default. The sysctl operations below enable IPv6.
# IPv6 is needed by some of the CoreDNS test cases. The VM environment
# is needed to have access to sudo in the test environment. Sudo is
# needed to have docker in the test environment. Docker is needed to
# launch a kubernetes instance in the test environment.
# (Dependencies are fun! :) )
before_install :
- cat /proc/net/if_inet6
- uname -a
- sudo bash -c 'if [ `cat /proc/net/if_inet6 | wc -l` = "0" ]; then echo "Enabling IPv6" ; sysctl net.ipv6.conf.all.disable_ipv6=0 ; sysctl net.ipv6.conf.default.disable_ipv6=0 ; sysctl net.ipv6.conf.lo.disable_ipv6=0 ; fi'
- cat /proc/net/if_inet6
- env
2016-04-10 18:50:11 +01:00
before_script :
2016-08-05 18:19:51 -07:00
# Fix repo pathname for golang imports.
# When building in a forked repo the import path will be incorrect.
# Fix is to detect this case and create a symbolic link for the real import name.
# Note: This assumes that both the upstream "real" repo and the fork are hosted
# at the same domain. (eg. github.com)
- ( export UPSTREAM="miekg/coredns" && export REPONAME=`pwd | rev | cut -d "/" -f 1-2 | rev` && test "$REPO" != "$UPSTREAM" && mkdir -p ../../`echo $UPSTREAM | cut -d "/" -f 1` && ln -s ../$REPONAME ../../$UPSTREAM )
# Download etcd, unpack and launch
2016-04-21 14:26:02 +01:00
- curl -L https://github.com/coreos/etcd/releases/download/v2.3.1/etcd-v2.3.1-linux-amd64.tar.gz -o etcd-v2.3.1-linux-amd64.tar.gz
- tar xzvf etcd-v2.3.1-linux-amd64.tar.gz
- ./etcd-v2.3.1-linux-amd64/etcd &
2016-08-05 18:19:51 -07:00
# If docker is available, pull the kubernetes hyperkube image down and launch kubernetes.
2016-07-27 10:01:24 -07:00
- if which docker &>/dev/null ; then docker pull gcr.io/google_containers/hyperkube-amd64:v1.2.4 ; docker ps -a ; fi
- if which docker &>/dev/null ; then ./middleware/kubernetes/test/00_run_k8s.sh && ./middleware/kubernetes/test/10_setup_kubectl.sh && ./middleware/kubernetes/test/20_setup_k8s_services.sh ; docker ps -a ; fi
2016-08-05 18:19:51 -07:00
# Get golang dependencies, and build coredns binary
- go get -v -d
- go get github.com/coreos/go-etcd/etcd
- go build -v -ldflags="-s -w"
2016-07-27 10:01:24 -07:00
2016-03-19 14:55:26 +00:00
script :
2016-04-21 14:26:02 +01:00
- go test -tags etcd -race -bench=. ./...
2016-08-05 18:19:51 -07:00
# Run kubernetes integration tests only if kubectl is available. i.e. If kubernetes was launched
2016-07-27 10:01:24 -07:00
- ./middleware/kubernetes/test/kubectl version && go test -tags k8s -race -bench=. -run 'TestK8sIntegration' ./test