Skip to content

Commit cba5582

Browse files
authored
Updated Test cases (#27)
This commit includes the changes required to make the outdated test cases consistent with the current implementation. + removing the soon to be deprecated(ginkgo v2) ginkgo behavior of passing Done channel in test cases.
1 parent 72d33a8 commit cba5582

File tree

5 files changed

+80
-93
lines changed

5 files changed

+80
-93
lines changed

cf_cli_java_plugin.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func (c *JavaPlugin) Run(cliConnection plugin.CliConnection, args []string) {
8383
}
8484

8585
// DoRun is an internal method that we use to wrap the cmd package with CommandExecutor for test purposes
86-
func (c *JavaPlugin) DoRun(commandExecutor cmd.CommandExecutor, uuidGenerator uuid.UUIDGenerator, util utils.CfJavaPluginUtilImpl, args []string) (string, error) {
86+
func (c *JavaPlugin) DoRun(commandExecutor cmd.CommandExecutor, uuidGenerator uuid.UUIDGenerator, util utils.CfJavaPluginUtil, args []string) (string, error) {
8787
traceLogger := trace.NewLogger(os.Stdout, true, os.Getenv("CF_TRACE"), "")
8888
ui := terminal.NewUI(os.Stdin, os.Stdout, terminal.NewTeePrinter(os.Stdout), traceLogger)
8989

@@ -103,7 +103,7 @@ func (c *JavaPlugin) DoRun(commandExecutor cmd.CommandExecutor, uuidGenerator uu
103103
return output, err
104104
}
105105

106-
func (c *JavaPlugin) execute(commandExecutor cmd.CommandExecutor, uuidGenerator uuid.UUIDGenerator, util utils.CfJavaPluginUtilImpl, args []string) (string, error) {
106+
func (c *JavaPlugin) execute(commandExecutor cmd.CommandExecutor, uuidGenerator uuid.UUIDGenerator, util utils.CfJavaPluginUtil, args []string) (string, error) {
107107
if len(args) == 0 {
108108
return "", &InvalidUsageError{message: "No command provided"}
109109
}
@@ -254,18 +254,18 @@ func (c *JavaPlugin) execute(commandExecutor cmd.CommandExecutor, uuidGenerator
254254
heapdumpFileName = finalFile
255255
fmt.Println("Successfully created heap dump in application container at: " + heapdumpFileName)
256256
} else {
257-
fmt.Println("Failed to find heap dump in application container")
258-
fmt.Println(finalFile)
259-
fmt.Println(heapdumpFileName)
260-
fmt.Println(fspath)
261-
return "", err
257+
fmt.Println("Failed to find heap dump in application container")
258+
fmt.Println(finalFile)
259+
fmt.Println(heapdumpFileName)
260+
fmt.Println(fspath)
261+
return "", err
262262
}
263263

264264
if copyToLocal {
265265
localFileFullPath := localDir + "/" + applicationName + "-heapdump-" + uuidGenerator.Generate() + ".hprof"
266266
err = util.CopyOverCat(applicationName, heapdumpFileName, localFileFullPath)
267267
if err == nil {
268-
fmt.Println("Heap dump filed saved to: " + localFileFullPath)
268+
fmt.Println("Heap dump file saved to: " + localFileFullPath)
269269
} else {
270270
return "", err
271271
}
@@ -278,7 +278,7 @@ func (c *JavaPlugin) execute(commandExecutor cmd.CommandExecutor, uuidGenerator
278278
if err != nil {
279279
return "", err
280280
}
281-
fmt.Println("Heap dump filed deleted in app container")
281+
fmt.Println("Heap dump file deleted in app container")
282282
}
283283
}
284284
// We keep this around to make the compiler happy, but commandExecutor.Execute will cause an os.Exit

cf_cli_java_plugin_suite_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main_test
1+
package main
22

33
import (
44
ginkgo "github.com/onsi/ginkgo"

0 commit comments

Comments
 (0)