Skip to content

Commit

Permalink
add tests for help for log rate limit for scale
Browse files Browse the repository at this point in the history
Signed-off-by: Rebecca Roberts <robertsre@vmware.com>
  • Loading branch information
Ben Fuller authored and rroberts2222 committed Aug 2, 2022
1 parent 8567c4a commit 0764d9d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion command/common/command_list_v7.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ type commandList struct {
SSH v7.SSHCommand `command:"ssh" description:"SSH to an application container instance"`
SSHCode v7.SSHCodeCommand `command:"ssh-code" description:"Get a one time password for ssh clients"`
SSHEnabled v7.SSHEnabledCommand `command:"ssh-enabled" description:"Reports whether SSH is enabled on an application container instance"`
Scale v7.ScaleCommand `command:"scale" description:"Change or view the instance count, disk space limit, and memory limit for an app"`
Scale v7.ScaleCommand `command:"scale" description:"Change or view the instance count, disk space limit, memory limit, and log rate limit for an app"`
SecurityGroup v7.SecurityGroupCommand `command:"security-group" description:"Show a single security group"`
SecurityGroups v7.SecurityGroupsCommand `command:"security-groups" description:"List all security groups"`
Service v7.ServiceCommand `command:"service" description:"Show service instance info"`
Expand Down
4 changes: 2 additions & 2 deletions command/v7/scale_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ type ScaleCommand struct {
Force bool `long:"force" short:"f" description:"Force restart of app without prompt"`
Instances flag.Instances `long:"instances" short:"i" required:"false" description:"Number of instances"`
DiskLimit flag.Megabytes `short:"k" required:"false" description:"Disk limit (e.g. 256M, 1024M, 1G)"`
LogRateLimit flag.BytesWithUnlimited `short:"l" required:"false" description:"Log rate limit (e.g. 256M, 1024M, 1G)"`
MemoryLimit flag.Megabytes `short:"m" required:"false" description:"Memory limit (e.g. 256M, 1024M, 1G)"`
LogRateLimit flag.BytesWithUnlimited `short:"l" required:"false" description:"Log Rate Limit (e.g. 256M, 1024M, 1G)"`
ProcessType string `long:"process" default:"web" description:"App process to scale"`
usage interface{} `usage:"CF_NAME scale APP_NAME [--process PROCESS] [-i INSTANCES] [-k DISK] [-m MEMORY] [-l LOG_RATE_LIMIT] [-f]\n\n Modifying the app's disk or memory will cause the app to restart."`
usage interface{} `usage:"CF_NAME scale APP_NAME [--process PROCESS] [-i INSTANCES] [-k DISK] [-m MEMORY] [-l LOG_RATE_LIMIT] [-f]\n\n Modifying the app's disk, memory, or log rate will cause the app to restart."`
relatedCommands interface{} `related_commands:"push"`
envCFStartupTimeout interface{} `environmentName:"CF_STARTUP_TIMEOUT" environmentDescription:"Max wait time for app instance startup, in minutes" environmentDefault:"5"`
}
Expand Down
13 changes: 7 additions & 6 deletions integration/v7/isolated/scale_command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,27 @@ var _ = Describe("scale command", func() {

Describe("help", func() {
When("--help flag is set", func() {
It("appears in cf help -a", func() {
FIt("appears in cf help -a", func() {
session := helpers.CF("help", "-a")
Eventually(session).Should(Exit(0))
Expect(session).To(HaveCommandInCategoryWithDescription("scale", "APPS", "Change or view the instance count, disk space limit, and memory limit for an app"))
Expect(session).To(HaveCommandInCategoryWithDescription("scale", "APPS", "Change or view the instance count, disk space limit, memory limit, and log rate limit for an app"))
})

It("displays command usage to output", func() {
FIt("displays command usage to output", func() {
session := helpers.CF("scale", "--help")

Eventually(session).Should(Say("NAME:"))
Eventually(session).Should(Say("scale - Change or view the instance count, disk space limit, and memory limit for an app"))
Eventually(session).Should(Say("scale - Change or view the instance count, disk space limit, memory limit, and log rate limit for an app"))

Eventually(session).Should(Say("USAGE:"))
Eventually(session).Should(Say(`cf scale APP_NAME \[--process PROCESS\] \[-i INSTANCES\] \[-k DISK\] \[-m MEMORY\]`))
Eventually(session).Should(Say("Modifying the app's disk or memory will cause the app to restart."))
Eventually(session).Should(Say(`cf scale APP_NAME \[--process PROCESS\] \[-i INSTANCES\] \[-k DISK\] \[-m MEMORY\] \[-l LOG_RATE_LIMIT\]`))
Eventually(session).Should(Say("Modifying the app's disk, memory, or log rate will cause the app to restart."))

Eventually(session).Should(Say("OPTIONS:"))
Eventually(session).Should(Say(`-f\s+Force restart of app without prompt`))
Eventually(session).Should(Say(`-i\s+Number of instances`))
Eventually(session).Should(Say(`-k\s+Disk limit \(e\.g\. 256M, 1024M, 1G\)`))
Eventually(session).Should(Say(`-l\s+Log rate limit \(e\.g\. 256M, 1024M, 1G\)`))
Eventually(session).Should(Say(`-m\s+Memory limit \(e\.g\. 256M, 1024M, 1G\)`))
Eventually(session).Should(Say(`--process\s+App process to scale \(Default: web\)`))

Expand Down

0 comments on commit 0764d9d

Please sign in to comment.