You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've found that this test is flaking out sometimes. The cause appears to be when the plugin fails but doesn't print to stderr. The PluginConnection code formats the error differently depending on if it captured anything to stderr or not.
err=fmt.Errorf("could not connect to the %s plugin: %w: %s", c.key, err, stderr)
}
2022-06-29T15:21:33.5652721Z === RUN TestPlugins_CatchStderr
2022-06-29T15:21:33.5653045Z === RUN TestPlugins_CatchStderr/plugin_throws_an_error
2022-06-29T15:21:33.5653413Z pluggable_integration_test.go:59:
2022-06-29T15:21:33.5653859Z Error Trace: pluggable_integration_test.go:59
2022-06-29T15:21:33.5654210Z Error: Error message not equal:
2022-06-29T15:21:33.5655272Z expected: "could not connect to the secrets.testplugin.vault plugin: Unrecognized remote plugin message: \n\nThis usually means that the plugin is either invalid or simply\nneeds to be recompiled to support the latest protocol.: i am just test plugin. i don't function\n"
2022-06-29T15:21:33.5656209Z actual : "Unrecognized remote plugin message: \n\nThis usually means that the plugin is either invalid or simply\nneeds to be recompiled to support the latest protocol."
2022-06-29T15:21:33.5656791Z Test: TestPlugins_CatchStderr/plugin_throws_an_error
2022-06-29T15:21:33.5657399Z --- FAIL: TestPlugins_CatchStderr (0.76s)
2022-06-29T15:21:33.5657946Z --- FAIL: TestPlugins_CatchStderr/plugin_throws_an_error (0.03s)
I'm not sure why sometimes that test plugin outputs to stderr and sometimes it doesn't? I may just be confused though. 😅
The text was updated successfully, but these errors were encountered:
I think that there may be a race condition in go-plugins where we aren't guaranteed to have the plugin's error message written to the error buffer that we passed to the framework before it reads the bad message written by the plugin to stdout.
carolynvs
added a commit
to carolynvs/porter
that referenced
this issue
Jul 8, 2022
The cause of the inconsistent error message returned when connecting to
a plugin was that there is a bit of a race condition in the
hashicorp/go-plugin framework where messages written to the plugins
stderr may not be reported by the time the plugin framework rejects a
non-conformant message that the plugin wrote to stdout.
The result is that sometimes our code would get a chance to see the
erorr message that the plugin wrote, and sometimes we wouldn't.
I don't want to modify the plugin framework just make one of our tests
more reliable. So instead I have updated our test plugin so that it
waits a bit between writing to stderr and writing to stdout. Now we
reliably get both messages captured by go-plugins.
In addition, I made the error message returned by the plugin connection
consistent regardless of whether or not we were able to capture stderr
from the plugin.
Fixesgetporter#2213
Signed-off-by: Carolyn Van Slyck <me@carolynvanslyck.com>
I've found that this test is flaking out sometimes. The cause appears to be when the plugin fails but doesn't print to stderr. The PluginConnection code formats the error differently depending on if it captured anything to stderr or not.
porter/pkg/plugins/pluggable/connection.go
Lines 158 to 161 in 59c4a56
I'm not sure why sometimes that test plugin outputs to stderr and sometimes it doesn't? I may just be confused though. 😅
The text was updated successfully, but these errors were encountered: