Skip to content

Conversation

@tobert
Copy link
Owner

@tobert tobert commented Nov 11, 2025

Summary

Fixes the TLS gRPC test timeouts by properly configuring gRPC server credentials.

Problem

Two TLS-related gRPC tests were timing out:

  • minimum configuration (tls, no-verify, recording, grpc)
  • minimum configuration (tls, client cert auth, recording, grpc)

The root cause: gRPC requires TLS credentials to be configured in the server itself via grpc.Creds(), not just passed through a TLS listener. HTTP and gRPC handle TLS fundamentally differently.

Solution

Updated NewGrpcServer:

  • Added variadic grpc.ServerOption parameter for TLS and other configurations
  • Backwards compatible - existing calls work without changes

Updated NewServer:

  • Added optional *tls.Config parameter
  • Converts TLS config to grpc.Creds() for gRPC servers
  • HTTP servers unchanged (they use TLS listeners)

Updated test harness:

  • Passes TLS config to gRPC servers when ServerTLSEnabled is true
  • gRPC uses plain listener + server credentials
  • HTTP continues using TLS listener

Test Results

$ go test
PASS
ok  	github.com/tobert/otel-cli	1.019s

Both previously-failing TLS gRPC tests now pass! ✅

Breaking Changes

None - all changes are backwards compatible.

Fixes #17

Co-Authored-By: Claude [email protected]

Why: gRPC TLS tests were timing out because gRPC servers require TLS
credentials configured via grpc.Creds(), not just a TLS listener
Approach:
- Added variadic grpc.ServerOption to NewGrpcServer signature
- Updated NewServer to accept optional *tls.Config and convert to grpc.Creds()
- Modified test harness to pass TLS config to gRPC servers, use plain listeners
- HTTP servers continue using TLS listeners (different architecture)
Learned: gRPC and HTTP handle TLS differently - gRPC needs server credentials,
HTTP uses TLS at listener level
Next: Create PR, merge, then rebase logs branch

Fixes #17

Co-Authored-By: Claude <[email protected]>
Copilot AI review requested due to automatic review settings November 11, 2025 23:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes TLS support for gRPC servers by properly configuring server credentials. Previously, two TLS-related gRPC tests were timing out because gRPC requires TLS to be configured via grpc.Creds() rather than just using a TLS listener.

Key changes:

  • Modified NewGrpcServer to accept variadic grpc.ServerOption parameters for TLS and other configurations
  • Updated NewServer to accept optional *tls.Config and convert it to gRPC credentials for gRPC servers
  • Adjusted test harness to pass TLS config to gRPC servers and use plain listeners with server credentials

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
otlpserver/server.go Added optional TLS config parameter to NewServer and converts it to gRPC credentials for gRPC protocol
otlpserver/grpcserver.go Modified NewGrpcServer to accept variadic server options for TLS configuration
main_test.go Updated test harness to prepare TLS config upfront and pass it to gRPC servers while using TLS listener only for HTTP

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tobert tobert merged commit 7cfc3c1 into main Nov 11, 2025
1 check passed
@tobert tobert deleted the fix/tls-grpc-server-credentials branch November 11, 2025 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TLS gRPC tests timing out

2 participants