docker / docker/secrets-engine

Crashed launched plugins are difficult to debug

Open
#162 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.