Repository for continuous integration tests for the CoreDNS project. Currently tests relating to Kubernetes are contained here, but integration tests for other internal CoreDNS plugins may be moved here or added here in the future. The repository also contains tests related to Kubernetes Deployment and external plugins (kubernetai, metadata_edns0).
The tests are run using CircleCI. New PRs in this repository will be tested against all the tests with CoreDNS built from master.
The configuration is set in such a way that they can be run in your fork, in case you want to run the tests in your fork before submitting a PR here. CircleCI must be enabled on your fork for this to work.
The go tests are located in /tests
directory tree. /build
contains scripts for spinning up the test
environment such as setting up a local Kubernetes cluster environment for Kubernetes related tests.
The configuration for running the tests is done in the .circleci/config.yaml file.
You can run these tests locally, though the process to get them working is not streamlined in any way. At a high level, you should be able to do something like the following:
- install/start a kubernetes cluster to run the tests.
- make sure kubeconfig is set up to point to your cluster, and that kubectl works
- create the required fixtures using
kubectl apply -f $GOPATH/src/github.com/coredns/ci/build/kubernetes/dns-test.yaml
. This creates a static set of test services/pods/namespaces (namespaces named test-1, test-2, etc). - build the docker image of coredns.
cd $GOPATH/src/github.com/coredns/coredns && make coredns SYSTEM="GOOS=linux" && docker build -t coredns .
- load the docker image into the cluster e.g. for a kind cluster,
kind load docker-image coredns
- patch the coredns deployment with
kubectl patch deployment coredns -n kube-system -p "$(cat $GOPATH/src/github.com/coredns/ci/build/kubernetes/coredns_deployment_patch.yaml")
. If your docker image name is not "coredns", update the name of the docker image in the deployment or in the patch file prior to applying it. - run the tests with
go test
.... e.g.go test -v ./test/kubernetes/...