Skip to content

Commit

Permalink
remove resource_metrics, fully move to upstream testing
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed Jan 16, 2025
1 parent c3e6a70 commit 1ff724b
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 413 deletions.
51 changes: 1 addition & 50 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ provides a set of integration tests and associated utilities. The general testi
is:

1. Building the Collector (`make otelcol` or `make all`)
1. Defining your expected [resource metric content](./testutils/README.md#resource-metrics) as a yaml file
([see example](testutils/telemetry/testdata/metrics/resource-metrics.yaml))
1. Defining [your expected golden file content as a yaml file](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/golden)
1. Spin up your target resources as [docker containers](./testutils/README.md#test-containers).
1. Stand up an in-memory [OTLP metrics receiver and sink](./testutils/README.md#otlp-metrics-receiver-sink) capable of detecting if/when desired data are received.
1. Spin up your Collector [as a subprocess](./testutils/README.md#collector-process) or [as a container](./testutils/README.md#collector-container) configured to report to this OTLP receiver.
Expand All @@ -17,51 +16,3 @@ is more useful overall.
**NOTE** At this time, integration tests generally target collector containers (`SPLUNK_OTEL_COLLECTOR_IMAGE` env var),
and test coverage for the subprocess is best effort only, unless the test cases explicitly maintain one.
The collector process targets are generally for test development without requiring frequent rebuilds of a local docker image.

```go
package example_test

import (
"context"
"path/filepath"
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/signalfx/splunk-otel-collector/tests/testutils"
"github.com/signalfx/splunk-otel-collector/tests/testutils/telemetry"
)

func TestMyExampleComponent(t *testing.T) {
expectedResourceMetrics, err := telemetry.LoadResourceMetrics(
filepath.Join(".", "testdata", "metrics", "my_resource_metrics.yaml"),
)
require.NoError(t, err)
require.NotNil(t, expectedResourceMetrics)

// combination OTLP Receiver, consumertests.MetricsSink, and consumertests.LogsSink
otlp, err := testutils.NewOTLPReceiverSink().WithEndpoint("localhost:23456").Build()
require.NoError(t, err)
require.NoError(t, otlp.Start())

defer func() {
require.NoError(t, otlp.Shutdown())
}()

myContainer := testutils.NewContainer().WithImage("someTarget").Build()
err = myContainer.Start(context.Background())
require.NoError(t, err)

// running collector subprocess that uses the provided config set to export OTLP to our test receiver
myCollector, err := testutils.NewCollectorProcess().WithConfigPath(filepath.Join(".", "testdata", "config.yaml")).Build()
require.NoError(t, err)
err = myCollector.Start()
require.NoError(t, err)
defer func() {
require.NoError(t, myCollector.Shutdown() )
}()

require.NoError(t, otlp.AssertAllMetricsReceived(t, *expectedResourceMetrics, 30*time.Second))
}
```
2 changes: 0 additions & 2 deletions tests/general/container_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func TestSpecifiedContainerConfigDefaultsToCmdLineArgIfEnvVarConflict(t *testing
return false
}
receivedOTLPMetrics := tc.OTLPReceiverSink.AllMetrics()
tc.OTLPReceiverSink.Reset()

for _, rom := range receivedOTLPMetrics {
for i := 0; i < rom.ResourceMetrics().Len(); i++ {
Expand Down Expand Up @@ -189,7 +188,6 @@ service:
return false
}
receivedOTLPMetrics := tc.OTLPReceiverSink.AllMetrics()
tc.OTLPReceiverSink.Reset()

for _, rom := range receivedOTLPMetrics {
for i := 0; i < rom.ResourceMetrics().Len(); i++ {
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion tests/general/dry_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ service:
return false
}
receivedOTLPMetrics := tc.OTLPReceiverSink.AllMetrics()
tc.OTLPReceiverSink.Reset()

for _, rom := range receivedOTLPMetrics {
for i := 0; i < rom.ResourceMetrics().Len(); i++ {
Expand Down
18 changes: 4 additions & 14 deletions tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,16 @@ require (
github.com/docker/go-connections v0.5.0
github.com/go-sql-driver/mysql v1.8.1
github.com/google/uuid v1.6.0
github.com/knadh/koanf v1.5.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.117.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.117.0
github.com/shirou/gopsutil/v3 v3.24.5
github.com/stretchr/testify v1.10.0
github.com/testcontainers/testcontainers-go v0.35.0
go.opentelemetry.io/collector/component v0.117.0
go.opentelemetry.io/collector/component/componenttest v0.117.0
go.opentelemetry.io/collector/config/configgrpc v0.117.0
go.opentelemetry.io/collector/config/confignet v1.23.0
go.opentelemetry.io/collector/config/configtls v1.23.0
go.opentelemetry.io/collector/confmap v1.23.0
go.opentelemetry.io/collector/consumer/consumertest v0.117.0
go.opentelemetry.io/collector/exporter v0.117.0
go.opentelemetry.io/collector/exporter/otlpexporter v0.117.0
go.opentelemetry.io/collector/pdata v1.23.0
go.opentelemetry.io/collector/receiver v0.117.0
go.opentelemetry.io/collector/receiver/otlpreceiver v0.117.0
Expand All @@ -35,7 +30,6 @@ require (
golang.org/x/exp v0.0.0-20230711023510-fffb14384f22
golang.org/x/sys v0.29.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
)

require (
Expand All @@ -60,9 +54,9 @@ require (
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.17.11 // indirect
github.com/knadh/koanf v1.5.0 // indirect
github.com/knadh/koanf/v2 v2.1.2 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
Expand Down Expand Up @@ -96,24 +90,19 @@ require (
go.opentelemetry.io/collector/component/componentstatus v0.117.0 // indirect
go.opentelemetry.io/collector/config/configauth v0.117.0 // indirect
go.opentelemetry.io/collector/config/configcompression v1.23.0 // indirect
go.opentelemetry.io/collector/config/configgrpc v0.117.0 // indirect
go.opentelemetry.io/collector/config/confighttp v0.117.0 // indirect
go.opentelemetry.io/collector/config/configopaque v1.23.0 // indirect
go.opentelemetry.io/collector/config/configretry v1.23.0 // indirect
go.opentelemetry.io/collector/config/configtelemetry v0.117.0 // indirect
go.opentelemetry.io/collector/config/configtls v1.23.0 // indirect
go.opentelemetry.io/collector/consumer v1.23.0 // indirect
go.opentelemetry.io/collector/consumer/consumererror v0.117.0 // indirect
go.opentelemetry.io/collector/consumer/consumererror/xconsumererror v0.117.0 // indirect
go.opentelemetry.io/collector/consumer/xconsumer v0.117.0 // indirect
go.opentelemetry.io/collector/exporter/exporterhelper/xexporterhelper v0.117.0 // indirect
go.opentelemetry.io/collector/exporter/xexporter v0.117.0 // indirect
go.opentelemetry.io/collector/extension v0.117.0 // indirect
go.opentelemetry.io/collector/extension/auth v0.117.0 // indirect
go.opentelemetry.io/collector/extension/xextension v0.117.0 // indirect
go.opentelemetry.io/collector/featuregate v1.23.0 // indirect
go.opentelemetry.io/collector/internal/sharedcomponent v0.117.0 // indirect
go.opentelemetry.io/collector/pdata/pprofile v0.117.0 // indirect
go.opentelemetry.io/collector/pipeline v0.117.0 // indirect
go.opentelemetry.io/collector/pipeline/xpipeline v0.117.0 // indirect
go.opentelemetry.io/collector/receiver/xreceiver v0.117.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.56.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect
Expand All @@ -130,4 +119,5 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20241104194629-dd2ea8efbc28 // indirect
google.golang.org/grpc v1.69.2 // indirect
google.golang.org/protobuf v1.36.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
24 changes: 0 additions & 24 deletions tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdv
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
Expand Down Expand Up @@ -379,8 +377,6 @@ go.opentelemetry.io/collector/config/confignet v1.23.0 h1:gq90GDgQFSjAeFkDeIkstk
go.opentelemetry.io/collector/config/confignet v1.23.0/go.mod h1:ZppUH1hgUJOubawEsxsQ9MzEYFytqo2GnVSS7d4CVxc=
go.opentelemetry.io/collector/config/configopaque v1.23.0 h1:SEnEzOHufGc4KGOjQq8zKIQuDBmRFl9ncZ3qs1SRpJk=
go.opentelemetry.io/collector/config/configopaque v1.23.0/go.mod h1:sW0t0iI/VfRL9VYX7Ik6XzVgPcR+Y5kejTLsYcMyDWs=
go.opentelemetry.io/collector/config/configretry v1.23.0 h1:0Ox2KvTZyNdgureAs3kJzsNIa6ttrx9bwlKjj/p4fGU=
go.opentelemetry.io/collector/config/configretry v1.23.0/go.mod h1:cleBc9I0DIWpTiiHfu9v83FUaCTqcPXmebpLxjEIqro=
go.opentelemetry.io/collector/config/configtelemetry v0.117.0 h1:xsMfc89VByIF2fJzWuxs/2eqy44DWfNBAysReG4TAr8=
go.opentelemetry.io/collector/config/configtelemetry v0.117.0/go.mod h1:SlBEwQg0qly75rXZ6W1Ig8jN25KBVBkFIIAUI1GiAAE=
go.opentelemetry.io/collector/config/configtls v1.23.0 h1:52q9dAV923hHn1aoYQyKGnrRXCPvTTT3DXurtxcpZaQ=
Expand All @@ -391,34 +387,16 @@ go.opentelemetry.io/collector/consumer v1.23.0 h1:JT0nE1vikL5yIk97IHBGzwx8co3w1W
go.opentelemetry.io/collector/consumer v1.23.0/go.mod h1:8d0uQ6gq64LbPktV4sc888lRj1cQCmrdl13hRIEURgA=
go.opentelemetry.io/collector/consumer/consumererror v0.117.0 h1:PPIZCcYZcENnyIrpRV4ERvMUoPSTV0zIP0QPzJvz80g=
go.opentelemetry.io/collector/consumer/consumererror v0.117.0/go.mod h1:L47xOVC+Vzos8350j3SWtU43w7rzms6UDhb6IrFxymY=
go.opentelemetry.io/collector/consumer/consumererror/xconsumererror v0.117.0 h1:gT9VUzerc4rSRUDMEBQdrgBxbrpjinoa4Oxo5qlj6gw=
go.opentelemetry.io/collector/consumer/consumererror/xconsumererror v0.117.0/go.mod h1:AzJIPm65RpEeoQk8OuQ4HLT6QQPDNrWWKk8IEaNBiIQ=
go.opentelemetry.io/collector/consumer/consumertest v0.117.0 h1:9WFyyjLudvfJDEuUaGsQyNRd1m6D1iRg8Iyg3xliFko=
go.opentelemetry.io/collector/consumer/consumertest v0.117.0/go.mod h1:B7A+OS76QKAzM8W7cmvlfVynFELj9Sa444hSm1SILFw=
go.opentelemetry.io/collector/consumer/xconsumer v0.117.0 h1:vsBNJGaEbYqgMU3PEsOcqjMxX5ul++Cxda44sttoi8c=
go.opentelemetry.io/collector/consumer/xconsumer v0.117.0/go.mod h1:dTr+Tms53lRLvR3OAzYic0yhcwldhTUdVIwJNSDmBmw=
go.opentelemetry.io/collector/exporter v0.117.0 h1:A9kVXzdb8i1eFELImuaSPyijAfg4qMIpM/4y/98mlxk=
go.opentelemetry.io/collector/exporter v0.117.0/go.mod h1:Cbrorch2s18w1X7+A+zXQtAffbInnIOP7Su26gbRG+k=
go.opentelemetry.io/collector/exporter/exporterhelper/xexporterhelper v0.117.0 h1:1e991aHPgSvWFMOFFir40HANg2SkXcrkG4AlRvK2+KI=
go.opentelemetry.io/collector/exporter/exporterhelper/xexporterhelper v0.117.0/go.mod h1:TkPEGX28zDvGAqlJRZQhKohG+82iN2lWPjF+dTuzS9Q=
go.opentelemetry.io/collector/exporter/exportertest v0.117.0 h1:u+loeqxpniMiJL1iqc/lCCcfniWrqHBgJTAjXfqVBqQ=
go.opentelemetry.io/collector/exporter/exportertest v0.117.0/go.mod h1:GyHwJLsOPPau0m+TYrIA7jWD9/GU+ID+l/9sL0cAqhE=
go.opentelemetry.io/collector/exporter/otlpexporter v0.117.0 h1:A/qDjii7WN2Wdx+gtdLvSVpPu8to6ogVutxIggNBEio=
go.opentelemetry.io/collector/exporter/otlpexporter v0.117.0/go.mod h1:rW4Re7GGCPB4JwZoZjXaPqJ77GEIr8OjTz5YK59avJM=
go.opentelemetry.io/collector/exporter/xexporter v0.117.0 h1:BB8D0Dvb46CVAZrnPEg5nYgXO7LzONmXeGKEfzSIOZs=
go.opentelemetry.io/collector/exporter/xexporter v0.117.0/go.mod h1:yo0T8WkvLCJ7NOqIquHGFe4Xpuc4CbDb8a06T2G5De4=
go.opentelemetry.io/collector/extension v0.117.0 h1:B3cG7g+wbhmpMFugaDxOcyiPKeulaW8+EQdJbZxDfho=
go.opentelemetry.io/collector/extension v0.117.0/go.mod h1:WjyD5h9N5Y0SF8azB2rulvHJieJoWqroGO5hi3ax5+8=
go.opentelemetry.io/collector/extension/auth v0.117.0 h1:tXQdYIdcABXalWyFZP22pREY7+nWUNurx8Y6FseWs7w=
go.opentelemetry.io/collector/extension/auth v0.117.0/go.mod h1:ofrV2BuE46+k7Su/h0ccrMl5Zk5Y7NVlzOb3AwU7Dzw=
go.opentelemetry.io/collector/extension/auth/authtest v0.117.0 h1:wV4OIiWrt7gteQrxL8MCmGvjGhMiu5TplKJHOfVZO6Y=
go.opentelemetry.io/collector/extension/auth/authtest v0.117.0/go.mod h1:nHxcAOyo26JnuYwKIoQM9mDlSXpERQrbjIw3Dtp9hug=
go.opentelemetry.io/collector/extension/extensiontest v0.117.0 h1:XH+tkHdATylYZtASZKK3rCoN/xlaFi8MXLh07ZlQQWw=
go.opentelemetry.io/collector/extension/extensiontest v0.117.0/go.mod h1:ABqB9D41p4MCeGVmABOgJi7i7roWZlFbqeFJDy7lskQ=
go.opentelemetry.io/collector/extension/xextension v0.117.0 h1:ADUKWHGaVvvmebJHiNRuX6YAfQXFDW/UaXK9W1hCo1k=
go.opentelemetry.io/collector/extension/xextension v0.117.0/go.mod h1:BmR8xN7Ja+El4IJ9aVmtON2miudjsbq2COZ9azVXsNg=
go.opentelemetry.io/collector/featuregate v1.23.0 h1:N033ROo85qKrsK16QzR6RV+3UWOWF7kpOO8FSnX99s0=
go.opentelemetry.io/collector/featuregate v1.23.0/go.mod h1:3GaXqflNDVwWndNGBJ1+XJFy3Fv/XrFgjMN60N3z7yg=
go.opentelemetry.io/collector/internal/sharedcomponent v0.117.0 h1:mk+qZO2HpNny3FuYeb4mjL4mbrEfkJN5untocHA8AqM=
go.opentelemetry.io/collector/internal/sharedcomponent v0.117.0/go.mod h1:Hlzn5+54tgYchP3OJz/YMnrbMNHX8PggDpZFlDTB2kQ=
go.opentelemetry.io/collector/pdata v1.23.0 h1:tEk0dkfB8RdSukoOMfEa8duB938gfZowdfRkrJxGDrw=
Expand All @@ -429,8 +407,6 @@ go.opentelemetry.io/collector/pdata/testdata v0.117.0 h1:ainpacShKHaDkPK6lcvgJ0a
go.opentelemetry.io/collector/pdata/testdata v0.117.0/go.mod h1:LZAymmRKHQEqJqJUSO15rej3+V1rNRyBMF5mWCKCMBY=
go.opentelemetry.io/collector/pipeline v0.117.0 h1:CSv0Dd3n9AQNQ73e7PdEkgexkSMRZliKATxkoZKUFcY=
go.opentelemetry.io/collector/pipeline v0.117.0/go.mod h1:qE3DmoB05AW0C3lmPvdxZqd/H4po84NPzd5MrqgtL74=
go.opentelemetry.io/collector/pipeline/xpipeline v0.117.0 h1:jnHQNaNfVRIdrtOPCORUy8s1cEJyxql3uv/WQ1ve1Js=
go.opentelemetry.io/collector/pipeline/xpipeline v0.117.0/go.mod h1:lNY3uQjRcb3f7CW1JQMXJcWzCJp5122LOKrKs5eito8=
go.opentelemetry.io/collector/receiver v0.117.0 h1:jm+b2G2IKKwGE213lB9cviKEdeATvYtNSY1kO0XdpMM=
go.opentelemetry.io/collector/receiver v0.117.0/go.mod h1:fZXigB3afp54OE+ogPcup/RPwI7j+CwZh9Mz6ObB/Cg=
go.opentelemetry.io/collector/receiver/otlpreceiver v0.117.0 h1:Ezv4K3TGcQ5sd6lj0QsemjUeO+5RTnSsfodfPyjHo2o=
Expand Down
12 changes: 0 additions & 12 deletions tests/receivers/scriptedinputs/script_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func TestScriptReceiverCpu(t *testing.T) {
return
}
receivedOTLPLogs := tc.OTLPReceiverSink.AllLogs()
tc.OTLPReceiverSink.Reset()

lr := receivedOTLPLogs[0].ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0)
assert.Regexp(tt, regexp.MustCompile("CPU\\s+pctUser\\s+pctNice\\s+pctSystem\\s+pctIowait\\s+pctIdle\\nall(\\s*\\d{1,3}.\\d{1,3}){5}\\n0(\\s*\\d{1,3}.\\d{1,3}){5}"), lr.Body().Str())
Expand All @@ -62,7 +61,6 @@ func TestScriptReceiverDf(t *testing.T) {
return
}
receivedOTLPLogs := tc.OTLPReceiverSink.AllLogs()
tc.OTLPReceiverSink.Reset()

lr := receivedOTLPLogs[0].ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0)
fmt.Printf("Received log entry - \n%s", lr.Body().Str())
Expand All @@ -84,7 +82,6 @@ func TestScriptReceiverHardware(t *testing.T) {
return
}
receivedOTLPLogs := tc.OTLPReceiverSink.AllLogs()
tc.OTLPReceiverSink.Reset()

lr := receivedOTLPLogs[0].ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0)
assert.Regexp(tt, regexp.MustCompile("KEY\\s+VALUE"), lr.Body().Str())
Expand All @@ -105,7 +102,6 @@ func TestScriptReceiverInterfaces(t *testing.T) {
return
}
receivedOTLPLogs := tc.OTLPReceiverSink.AllLogs()
tc.OTLPReceiverSink.Reset()

lr := receivedOTLPLogs[0].ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0)
assert.Regexp(tt, regexp.MustCompile("Name\\s+MAC\\s+inetAddr\\s+inet6Addr\\s+Collisions\\s+RXbytes\\s+RXerrors\\s+RXdropped\\s+TXbytes\\s+TXerrors\\s+TXdropped\\s+Speed\\s+Duplex"), lr.Body().Str())
Expand All @@ -126,7 +122,6 @@ func TestScriptReceiverIostat(t *testing.T) {
return
}
receivedOTLPLogs := tc.OTLPReceiverSink.AllLogs()
tc.OTLPReceiverSink.Reset()

lr := receivedOTLPLogs[0].ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0)
assert.Regexp(tt, regexp.MustCompile("Device\\s+r/s\\s+rkB/s\\s+rrqm/s\\s+%rrqm\\s+r_await\\s+rareq-sz\\s+w/s\\s+wkB/s\\s+wrqm/s\\s+%wrqm\\s+w_await\\s+wareq-sz\\s+d/s\\s+dkB/s\\s+drqm/s\\s+%drqm\\s+d_await\\s+dareq-sz\\s+(f/s\\s+)?(f_await\\s+)?aqu-sz\\s+%util"), lr.Body().Str())
Expand All @@ -147,7 +142,6 @@ func TestScriptReceiverLsof(t *testing.T) {
return
}
receivedOTLPLogs := tc.OTLPReceiverSink.AllLogs()
tc.OTLPReceiverSink.Reset()

lr := receivedOTLPLogs[0].ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0)
assert.Regexp(tt, regexp.MustCompile("COMMAND\\s+PID\\s+USER\\s+FD\\s+TYPE\\s+DEVICE\\s+SIZE\\s+NODE\\s+NAME"), lr.Body().Str())
Expand All @@ -168,7 +162,6 @@ func TestScriptReceiverNetstat(t *testing.T) {
return
}
receivedOTLPLogs := tc.OTLPReceiverSink.AllLogs()
tc.OTLPReceiverSink.Reset()

lr := receivedOTLPLogs[0].ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0)
assert.Regexp(tt, regexp.MustCompile("Proto\\s+Recv-Q\\s+Send-Q\\s+LocalAddress\\s+ForeignAddress\\s+State"), lr.Body().Str())
Expand All @@ -189,7 +182,6 @@ func TestScriptReceiverOpenPorts(t *testing.T) {
return
}
receivedOTLPLogs := tc.OTLPReceiverSink.AllLogs()
tc.OTLPReceiverSink.Reset()

lr := receivedOTLPLogs[0].ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0)
assert.Regexp(tt, regexp.MustCompile("Proto\\s+Port"), lr.Body().Str())
Expand All @@ -210,7 +202,6 @@ func TestScriptReceiverPackage(t *testing.T) {
return
}
receivedOTLPLogs := tc.OTLPReceiverSink.AllLogs()
tc.OTLPReceiverSink.Reset()

lr := receivedOTLPLogs[0].ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0)
assert.Regexp(tt, regexp.MustCompile("NAME\\s+VERSION\\s+RELEASE\\s+ARCH\\s+VENDOR\\s+GROUP"), lr.Body().Str())
Expand All @@ -231,7 +222,6 @@ func TestScriptReceiverProtocol(t *testing.T) {
return
}
receivedOTLPLogs := tc.OTLPReceiverSink.AllLogs()
tc.OTLPReceiverSink.Reset()

lr := receivedOTLPLogs[0].ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0)
assert.Regexp(tt, regexp.MustCompile("IPdropped\\s+TCPrexmits\\s+TCPreorder\\s+TCPpktRecv\\s+TCPpktSent\\s+UDPpktLost\\s+UDPunkPort\\s+UDPpktRecv\\s+UDPpktSent"), lr.Body().Str())
Expand All @@ -252,7 +242,6 @@ func TestScriptReceiverPs(t *testing.T) {
return
}
receivedOTLPLogs := tc.OTLPReceiverSink.AllLogs()
tc.OTLPReceiverSink.Reset()

lr := receivedOTLPLogs[0].ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0)
assert.Regexp(tt, regexp.MustCompile("USER\\s+PID\\s+%CPU\\s+%MEM\\s+VSZ\\s+RSS\\s+TTY\\s+STAT\\s+START\\s+TIME\\s+COMMAND\\s+ARGS"), lr.Body().Str())
Expand All @@ -273,7 +262,6 @@ func TestScriptReceiverTop(t *testing.T) {
return
}
receivedOTLPLogs := tc.OTLPReceiverSink.AllLogs()
tc.OTLPReceiverSink.Reset()

lr := receivedOTLPLogs[0].ResourceLogs().At(0).ScopeLogs().At(0).LogRecords().At(0)
assert.Regexp(tt, regexp.MustCompile("PID\\s+USER\\s+PR\\s+NI\\s+VIRT\\s+RES\\s+SHR\\s+S\\s+pctCPU\\s+pctMEM\\s+cpuTIME\\s+COMMAND"), lr.Body().Str())
Expand Down
Loading

0 comments on commit 1ff724b

Please sign in to comment.