Skip to content

Commit

Permalink
Merge branch 'main' into fix-builder-test
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdandrutu authored Jan 6, 2025
2 parents 734e15e + b682d8e commit 713111e
Show file tree
Hide file tree
Showing 11 changed files with 78 additions and 99 deletions.
25 changes: 25 additions & 0 deletions .chloggen/dep-component-type.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: deprecation

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: receivertest

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecate receivertest.NewNopFactoryForType

# One or more tracking issues or pull requests related to the change
issues: [11993]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api]
12 changes: 10 additions & 2 deletions .github/workflows/build-and-test-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ permissions: read-all

jobs:
windows-unittest:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
os: [windows-2022, windows-2025]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -41,7 +45,11 @@ jobs:
run: make gotest

windows-service-test:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
os: [windows-2022, windows-2025]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down
7 changes: 0 additions & 7 deletions component/componenttest/obsreporttest.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ type TestTelemetry struct {
}

// CheckExporterTraces checks that for the current exported values for trace exporter metrics match given values.
// Note: SetupTelemetry must be called before this function.
func (tts *TestTelemetry) CheckExporterTraces(sentSpans, sendFailedSpans int64) error {
return checkExporterTraces(tts.reader, tts.id, sentSpans, sendFailedSpans)
}

// CheckExporterMetrics checks that for the current exported values for metrics exporter metrics match given values.
// Note: SetupTelemetry must be called before this function.
func (tts *TestTelemetry) CheckExporterMetrics(sentMetricsPoints, sendFailedMetricsPoints int64) error {
return checkExporterMetrics(tts.reader, tts.id, sentMetricsPoints, sendFailedMetricsPoints)
}
Expand All @@ -64,7 +62,6 @@ func (tts *TestTelemetry) CheckExporterEnqueueFailedLogs(enqueueFailed int64) er
}

// CheckExporterLogs checks that for the current exported values for logs exporter metrics match given values.
// Note: SetupTelemetry must be called before this function.
func (tts *TestTelemetry) CheckExporterLogs(sentLogRecords, sendFailedLogRecords int64) error {
return checkExporterLogs(tts.reader, tts.id, sentLogRecords, sendFailedLogRecords)
}
Expand All @@ -75,25 +72,21 @@ func (tts *TestTelemetry) CheckExporterMetricGauge(metric string, val int64, ext
}

// CheckReceiverTraces checks that for the current exported values for trace receiver metrics match given values.
// Note: SetupTelemetry must be called before this function.
func (tts *TestTelemetry) CheckReceiverTraces(protocol string, acceptedSpans, droppedSpans int64) error {
return checkReceiverTraces(tts.reader, tts.id, protocol, acceptedSpans, droppedSpans)
}

// CheckReceiverLogs checks that for the current exported values for logs receiver metrics match given values.
// Note: SetupTelemetry must be called before this function.
func (tts *TestTelemetry) CheckReceiverLogs(protocol string, acceptedLogRecords, droppedLogRecords int64) error {
return checkReceiverLogs(tts.reader, tts.id, protocol, acceptedLogRecords, droppedLogRecords)
}

// CheckReceiverMetrics checks that for the current exported values for metrics receiver metrics match given values.
// Note: SetupTelemetry must be called before this function.
func (tts *TestTelemetry) CheckReceiverMetrics(protocol string, acceptedMetricPoints, droppedMetricPoints int64) error {
return checkReceiverMetrics(tts.reader, tts.id, protocol, acceptedMetricPoints, droppedMetricPoints)
}

// CheckScraperMetrics checks that for the current exported values for metrics scraper metrics match given values.
// Note: SetupTelemetry must be called before this function.
func (tts *TestTelemetry) CheckScraperMetrics(receiver component.ID, scraper component.ID, scrapedMetricPoints, erroredMetricPoints int64) error {
return checkScraperMetrics(tts.reader, receiver, scraper, scrapedMetricPoints, erroredMetricPoints)
}
Expand Down
44 changes: 7 additions & 37 deletions config/configgrpc/configgrpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,32 +92,23 @@ func TestNewDefaultServerConfig(t *testing.T) {
}

var (
componentID = component.MustNewID("component")
testAuthID = component.MustNewID("testauth")
mockID = component.MustNewID("mock")
doesntExistID = component.MustNewID("doesntexist")
)

func TestDefaultGrpcClientSettings(t *testing.T) {
tt, err := componenttest.SetupTelemetry(componentID)
require.NoError(t, err)
t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) })

gcs := &ClientConfig{
TLSSetting: configtls.ClientConfig{
Insecure: true,
},
}
opts, err := gcs.getGrpcDialOptions(context.Background(), componenttest.NewNopHost(), tt.TelemetrySettings(), []ToClientConnOption{})
opts, err := gcs.getGrpcDialOptions(context.Background(), componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings(), []ToClientConnOption{})
require.NoError(t, err)
assert.Len(t, opts, 2)
}

func TestGrpcClientExtraOption(t *testing.T) {
tt, err := componenttest.SetupTelemetry(componentID)
require.NoError(t, err)
t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) })

gcs := &ClientConfig{
TLSSetting: configtls.ClientConfig{
Insecure: true,
Expand All @@ -127,7 +118,7 @@ func TestGrpcClientExtraOption(t *testing.T) {
opts, err := gcs.getGrpcDialOptions(
context.Background(),
componenttest.NewNopHost(),
tt.TelemetrySettings(),
componenttest.NewNopTelemetrySettings(),
[]ToClientConnOption{WithGrpcDialOption(extraOpt)},
)
require.NoError(t, err)
Expand All @@ -136,10 +127,6 @@ func TestGrpcClientExtraOption(t *testing.T) {
}

func TestAllGrpcClientSettings(t *testing.T) {
tt, err := componenttest.SetupTelemetry(componentID)
require.NoError(t, err)
t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) })

tests := []struct {
settings ClientConfig
name string
Expand Down Expand Up @@ -235,7 +222,7 @@ func TestAllGrpcClientSettings(t *testing.T) {
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
opts, err := test.settings.getGrpcDialOptions(context.Background(), test.host, tt.TelemetrySettings(), []ToClientConnOption{})
opts, err := test.settings.getGrpcDialOptions(context.Background(), test.host, componenttest.NewNopTelemetrySettings(), []ToClientConnOption{})
require.NoError(t, err)
assert.Len(t, opts, 9)
})
Expand Down Expand Up @@ -496,18 +483,14 @@ func TestGRPCClientSettingsError(t *testing.T) {
}

func TestUseSecure(t *testing.T) {
tt, err := componenttest.SetupTelemetry(componentID)
require.NoError(t, err)
t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) })

gcs := &ClientConfig{
Headers: nil,
Endpoint: "",
Compression: "",
TLSSetting: configtls.ClientConfig{},
Keepalive: nil,
}
dialOpts, err := gcs.getGrpcDialOptions(context.Background(), componenttest.NewNopHost(), tt.TelemetrySettings(), []ToClientConnOption{})
dialOpts, err := gcs.getGrpcDialOptions(context.Background(), componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings(), []ToClientConnOption{})
require.NoError(t, err)
assert.Len(t, dialOpts, 2)
}
Expand Down Expand Up @@ -578,10 +561,6 @@ func TestGRPCServerSettings_ToListener_Error(t *testing.T) {
}

func TestHttpReception(t *testing.T) {
tt, err := componenttest.SetupTelemetry(componentID)
require.NoError(t, err)
t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) })

tests := []struct {
name string
tlsServerCreds *configtls.ServerConfig
Expand Down Expand Up @@ -709,7 +688,7 @@ func TestHttpReception(t *testing.T) {
Endpoint: ln.Addr().String(),
TLSSetting: *test.tlsClientCreds,
}
grpcClientConn, errClient := gcs.ToClientConn(context.Background(), componenttest.NewNopHost(), tt.TelemetrySettings())
grpcClientConn, errClient := gcs.ToClientConn(context.Background(), componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings())
require.NoError(t, errClient)
defer func() { assert.NoError(t, grpcClientConn.Close()) }()
c := ptraceotlp.NewGRPCClient(grpcClientConn)
Expand All @@ -731,9 +710,6 @@ func TestReceiveOnUnixDomainSocket(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("skipping test on windows")
}
tt, err := componenttest.SetupTelemetry(componentID)
require.NoError(t, err)
t.Cleanup(func() { require.NoError(t, tt.Shutdown(context.Background())) })

socketName := tempSocketName(t)
gss := &ServerConfig{
Expand All @@ -758,7 +734,7 @@ func TestReceiveOnUnixDomainSocket(t *testing.T) {
Insecure: true,
},
}
grpcClientConn, errClient := gcs.ToClientConn(context.Background(), componenttest.NewNopHost(), tt.TelemetrySettings())
grpcClientConn, errClient := gcs.ToClientConn(context.Background(), componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings())
require.NoError(t, errClient)
defer func() { assert.NoError(t, grpcClientConn.Close()) }()
c := ptraceotlp.NewGRPCClient(grpcClientConn)
Expand Down Expand Up @@ -961,13 +937,7 @@ func TestClientInfoInterceptors(t *testing.T) {
},
}

tel, err := componenttest.SetupTelemetry(componentID)
require.NoError(t, err)
defer func() {
require.NoError(t, tel.Shutdown(context.Background()))
}()

grpcClientConn, errClient := gcs.ToClientConn(context.Background(), componenttest.NewNopHost(), tel.TelemetrySettings())
grpcClientConn, errClient := gcs.ToClientConn(context.Background(), componenttest.NewNopHost(), componenttest.NewNopTelemetrySettings())
require.NoError(t, errClient)
defer func() { assert.NoError(t, grpcClientConn.Close()) }()

Expand Down
16 changes: 8 additions & 8 deletions internal/tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ toolchain go1.23.2
require (
github.com/a8m/envsubst v1.4.2
github.com/client9/misspell v0.3.4
github.com/golangci/golangci-lint v1.63.3
github.com/golangci/golangci-lint v1.63.4
github.com/google/addlicense v1.1.1
github.com/jcchavezs/porto v0.7.0
github.com/pavius/impi v0.0.3
go.opentelemetry.io/build-tools/checkfile v0.15.0
go.opentelemetry.io/build-tools/chloggen v0.15.0
go.opentelemetry.io/build-tools/crosslink v0.15.0
go.opentelemetry.io/build-tools/multimod v0.15.0
go.opentelemetry.io/build-tools/multimod v0.15.1-0.20250105162204-3f22feb044ba
go.opentelemetry.io/build-tools/semconvgen v0.15.0
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
golang.org/x/tools v0.28.0
Expand All @@ -39,7 +39,7 @@ require (
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/ProtonMail/go-crypto v1.1.3 // indirect
github.com/alecthomas/go-check-sumtype v0.3.1 // indirect
github.com/alexkohler/nakedret/v2 v2.0.5 // indirect
github.com/alexkohler/prealloc v1.0.0 // indirect
Expand All @@ -65,7 +65,7 @@ require (
github.com/ckaznocha/intrange v0.3.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/curioswitch/go-reassign v0.3.0 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/cyphar/filepath-securejoin v0.3.6 // indirect
github.com/daixiang0/gci v0.13.5 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/denis-tingaikin/go-header v0.5.0 // indirect
Expand All @@ -80,8 +80,8 @@ require (
github.com/ghostiam/protogetter v0.3.8 // indirect
github.com/go-critic/go-critic v0.11.5 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-git/go-git/v5 v5.12.0 // indirect
github.com/go-git/go-billy/v5 v5.6.1 // indirect
github.com/go-git/go-git/v5 v5.13.1 // indirect
github.com/go-toolsmith/astcast v1.1.0 // indirect
github.com/go-toolsmith/astcopy v1.1.0 // indirect
github.com/go-toolsmith/astequal v1.2.0 // indirect
Expand Down Expand Up @@ -181,7 +181,7 @@ require (
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/sivchari/containedctx v1.0.3 // indirect
github.com/sivchari/tenv v1.12.1 // indirect
github.com/skeema/knownhosts v1.2.2 // indirect
github.com/skeema/knownhosts v1.3.0 // indirect
github.com/sonatard/noctx v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/sourcegraph/go-diff v0.7.0 // indirect
Expand Down Expand Up @@ -222,7 +222,7 @@ require (
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/telemetry v0.0.0-20240522233618-39ace7a40ae7 // indirect
golang.org/x/term v0.27.0 // indirect
golang.org/x/text v0.21.0 // indirect
Expand Down
Loading

0 comments on commit 713111e

Please sign in to comment.