github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/integration/global/set_running_environment_variable_group_command_test.go (about) 1 package global 2 3 import ( 4 "fmt" 5 "math/rand" 6 7 "code.cloudfoundry.org/cli/integration/helpers" 8 . "github.com/onsi/ginkgo" 9 . "github.com/onsi/gomega" 10 . "github.com/onsi/gomega/gbytes" 11 . "github.com/onsi/gomega/gexec" 12 ) 13 14 var _ = Describe("set-running-environment-variable-group command", func() { 15 var ( 16 key1 string 17 key2 string 18 val1 string 19 val2 int 20 ) 21 22 BeforeEach(func() { 23 helpers.LoginCF() 24 25 key1 = helpers.PrefixedRandomName("key1") 26 key2 = helpers.PrefixedRandomName("key2") 27 val1 = helpers.PrefixedRandomName("val1") 28 val2 = rand.Intn(2000) 29 }) 30 31 AfterEach(func() { 32 session := helpers.CF("set-running-environment-variable-group", "{}") 33 Eventually(session).Should(Exit(0)) 34 }) 35 36 It("sets running environment variables", func() { 37 json := fmt.Sprintf(`{"%s":"%s", "%s":%d}`, key1, val1, key2, val2) 38 session := helpers.CF("set-running-environment-variable-group", json) 39 Eventually(session).Should(Say("Setting the contents of the running environment variable group as")) 40 Eventually(session).Should(Say("OK")) 41 Eventually(session).Should(Exit(0)) 42 43 session = helpers.CF("running-environment-variable-group") 44 Eventually(session).Should(Say("%s\\s+%s", key1, val1)) 45 Eventually(session).Should(Say("%s\\s+%d", key2, val2)) 46 Eventually(session).Should(Exit(0)) 47 }) 48 })