github.com/schwarzm/garden-linux@v0.0.0-20150507151835-33bca2147c47/integration/lifecycle/flags_test.go (about) 1 package lifecycle_test 2 3 import ( 4 "fmt" 5 "net/http" 6 7 . "github.com/onsi/ginkgo" 8 . "github.com/onsi/gomega" 9 ) 10 11 var _ = Describe("Garden startup flags", func() { 12 13 var debugAddr string 14 15 BeforeEach(func() { 16 debugAddr = fmt.Sprintf("0.0.0.0:%d", 15000+GinkgoParallelNode()) 17 }) 18 19 Context("when starting without the --debugAddr flag", func() { 20 BeforeEach(func() { 21 client = startGarden() 22 }) 23 24 It("does not expose the pprof debug endpoint", func() { 25 _, err := http.Get(fmt.Sprintf("http://%s/debug/pprof/?debug=1", debugAddr)) 26 Expect(err).To(HaveOccurred()) 27 }) 28 29 It("does not expose the log level adjustment endpoint", func() { 30 _, err := http.Get(fmt.Sprintf("http://%s/log-level -X PUT -d debug", debugAddr)) 31 Expect(err).To(HaveOccurred()) 32 }) 33 }) 34 35 Context("when starting with the --debugAddr flag", func() { 36 BeforeEach(func() { 37 client = startGarden("--debugAddr", debugAddr) 38 }) 39 40 It("exposes the pprof debug endpoint", func() { 41 _, err := http.Get(fmt.Sprintf("http://%s/debug/pprof/?debug=1", debugAddr)) 42 Expect(err).ToNot(HaveOccurred()) 43 }) 44 45 It("exposes the log level adjustment endpoint", func() { 46 _, err := http.Get(fmt.Sprintf("http://%s/log-level -X PUT -d debug", debugAddr)) 47 Expect(err).ToNot(HaveOccurred()) 48 49 _, err = http.Get(fmt.Sprintf("http://%s/log-level -X PUT -d info", debugAddr)) 50 Expect(err).ToNot(HaveOccurred()) 51 52 _, err = http.Get(fmt.Sprintf("http://%s/log-level -X PUT -d error", debugAddr)) 53 Expect(err).ToNot(HaveOccurred()) 54 55 _, err = http.Get(fmt.Sprintf("http://%s/log-level -X PUT -d fatal", debugAddr)) 56 Expect(err).ToNot(HaveOccurred()) 57 }) 58 }) 59 })