diff --git a/libnetwork/Makefile b/libnetwork/Makefile index c3428f7d80..20ef219749 100644 --- a/libnetwork/Makefile +++ b/libnetwork/Makefile @@ -1,5 +1,5 @@ .PHONY: all all-local build build-local check check-code check-format run-tests check-local install-deps coveralls circle-ci - +SHELL=/bin/bash dockerargs = --privileged -v $(shell pwd):/go/src/github.com/docker/libnetwork -w /go/src/github.com/docker/libnetwork golang:1.4 docker = docker run --rm ${dockerargs} ciargs = -e "COVERALLS_TOKEN=$$COVERALLS_TOKEN" @@ -20,23 +20,30 @@ check: ${docker} make install-deps check-local check-code: + @echo "Checking code... " test -z "$$(golint ./... | tee /dev/stderr)" go vet ./... + @echo "Done checking code" check-format: + @echo "Checking format... " test -z "$$(goimports -l . | grep -v Godeps/_workspace/src/ | tee /dev/stderr)" + @echo "Done checking format" run-tests: - echo "mode: count" > coverage.coverprofile - for dir in $$(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); do \ + @echo "Running tests... " + @echo "mode: count" > coverage.coverprofile + @for dir in $$(find . -maxdepth 10 -not -path './.git*' -not -path '*/_*' -type d); do \ if ls $$dir/*.go &> /dev/null; then \ $(shell which godep) go test -test.v -covermode=count -coverprofile=$$dir/profile.tmp $$dir ; \ + if [ $$? -ne 0 ]; then exit $$?; fi ;\ if [ -f $$dir/profile.tmp ]; then \ cat $$dir/profile.tmp | tail -n +2 >> coverage.coverprofile ; \ rm $$dir/profile.tmp ; \ fi ; \ fi ; \ done + @echo "Done running tests" check-local: check-format check-code run-tests diff --git a/libnetwork/drivers/bridge/setup_verify_test.go b/libnetwork/drivers/bridge/setup_verify_test.go index 6559860378..ba924635d0 100644 --- a/libnetwork/drivers/bridge/setup_verify_test.go +++ b/libnetwork/drivers/bridge/setup_verify_test.go @@ -34,7 +34,7 @@ func TestSetupVerify(t *testing.T) { t.Fatalf("Failed to assign IPv4 %s to interface: %v", config.AddressIPv4, err) } - if err := setupVerifyConfiguredAddresses(config, inf); err != nil { + if err := setupVerifyAndReconcile(config, inf); err != nil { t.Fatalf("Address verification failed: %v", err) } } @@ -52,7 +52,7 @@ func TestSetupVerifyBad(t *testing.T) { t.Fatalf("Failed to assign IPv4 %s to interface: %v", ipnet, err) } - if err := setupVerifyConfiguredAddresses(config, inf); err == nil { + if err := setupVerifyAndReconcile(config, inf); err == nil { t.Fatal("Address verification was expected to fail") } } @@ -65,7 +65,7 @@ func TestSetupVerifyMissing(t *testing.T) { config := &Configuration{} config.AddressIPv4 = &net.IPNet{IP: addrv4, Mask: addrv4.DefaultMask()} - if err := setupVerifyConfiguredAddresses(config, inf); err == nil { + if err := setupVerifyAndReconcile(config, inf); err == nil { t.Fatal("Address verification was expected to fail") } } @@ -86,7 +86,7 @@ func TestSetupVerifyIPv6(t *testing.T) { t.Fatalf("Failed to assign IPv4 %s to interface: %v", config.AddressIPv4, err) } - if err := setupVerifyConfiguredAddresses(config, inf); err != nil { + if err := setupVerifyAndReconcile(config, inf); err != nil { t.Fatalf("Address verification failed: %v", err) } } @@ -104,7 +104,7 @@ func TestSetupVerifyIPv6Missing(t *testing.T) { t.Fatalf("Failed to assign IPv4 %s to interface: %v", config.AddressIPv4, err) } - if err := setupVerifyConfiguredAddresses(config, inf); err == nil { + if err := setupVerifyAndReconcile(config, inf); err == nil { t.Fatal("Address verification was expected to fail") } }