github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/integration/isolated/config_test.go (about) 1 package isolated 2 3 import ( 4 helpers "code.cloudfoundry.org/cli/integration/helpers" 5 "code.cloudfoundry.org/cli/util/configv3" 6 . "github.com/onsi/ginkgo" 7 . "github.com/onsi/gomega" 8 . "github.com/onsi/gomega/gbytes" 9 . "github.com/onsi/gomega/gexec" 10 ) 11 12 var _ = Describe("Config", func() { 13 Describe("Enable Color", func() { 14 Context("when color is enabled", func() { 15 It("prints colors", func() { 16 session := helpers.CFWithEnv(map[string]string{"CF_COLOR": "true"}, "help") 17 Eventually(session).Should(Say("\x1b\\[38;1m")) 18 }) 19 }) 20 21 Context("when color is disabled", func() { 22 It("does not print colors", func() { 23 session := helpers.CFWithEnv(map[string]string{"CF_COLOR": "false"}, "help") 24 Eventually(session).Should(Exit(0)) 25 Expect(session).NotTo(Say("\x1b\\[38;1m")) 26 }) 27 }) 28 }) 29 30 Describe("Dial Timeout", func() { 31 Context("when the dial timeout is set", func() { 32 BeforeEach(func() { 33 config, err := configv3.LoadConfig() 34 Expect(err).ToNot(HaveOccurred()) 35 36 config.ConfigFile.Target = "http://1.2.3.4" 37 38 err = configv3.WriteConfig(config) 39 Expect(err).ToNot(HaveOccurred()) 40 }) 41 42 It("times out connection attempts after the dial timeout has passed", func() { 43 session := helpers.CFWithEnv(map[string]string{"CF_DIAL_TIMEOUT": "1"}, "unbind-service", "banana", "pants") 44 Eventually(session.Err).Should(Say("dial tcp 1.2.3.4:80: i/o timeout")) 45 }) 46 }) 47 }) 48 })