mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
#### Description Support using Windows named pipes as a transport in confignet. The implementation uses https://github.com/microsoft/go-winio/. #### Link to tracking issue Fixes https://github.com/open-telemetry/opentelemetry-collector/issues/15085 #### Testing Added unit tests covering the new transport. There's also a unit test for validating named path paths. #### Documentation Added the new value to the config schema and README. --------- Co-authored-by: Alex Boten <[email protected]>
35 lines
798 B
Go
35 lines
798 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
//go:build !windows
|
|
|
|
package confignet
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestNpipeDialUnsupported(t *testing.T) {
|
|
nac := &AddrConfig{
|
|
Endpoint: `\\.\pipe\test`,
|
|
Transport: TransportTypeNpipe,
|
|
}
|
|
_, err := nac.Dial(context.Background())
|
|
require.Error(t, err)
|
|
assert.Contains(t, err.Error(), "npipe transport is only supported on Windows")
|
|
}
|
|
|
|
func TestNpipeListenUnsupported(t *testing.T) {
|
|
nas := &AddrConfig{
|
|
Endpoint: `\\.\pipe\test`,
|
|
Transport: TransportTypeNpipe,
|
|
}
|
|
_, err := nas.Listen(context.Background())
|
|
require.Error(t, err)
|
|
assert.Contains(t, err.Error(), "npipe transport is only supported on Windows")
|
|
}
|