mirror of
https://github.com/hanzoai/telemetry.git
synced 2026-10-30 20:01:49 +00:00
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description An attempt at splitting `extensionauth.Client` by protocol type. open-telemetry/opentelemetry-collector-contrib/pull/38451 removes usages of the `NewClient` and `NewServer` constructor --------- Co-authored-by: Jade Guiton <[email protected]>
30 lines
662 B
Go
30 lines
662 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package extensionauthtest
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"go.opentelemetry.io/collector/extension/extensionauth"
|
|
)
|
|
|
|
func TestNopClient(t *testing.T) {
|
|
client := NewNopClient()
|
|
|
|
httpClient, ok := client.(extensionauth.HTTPClient)
|
|
require.True(t, ok)
|
|
rt, err := httpClient.RoundTripper(nil)
|
|
require.NoError(t, err)
|
|
assert.Nil(t, rt)
|
|
|
|
grpcClient, ok := client.(extensionauth.GRPCClient)
|
|
require.True(t, ok)
|
|
grpcAuth, err := grpcClient.PerRPCCredentials()
|
|
require.NoError(t, err)
|
|
assert.Nil(t, grpcAuth)
|
|
}
|