docker / docker/secrets-engine
Crashed launched plugins are difficult to debug
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 91
- Forks
- 16
- Avg merge
- 9h 3m
- Merged PRs (30d)
- 24
Description
It would be nice to have a way to get the stdout and stderr of a launched plugin. At the moment we just have the exit code, which isn't very useful to debug with.
To get any sort of indication of what failed, we need to manually short circuit the test plugins in dummy.go.
func PluginCommand(t *testing.T, cfg PluginCfg) (*exec.Cmd, func() (*PluginResult, error)) {
t.Helper()
cfgStr, err := cfg.toString()
assert.NoError(t, err)
cmd := exec.Command(os.Args[0]) // run the test binary again
var stdoutBuf, stderrBuf bytes.Buffer
- cmd.Stdout = stdoutBuf
- cmd.Stderr = stderrBuf
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stdout
cmd.Env = append(os.Environ(),
"RUN_AS_DUMMY_PLUGIN=1",
dummyPluginCfgEnv+"="+cfgStr,
)
It would be best to get the output of the buffer returned to the caller so that the caller can log/comparison check the output.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in dummy.go at PluginCommand and inspect the caller that receives PluginResult and error values. Trace how launched plugin output is currently buffered or discarded, then make stdout and stderr available for logging or comparison checks while keeping the existing plugin tests passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100