Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add test for istio metrics #1657

Merged
merged 1 commit into from
Feb 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/functional_test_v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
- functional
- histogram
- configuration_switching
- istio
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ repos:
exclude: "^helm-charts|operator-webhook.yaml"
args: [ --allow-multiple-documents ]
- id: check-added-large-files
args: [ --maxkb=1500 ]
23 changes: 23 additions & 0 deletions functional_tests/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ package functional_tests

import (
"context"
"fmt"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/pdata/pmetric"
"go.opentelemetry.io/collector/pdata/ptrace"
"go.opentelemetry.io/collector/receiver/receivertest"
"os"
"path/filepath"
"runtime"
Expand All @@ -17,6 +21,7 @@ import (

"github.com/docker/docker/api/types"
docker "github.com/docker/docker/client"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

Expand Down Expand Up @@ -100,3 +105,21 @@ func writeNewExpectedMetricsResult(t *testing.T, file string, metric *pmetric.Me
require.NoError(t, os.MkdirAll("results", 0755))
require.NoError(t, golden.WriteMetrics(t, filepath.Join("results", filepath.Base(file)), *metric))
}

func setupSignalfxReceiver(t *testing.T, port int) *consumertest.MetricsSink {
mc := new(consumertest.MetricsSink)
f := signalfxreceiver.NewFactory()
cfg := f.CreateDefaultConfig().(*signalfxreceiver.Config)
cfg.Endpoint = fmt.Sprintf("0.0.0.0:%d", port)

rcvr, err := f.CreateMetrics(context.Background(), receivertest.NewNopSettings(), cfg, mc)
require.NoError(t, err)

require.NoError(t, rcvr.Start(context.Background(), componenttest.NewNopHost()))
require.NoError(t, err, "failed creating metrics receiver")
t.Cleanup(func() {
assert.NoError(t, rcvr.Shutdown(context.Background()))
})

return mc
}
19 changes: 0 additions & 19 deletions functional_tests/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest/pmetrictest"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest/ptracetest"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/splunkhecreceiver"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -1473,24 +1472,6 @@ func setupTraces(t *testing.T) *consumertest.TracesSink {
return tc
}

func setupSignalfxReceiver(t *testing.T, port int) *consumertest.MetricsSink {
mc := new(consumertest.MetricsSink)
f := signalfxreceiver.NewFactory()
cfg := f.CreateDefaultConfig().(*signalfxreceiver.Config)
cfg.Endpoint = fmt.Sprintf("0.0.0.0:%d", port)

rcvr, err := f.CreateMetrics(context.Background(), receivertest.NewNopSettings(), cfg, mc)
require.NoError(t, err)

require.NoError(t, rcvr.Start(context.Background(), componenttest.NewNopHost()))
require.NoError(t, err, "failed creating metrics receiver")
t.Cleanup(func() {
assert.NoError(t, rcvr.Shutdown(context.Background()))
})

return mc
}

func setupHEC(t *testing.T) (*consumertest.LogsSink, *consumertest.MetricsSink) {
// the splunkhecreceiver does poorly at receiving logs and metrics. Use separate ports for now.
f := splunkhecreceiver.NewFactory()
Expand Down
7 changes: 4 additions & 3 deletions functional_tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ go 1.22.0
toolchain go1.22.5

require (
github.com/docker/docker v27.3.1+incompatible
github.com/docker/docker v27.5.1+incompatible
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/open-telemetry/opentelemetry-collector-contrib/pkg/xk8stest v0.119.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver v0.117.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/splunkhecreceiver v0.115.0
github.com/stretchr/testify v1.10.0
Expand All @@ -25,6 +26,7 @@ require (
k8s.io/apiextensions-apiserver v0.31.3
k8s.io/apimachinery v0.31.3
k8s.io/client-go v0.31.3
sigs.k8s.io/yaml v1.4.0
)

require (
Expand Down Expand Up @@ -199,7 +201,7 @@ require (
golang.org/x/sys v0.29.0 // indirect
golang.org/x/term v0.28.0 // indirect
golang.org/x/text v0.21.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/time v0.4.0 // indirect
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
Expand All @@ -218,7 +220,6 @@ require (
sigs.k8s.io/kustomize/api v0.17.2 // indirect
sigs.k8s.io/kustomize/kyaml v0.17.1 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

// ambiguous import: found package cloud.google.com/go/compute/metadata in multiple modules
Expand Down
9 changes: 6 additions & 3 deletions functional_tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,8 @@ github.com/docker/cli v25.0.1+incompatible h1:mFpqnrS6Hsm3v1k7Wa/BO23oz0k121MTbT
github.com/docker/cli v25.0.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=
github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v27.3.1+incompatible h1:KttF0XoteNTicmUtBO0L2tP+J7FGRFTjaEF4k6WdhfI=
github.com/docker/docker v27.3.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v27.5.1+incompatible h1:4PYU5dnBYqRQi0294d1FBECqT9ECWeQAIfE8q4YnPY8=
github.com/docker/docker v27.5.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A=
github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0=
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
Expand Down Expand Up @@ -1124,6 +1124,8 @@ github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.117.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.117.0/go.mod h1:OGylX+Bp+urSNNGoI1XG7U6vaRDZk1wN/w6fHP1F7IY=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.117.0 h1:vHARTwGkDJV3Y3nVeQuJ4c7N19IkXXAK6aRB8beWJRw=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/signalfx v0.117.0/go.mod h1:bK0QUJnoCwWoU3Pu+3jSfR6yCqM+WgRNC/MOBEz6aC8=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/xk8stest v0.119.0 h1:ptDhiLTpUJY+NIq2FoERwipKcZbNW5m62Sd8VXzbt/g=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/xk8stest v0.119.0/go.mod h1:qAg6wgkUiX8Ue6cLLsZS//d5TvRPmj8j7ieJbtnpHgY=
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver v0.117.0 h1:ppbkkWk6o1r2Pktr45YOfqPWvQcyC71/9/cAUJ8a7Q4=
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/signalfxreceiver v0.117.0/go.mod h1:o0v6sN20f3CQE4cInrC6CKbBs1WH+kNEAnqLoPmpVwY=
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/splunkhecreceiver v0.115.0 h1:3BJLq6lX2P+RoJ0vSW7sAeGXFKbUw3m57EQ+g+mYnzQ=
Expand Down Expand Up @@ -1663,8 +1665,9 @@ golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.4.0 h1:Z81tqI5ddIoXDPvVQ7/7CC9TnLM7ubaFG2qXYd5BbYY=
golang.org/x/time v0.4.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
Expand Down
Loading
Loading