github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+incompatible/integration/helpers/environment.go (about)

     1  package helpers
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  
     7  	. "github.com/onsi/gomega"
     8  	. "github.com/onsi/gomega/gexec"
     9  )
    10  
    11  func AddOrReplaceEnvironment(env []string, newEnvName string, newEnvVal string) []string {
    12  	var found bool
    13  	for i, envPair := range env {
    14  		splitENV := strings.Split(envPair, "=")
    15  		if splitENV[0] == newEnvName {
    16  			env[i] = fmt.Sprintf("%s=%s", newEnvName, newEnvVal)
    17  			found = true
    18  		}
    19  	}
    20  
    21  	if !found {
    22  		env = append(env, fmt.Sprintf("%s=%s", newEnvName, newEnvVal))
    23  	}
    24  	return env
    25  }
    26  
    27  func EnableDockerSupport() {
    28  	tempHome := SetHomeDir()
    29  	SetAPI()
    30  	LoginCF()
    31  	Eventually(CF("enable-feature-flag", "diego_docker")).Should(Exit(0))
    32  	DestroyHomeDir(tempHome)
    33  }