github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/integration/global/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("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  		json := fmt.Sprintf(`{"%s":"%s", "%s":%d}`, key1, val1, key2, val2)
    31  		session := helpers.CF("set-running-environment-variable-group", json)
    32  		Eventually(session).Should(Exit(0))
    33  	})
    34  
    35  	AfterEach(func() {
    36  		session := helpers.CF("set-running-environment-variable-group", "{}")
    37  		Eventually(session).Should(Exit(0))
    38  	})
    39  
    40  	It("gets running environment variables", func() {
    41  		session := helpers.CF("running-environment-variable-group")
    42  		Eventually(session).Should(Say("%s\\s+%s", key1, val1))
    43  		Eventually(session).Should(Say("%s\\s+%d", key2, val2))
    44  		Eventually(session).Should(Exit(0))
    45  	})
    46  })