Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testing: fix data race when reading container state in some handlers
Example of data race found: ``` ================== WARNING: DATA RACE Write at 0x00c420df4468 by goroutine 559: github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing.(*DockerServer).stopContainer() /home/travis/gopath/src/github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing/server.go:724 +0x15a github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing.(*DockerServer).(github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing.stopContainer)-fm() /home/travis/gopath/src/github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing/server.go:169 +0x5f github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing.(*DockerServer).handlerWrapper.func1() /home/travis/gopath/src/github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing/server.go:379 +0x70a net/http.HandlerFunc.ServeHTTP() /home/travis/.gimme/versions/go1.9.2.linux.amd64/src/net/http/server.go:1918 +0x51 github.com/tsuru/tsuru/vendor/github.com/gorilla/mux.(*Router).ServeHTTP() /home/travis/gopath/src/github.com/tsuru/tsuru/vendor/github.com/gorilla/mux/mux.go:133 +0x18a github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing.(*DockerServer).ServeHTTP() /home/travis/gopath/src/github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing/server.go:340 +0x271 net/http.serverHandler.ServeHTTP() /home/travis/.gimme/versions/go1.9.2.linux.amd64/src/net/http/server.go:2619 +0xbc net/http.(*conn).serve() /home/travis/.gimme/versions/go1.9.2.linux.amd64/src/net/http/server.go:1801 +0x83b Previous read at 0x00c420df4468 by goroutine 165: github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing.(*DockerServer).attachContainer() /home/travis/gopath/src/github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing/server.go:790 +0x356 github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing.(*DockerServer).(github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing.attachContainer)-fm() /home/travis/gopath/src/github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing/server.go:174 +0x5f github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing.(*DockerServer).handlerWrapper.func1() /home/travis/gopath/src/github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing/server.go:379 +0x70a net/http.HandlerFunc.ServeHTTP() /home/travis/.gimme/versions/go1.9.2.linux.amd64/src/net/http/server.go:1918 +0x51 github.com/tsuru/tsuru/vendor/github.com/gorilla/mux.(*Router).ServeHTTP() /home/travis/gopath/src/github.com/tsuru/tsuru/vendor/github.com/gorilla/mux/mux.go:133 +0x18a github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing.(*DockerServer).ServeHTTP() /home/travis/gopath/src/github.com/tsuru/tsuru/vendor/github.com/fsouza/go-dockerclient/testing/server.go:340 +0x271 net/http.serverHandler.ServeHTTP() /home/travis/.gimme/versions/go1.9.2.linux.amd64/src/net/http/server.go:2619 +0xbc net/http.(*conn).serve() /home/travis/.gimme/versions/go1.9.2.linux.amd64/src/net/http/server.go:1801 +0x83b Goroutine 559 (running) created at: net/http.(*Server).Serve() /home/travis/.gimme/versions/go1.9.2.linux.amd64/src/net/http/server.go:2720 +0x37c net/http.Serve() /home/travis/.gimme/versions/go1.9.2.linux.amd64/src/net/http/server.go:2323 +0xe2 Goroutine 165 (running) created at: net/http.(*Server).Serve() /home/travis/.gimme/versions/go1.9.2.linux.amd64/src/net/http/server.go:2720 +0x37c net/http.Serve() /home/travis/.gimme/versions/go1.9.2.linux.amd64/src/net/http/server.go:2323 +0xe2 ================== ```
- Loading branch information