fix output message value

Signed-off-by: George Jenkins <gvjenkins@gmail.com>
pull/31194/head
George Jenkins 3 weeks ago
parent e5b612626e
commit 2658a00863

@ -212,7 +212,7 @@ func (r *SubprocessPluginRuntime) runCLI(input *Input) (*Output, error) {
} }
return &Output{ return &Output{
Message: &schema.OutputMessageCLIV1{}, Message: schema.OutputMessageCLIV1{},
}, nil }, nil
} }

@ -85,7 +85,7 @@ func (r *SubprocessPluginRuntime) runGetter(input *Input) (*Output, error) {
} }
return &Output{ return &Output{
Message: &schema.OutputMessageGetterV1{ Message: schema.OutputMessageGetterV1{
Data: buf.Bytes(), Data: buf.Bytes(),
}, },
}, nil }, nil

@ -95,16 +95,16 @@ func TestConvertOptions(t *testing.T) {
assert.Equal(t, expected, opts) assert.Equal(t, expected, opts)
} }
type TestPlugin struct { type testPlugin struct {
t *testing.T t *testing.T
dir string dir string
} }
func (t *TestPlugin) Dir() string { func (t *testPlugin) Dir() string {
return t.dir return t.dir
} }
func (t *TestPlugin) Metadata() plugin.Metadata { func (t *testPlugin) Metadata() plugin.Metadata {
return plugin.Metadata{ return plugin.Metadata{
Name: "fake-plugin", Name: "fake-plugin",
Type: "cli/v1", Type: "cli/v1",
@ -121,22 +121,22 @@ func (t *TestPlugin) Metadata() plugin.Metadata {
} }
} }
func (t *TestPlugin) Invoke(_ context.Context, _ *plugin.Input) (*plugin.Output, error) { func (t *testPlugin) Invoke(_ context.Context, _ *plugin.Input) (*plugin.Output, error) {
// Simulate a plugin invocation // Simulate a plugin invocation
output := &plugin.Output{ output := &plugin.Output{
Message: &schema.OutputMessageGetterV1{ Message: schema.OutputMessageGetterV1{
Data: []byte("fake-plugin output"), Data: []byte("fake-plugin output"),
}, },
} }
return output, nil return output, nil
} }
var _ plugin.Plugin = (*TestPlugin)(nil) var _ plugin.Plugin = (*testPlugin)(nil)
func TestGetterPlugin(t *testing.T) { func TestGetterPlugin(t *testing.T) {
gp := getterPlugin{ gp := getterPlugin{
options: []Option{}, options: []Option{},
plg: &TestPlugin{t: t, dir: "fake/dir"}, plg: &testPlugin{t: t, dir: "fake/dir"},
} }
buf, err := gp.Get("test://example.com", WithTimeout(5*time.Second)) buf, err := gp.Get("test://example.com", WithTimeout(5*time.Second))

Loading…
Cancel
Save