Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions cf_cli_java_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
var _ plugin.Plugin = (*JavaPlugin)(nil)

// The JavaPlugin is a cf cli plugin that supports taking heap and thread dumps on demand
type JavaPlugin struct{
type JavaPlugin struct {
verbose bool
}

Expand Down Expand Up @@ -732,7 +732,7 @@ func (c *JavaPlugin) execute(commandExecutor cmd.CommandExecutor, uuidGenerator
return "", fmt.Errorf("Command execution failed: %w\nOutput: %s", err, strings.Join(output, "\n"))
}

if command.GenerateFiles && !noDownload {
if command.GenerateFiles {
logVerbose("Processing file generation and download")

finalFile := ""
Expand All @@ -751,12 +751,17 @@ func (c *JavaPlugin) execute(commandExecutor cmd.CommandExecutor, uuidGenerator
fileName = finalFile
logVerbose("Found file: %s", finalFile)
fmt.Println("Successfully created " + command.FileLabel + " in application container at: " + fileName)
} else {
} else if !noDownload {
logVerbose("Failed to find file, error: %v", err)
fmt.Println("Failed to find " + command.FileLabel + " in application container")
return "", err
}

if noDownload {
fmt.Println("No download requested, skipping file download")
return strings.Join(output, "\n"), nil
}

localFileFullPath := localDir + "/" + applicationName + "-" + command.FileNamePart + "-" + uuidGenerator.Generate() + command.FileExtension
logVerbose("Downloading file to: %s", localFileFullPath)
err = utils.CopyOverCat(cfSSHArguments, fileName, localFileFullPath)
Expand Down
11 changes: 11 additions & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ A modern, efficient testing framework for the CF Java Plugin using Python and py
./test.py --start-with TestClass::test_method all # Start with a specific test (inclusive)
```

## Possible Problems

The following error might occur when connected to the SAP internal network:

```sh
ssh: handshake failed: read tcp 10.16.73.196:64531->18.157.52.48:2222: read: connection reset by peer
```

Just connect directly to the internet without the VPN.


## State of Testing

- `heap-dump` is thoroughly tested, including all flags, so that less has to be tested for the other commands.
Expand Down
2 changes: 1 addition & 1 deletion test/test_basic_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_no_download(self, t, app):
"""Test heap dump without downloading - file stays remote."""
t.run(f"heap-dump {app} --no-download").should_succeed().should_create_no_files().should_create_remote_file(
"*.hprof"
)
).should_contain("Successfully created heap dump").should_contain("No download requested")

@test(no_restart=True)
def test_custom_container_dir(self, t, app):
Expand Down