mirror of
https://github.com/turbot/steampipe.git
synced 2025-12-19 18:12:43 -05:00
* Unskip test demonstrating bug #4798: Nil pointer dereference in logReceiveError 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * Fix #4798: Add nil check to logReceiveError 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -71,6 +71,9 @@ func (m *PluginMessageServer) runMessageListener(stream sdkproto.WrapperPlugin_E
|
||||
}
|
||||
|
||||
func (m *PluginMessageServer) logReceiveError(err error, connection string) {
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
log.Printf("[TRACE] receive error for connection '%s': %v", connection, err)
|
||||
switch {
|
||||
case sdkgrpc.IsEOFError(err):
|
||||
|
||||
@@ -72,6 +72,19 @@ func TestPluginMessageServer_LogReceiveError(t *testing.T) {
|
||||
ms.logReceiveError(context.DeadlineExceeded, "test-connection")
|
||||
}
|
||||
|
||||
// TestPluginMessageServer_LogReceiveError_NilError tests that logReceiveError
|
||||
// handles nil error gracefully without panicking
|
||||
func TestPluginMessageServer_LogReceiveError_NilError(t *testing.T) {
|
||||
// Create a message server
|
||||
pm := &PluginManager{}
|
||||
server := &PluginMessageServer{
|
||||
pluginManager: pm,
|
||||
}
|
||||
|
||||
// This should not panic - calling logReceiveError with nil error
|
||||
server.logReceiveError(nil, "test-connection")
|
||||
}
|
||||
|
||||
// Test 5: Multiple Message Servers
|
||||
|
||||
func TestPluginManager_MultipleMessageServers(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user