github.com/sleungcy-sap/cli@v7.1.0+incompatible/integration/v7/push/help_test.go (about) 1 package push 2 3 import ( 4 "regexp" 5 "strings" 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("help", func() { 15 When("--help flag is set", func() { 16 It("Displays command usage to output", func() { 17 session := helpers.CF(PushCommandName, "--help") 18 Eventually(session).Should(Say("NAME:")) 19 Eventually(session).Should(Say("%s - Push a new app or sync changes to an existing app", PushCommandName)) 20 Eventually(session).Should(Say("USAGE:")) 21 22 buildpackAppUsage := []string{ 23 "cf", 24 PushCommandName, 25 "APP_NAME", 26 "[-b BUILDPACK_NAME]", 27 "[-c COMMAND]", 28 "[-f MANIFEST_PATH | --no-manifest]", 29 "[--no-start]", 30 "[--no-wait]", 31 "[-i NUM_INSTANCES]", 32 "[-k DISK]", 33 "[-m MEMORY]", 34 "[-p PATH]", 35 "[-s STACK]", 36 "[-t HEALTH_TIMEOUT]", 37 "[--task TASK]", 38 "[-u (process | port | http)]", 39 "[--no-route | --random-route]", 40 "[--var KEY=VALUE]", 41 "[--vars-file VARS_FILE_PATH]...", 42 } 43 44 dockerAppUsage := []string{ 45 "cf", 46 PushCommandName, 47 "APP_NAME", 48 "--docker-image", 49 "[REGISTRY_HOST:PORT/]IMAGE[:TAG]", 50 "[--docker-username USERNAME]", 51 "[-c COMMAND]", 52 "[-f MANIFEST_PATH | --no-manifest]", 53 "[--no-start]", 54 "[--no-wait]", 55 "[-i NUM_INSTANCES]", 56 "[-k DISK]", 57 "[-m MEMORY]", 58 "[-p PATH]", 59 "[-s STACK]", 60 "[-t HEALTH_TIMEOUT]", 61 "[--task TASK]", 62 "[-u (process | port | http)]", 63 "[--no-route | --random-route ]", 64 "[--var KEY=VALUE]", 65 "[--vars-file VARS_FILE_PATH]...", 66 } 67 68 assertUsage(session, buildpackAppUsage, dockerAppUsage) 69 70 Eventually(session).Should(Say("OPTIONS:")) 71 Eventually(session).Should(Say(`app-start-timeout, -t`)) 72 Eventually(session).Should(Say(`--buildpack, -b`)) 73 Eventually(session).Should(Say(`disk, -k`)) 74 Eventually(session).Should(Say(`--docker-image, -o`)) 75 Eventually(session).Should(Say(`--docker-username`)) 76 Eventually(session).Should(Say(`--droplet`)) 77 Eventually(session).Should(Say(`--endpoint`)) 78 Eventually(session).Should(Say(`--health-check-type, -u`)) 79 Eventually(session).Should(Say(`--instances, -i`)) 80 Eventually(session).Should(Say(`--manifest, -f`)) 81 Eventually(session).Should(Say(`--memory, -m`)) 82 Eventually(session).Should(Say(`--no-manifest`)) 83 Eventually(session).Should(Say(`--no-route`)) 84 Eventually(session).Should(Say(`--no-start`)) 85 Eventually(session).Should(Say(`--no-wait`)) 86 Eventually(session).Should(Say(`--path, -p`)) 87 Eventually(session).Should(Say(`--random-route`)) 88 Eventually(session).Should(Say(`--stack, -s`)) 89 Eventually(session).Should(Say(`--start-command, -c`)) 90 Eventually(session).Should(Say(`--strategy`)) 91 Eventually(session).Should(Say(`--task`)) 92 Eventually(session).Should(Say(`--var`)) 93 Eventually(session).Should(Say(`--vars-file`)) 94 Eventually(session).Should(Say("ENVIRONMENT:")) 95 Eventually(session).Should(Say(`CF_DOCKER_PASSWORD=\s+Password used for private docker repository`)) 96 Eventually(session).Should(Say(`CF_STAGING_TIMEOUT=15\s+Max wait time for staging, in minutes`)) 97 Eventually(session).Should(Say(`CF_STARTUP_TIMEOUT=5\s+Max wait time for app instance startup, in minutes`)) 98 99 Eventually(session).Should(Exit(0)) 100 }) 101 }) 102 }) 103 104 func assertUsage(session *Session, usages ...[]string) { 105 for _, usage := range usages { 106 for k, v := range usage { 107 usage[k] = regexp.QuoteMeta(v) 108 } 109 Eventually(session).Should(Say( 110 strings.Join(usage, `\s+`)), 111 ) 112 } 113 }