github.com/arunkumar7540/cli@v6.45.0+incompatible/integration/v7/push/help_test.go (about) 1 package push 2 3 import ( 4 "code.cloudfoundry.org/cli/integration/helpers" 5 . "github.com/onsi/ginkgo" 6 . "github.com/onsi/gomega" 7 . "github.com/onsi/gomega/gbytes" 8 . "github.com/onsi/gomega/gexec" 9 "regexp" 10 "strings" 11 ) 12 13 var _ = Describe("help", func() { 14 When("--help flag is set", func() { 15 It("Displays command usage to output", func() { 16 session := helpers.CF(PushCommandName, "--help") 17 Eventually(session).Should(Say("NAME:")) 18 Eventually(session).Should(Say("%s - Push a new app or sync changes to an existing app", PushCommandName)) 19 Eventually(session).Should(Say("USAGE:")) 20 21 buildpackAppUsage := []string{ 22 "cf", 23 PushCommandName, 24 "APP_NAME", 25 "[-b BUILDPACK_NAME]", 26 "[-c COMMAND]", 27 "[-f MANIFEST_PATH | --no-manifest]", 28 "[--no-start]", 29 "[-i NUM_INSTANCES]", 30 "[-k DISK]", 31 "[-m MEMORY]", 32 "[-p PATH]", 33 "[-s STACK]", 34 "[-t HEALTH_TIMEOUT]", 35 "[-u (process | port | http)]", 36 "[--no-route | --random-route]", 37 "[--var KEY=VALUE]", 38 "[--vars-file VARS_FILE_PATH]...", 39 } 40 41 dockerAppUsage := []string{ 42 "cf", 43 PushCommandName, 44 "APP_NAME", 45 "--docker-image", 46 "[REGISTRY_HOST:PORT/]IMAGE[:TAG]", 47 "[--docker-username USERNAME]", 48 "[-c COMMAND]", 49 "[-f MANIFEST_PATH | --no-manifest]", 50 "[--no-start]", 51 "[-i NUM_INSTANCES]", 52 "[-k DISK]", 53 "[-m MEMORY]", 54 "[-p PATH]", 55 "[-s STACK]", 56 "[-t HEALTH_TIMEOUT]", 57 "[-u (process | port | http)]", 58 "[--no-route | --random-route ]", 59 "[--var KEY=VALUE]", 60 "[--vars-file VARS_FILE_PATH]...", 61 } 62 63 assertUsage(session, buildpackAppUsage, dockerAppUsage) 64 65 Eventually(session).Should(Say("OPTIONS:")) 66 Eventually(session).Should(Say(`-b\s+Custom buildpack by name \(e\.g\. my-buildpack\) or Git URL \(e\.g\. 'https://github.com/cloudfoundry/java-buildpack.git'\) or Git URL with a branch or tag \(e\.g\. 'https://github.com/cloudfoundry/java-buildpack\.git#v3.3.0' for 'v3.3.0' tag\)\. To use built-in buildpacks only, specify 'default' or 'null'`)) 67 Eventually(session).Should(Say(`--docker-image, -o\s+Docker image to use \(e\.g\. user/docker-image-name\)`)) 68 Eventually(session).Should(Say(`--docker-username\s+Repository username; used with password from environment variable CF_DOCKER_PASSWORD`)) 69 Eventually(session).Should(Say(`--no-route\s+Do not map a route to this app`)) 70 Eventually(session).Should(Say(`--no-start\s+Do not stage and start the app after pushing`)) 71 Eventually(session).Should(Say(`-p\s+Path to app directory or to a zip file of the contents of the app directory`)) 72 Eventually(session).Should(Say("ENVIRONMENT:")) 73 Eventually(session).Should(Say(`CF_DOCKER_PASSWORD=\s+Password used for private docker repository`)) 74 Eventually(session).Should(Say(`CF_STAGING_TIMEOUT=15\s+Max wait time for buildpack staging, in minutes`)) 75 Eventually(session).Should(Say(`CF_STARTUP_TIMEOUT=5\s+Max wait time for app instance startup, in minutes`)) 76 77 Eventually(session).Should(Exit(0)) 78 }) 79 }) 80 }) 81 82 func assertUsage(session *Session, usages ...[]string) { 83 for _, usage := range usages { 84 for k, v := range usage { 85 usage[k] = regexp.QuoteMeta(v) 86 } 87 Eventually(session).Should(Say( 88 strings.Join(usage, `\s+`)), 89 ) 90 } 91 }