diff --git a/.golangci.yaml b/.golangci.yaml index 311096180..9275f569e 100644 --- a/.golangci.yaml +++ b/.golangci.yaml @@ -62,17 +62,9 @@ linters-settings: alias: kitk8s - pkg: github.com/kyma-project/telemetry-manager/test/testkit/kyma alias: kitkyma - - pkg: github.com/kyma-project/telemetry-manager/test/testkit/kyma/overrides - alias: kitovrr - - pkg: github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/log - alias: kitlogpipeline - - pkg: github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric - alias: kitmetricpipeline - - pkg: github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/trace - alias: kittracepipeline - - pkg: github.com/kyma-project/telemetry-manager/test/testkit/otlp/metrics + - pkg: github.com/kyma-project/telemetry-manager/test/testkit/otel/metrics alias: kitmetrics - - pkg: github.com/kyma-project/telemetry-manager/test/testkit/otlp/traces + - pkg: github.com/kyma-project/telemetry-manager/test/testkit/otel/traces alias: kittraces - pkg: github.com/kyma-project/telemetry-manager/webhook/logparser alias: logparserwebhook @@ -205,9 +197,9 @@ issues: - linters: [dupl] path: test/testkit/matchers/(log|metric|trace)_matchers.go - linters: [errcheck] - path: test/testkit/otlp/traces/traces.go + path: test/testkit/otel/traces/traces.go - linters: [dupl] - path: test/testkit/verifiers/(deployment|daemonset|metrics|traces).go + path: test/testkit/verifiers/(deployment|daemon_set|metrics|traces).go - linters: [dupl] path: main.go - linters: diff --git a/Makefile b/Makefile index 3a202d97f..f803cd42d 100644 --- a/Makefile +++ b/Makefile @@ -289,7 +289,7 @@ KUSTOMIZE_VERSION ?= v5.0.1 TABLE_GEN_VERSION ?= v0.0.0-20230523174756-3dae9f177ffd CONTROLLER_TOOLS_VERSION ?= v0.11.3 K3D_VERSION ?= v5.4.7 -GINKGO_VERSION ?= v2.14.0 +GINKGO_VERSION ?= v2.15.0 GORELEASER_VERSION ?= v1.23.0 GOLANGCI-LINT_VERSION ?= latest GO_TEST_COVERAGE_VERSION ?= v2.8.2 diff --git a/test/e2e/logs_annotation_test.go b/test/e2e/logs_annotation_test.go index a9dfb8915..1f2e6a740 100644 --- a/test/e2e/logs_annotation_test.go +++ b/test/e2e/logs_annotation_test.go @@ -11,10 +11,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - kitlogpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/log" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/log" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/mocks/logproducer" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/loggen" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -33,13 +32,13 @@ var _ = Describe("Logs Keep Annotations", Label("logs"), Ordered, func() { objs = append(objs, kitk8s.NewNamespace(mockNs).K8sObject()) mockBackend := backend.New(mockBackendName, mockNs, backend.SignalTypeLogs) - mockLogProducer := logproducer.New(logProducerName, mockNs). + mockLogProducer := loggen.New(logProducerName, mockNs). WithAnnotations(map[string]string{"release": "v1.0.0"}) objs = append(objs, mockBackend.K8sObjects()...) objs = append(objs, mockLogProducer.K8sObject(kitk8s.WithLabel("app", "logging-annotation-test"))) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - logPipeline := kitlogpipeline.NewPipeline(pipelineName). + logPipeline := kitk8s.NewLogPipeline(pipelineName). WithSecretKeyRef(mockBackend.HostSecretRef()). WithHTTPOutput(). KeepAnnotations(true). diff --git a/test/e2e/logs_basic_test.go b/test/e2e/logs_basic_test.go index 469a4bc96..68293c009 100644 --- a/test/e2e/logs_basic_test.go +++ b/test/e2e/logs_basic_test.go @@ -9,9 +9,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - kitlogpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/log" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/mocks/logproducer" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/loggen" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -29,12 +28,12 @@ var _ = Describe("Logs Basic", Label("logs"), Ordered, func() { objs = append(objs, kitk8s.NewNamespace(mockNs).K8sObject()) mockBackend := backend.New(mockBackendName, mockNs, backend.SignalTypeLogs, backend.WithPersistentHostSecret(isOperational())) - mockLogProducer := logproducer.New(logProducerName, mockNs) + mockLogProducer := loggen.New(logProducerName, mockNs) objs = append(objs, mockBackend.K8sObjects()...) objs = append(objs, mockLogProducer.K8sObject(kitk8s.WithLabel("app", "logging-test"))) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - logPipeline := kitlogpipeline.NewPipeline(pipelineName). + logPipeline := kitk8s.NewLogPipeline(pipelineName). WithSecretKeyRef(mockBackend.HostSecretRef()). WithHTTPOutput(). Persistent(isOperational()) diff --git a/test/e2e/logs_custom_output_test.go b/test/e2e/logs_custom_output_test.go index 2edf56042..5dba42fbd 100644 --- a/test/e2e/logs_custom_output_test.go +++ b/test/e2e/logs_custom_output_test.go @@ -9,9 +9,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - kitlogpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/log" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/mocks/logproducer" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/loggen" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -29,12 +28,12 @@ var _ = Describe("Logs Custom Output", Label("logs"), Ordered, func() { objs = append(objs, kitk8s.NewNamespace(mockNs).K8sObject()) mockBackend := backend.New(mockBackendName, mockNs, backend.SignalTypeLogs) - mockLogProducer := logproducer.New(logProducerName, mockNs) + mockLogProducer := loggen.New(logProducerName, mockNs) objs = append(objs, mockBackend.K8sObjects()...) objs = append(objs, mockLogProducer.K8sObject(kitk8s.WithLabel("app", "logging-test"))) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - logPipeline := kitlogpipeline.NewPipeline(pipelineName).WithCustomOutput(mockBackend.ExternalService.Host()) + logPipeline := kitk8s.NewLogPipeline(pipelineName).WithCustomOutput(mockBackend.ExternalService.Host()) objs = append(objs, logPipeline.K8sObject()) return objs diff --git a/test/e2e/logs_dedot_test.go b/test/e2e/logs_dedot_test.go index 901d79b5d..1e43c6fa7 100644 --- a/test/e2e/logs_dedot_test.go +++ b/test/e2e/logs_dedot_test.go @@ -11,10 +11,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - kitlogpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/log" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/log" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/mocks/logproducer" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/loggen" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -33,12 +32,12 @@ var _ = Describe("Logs Dedot", Label("logs"), Ordered, func() { objs = append(objs, kitk8s.NewNamespace(mockNs).K8sObject()) mockBackend := backend.New(mockBackendName, mockNs, backend.SignalTypeLogs) - mockLogProducer := logproducer.New(logProducerName, mockNs) + mockLogProducer := loggen.New(logProducerName, mockNs) objs = append(objs, mockBackend.K8sObjects()...) objs = append(objs, mockLogProducer.K8sObject(kitk8s.WithLabel("dedot.label", "logging-dedot-value"))) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - logPipeline := kitlogpipeline.NewPipeline(pipelineName). + logPipeline := kitk8s.NewLogPipeline(pipelineName). WithSecretKeyRef(mockBackend.HostSecretRef()). WithHTTPOutput(). WithIncludeContainers([]string{logProducerName}) diff --git a/test/e2e/logs_exclude_container_test.go b/test/e2e/logs_exclude_container_test.go index 7e76d781a..6a33cd8b7 100644 --- a/test/e2e/logs_exclude_container_test.go +++ b/test/e2e/logs_exclude_container_test.go @@ -11,10 +11,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - kitlogpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/log" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/log" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/mocks/logproducer" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/loggen" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -33,12 +32,12 @@ var _ = Describe("Logs Exclude Container", Label("logs"), Ordered, func() { objs = append(objs, kitk8s.NewNamespace(mockNs).K8sObject()) mockBackend := backend.New(mockBackendName, mockNs, backend.SignalTypeLogs) - mockLogProducer := logproducer.New(logProducerName, mockNs) + mockLogProducer := loggen.New(logProducerName, mockNs) objs = append(objs, mockBackend.K8sObjects()...) objs = append(objs, mockLogProducer.K8sObject(kitk8s.WithLabel("app", "logging-exclude-container"))) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - logPipeline := kitlogpipeline.NewPipeline(pipelineName). + logPipeline := kitk8s.NewLogPipeline(pipelineName). WithSecretKeyRef(mockBackend.HostSecretRef()). WithHTTPOutput(). WithExcludeContainers([]string{logProducerName}) diff --git a/test/e2e/logs_label_test.go b/test/e2e/logs_label_test.go index c1a977970..89fdec541 100644 --- a/test/e2e/logs_label_test.go +++ b/test/e2e/logs_label_test.go @@ -11,10 +11,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - kitlogpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/log" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/log" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/mocks/logproducer" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/loggen" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -33,13 +32,13 @@ var _ = Describe("Logs Drop Labels", Label("logs"), Ordered, func() { objs = append(objs, kitk8s.NewNamespace(mockNs).K8sObject()) mockBackend := backend.New(mockBackendName, mockNs, backend.SignalTypeLogs) - mockLogProducer := logproducer.New(logProducerName, mockNs). + mockLogProducer := loggen.New(logProducerName, mockNs). WithAnnotations(map[string]string{"release": "v1.0.0"}) objs = append(objs, mockBackend.K8sObjects()...) objs = append(objs, mockLogProducer.K8sObject(kitk8s.WithLabel("app", "logging-label-test"))) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - logPipeline := kitlogpipeline.NewPipeline(pipelineName). + logPipeline := kitk8s.NewLogPipeline(pipelineName). WithSecretKeyRef(mockBackend.HostSecretRef()). WithHTTPOutput(). KeepAnnotations(false). diff --git a/test/e2e/logs_mtls_test.go b/test/e2e/logs_mtls_test.go index db22c7dbf..204419e7c 100644 --- a/test/e2e/logs_mtls_test.go +++ b/test/e2e/logs_mtls_test.go @@ -9,9 +9,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - kitlogpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/log" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/mocks/logproducer" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/loggen" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -29,12 +28,12 @@ var _ = Describe("Logs mTLS", Label("logs"), Ordered, func() { objs = append(objs, kitk8s.NewNamespace(mockNs).K8sObject()) mockBackend := backend.New(mockBackendName, mockNs, backend.SignalTypeLogs, backend.WithTLS()) - mockLogProducer := logproducer.New(logProducerName, mockNs) + mockLogProducer := loggen.New(logProducerName, mockNs) objs = append(objs, mockBackend.K8sObjects()...) objs = append(objs, mockLogProducer.K8sObject(kitk8s.WithLabel("app", "logging-mtls-test"))) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - pipeline := kitlogpipeline.NewPipeline(pipelineName). + pipeline := kitk8s.NewLogPipeline(pipelineName). WithSecretKeyRef(mockBackend.HostSecretRef()). WithHTTPOutput(). WithTLS(mockBackend.TLSCerts) diff --git a/test/e2e/logs_parser_test.go b/test/e2e/logs_parser_test.go index 56c7506b9..87835139b 100644 --- a/test/e2e/logs_parser_test.go +++ b/test/e2e/logs_parser_test.go @@ -12,10 +12,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - kitlogpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/log" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/log" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/mocks/logproducer" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/loggen" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -34,13 +33,13 @@ var _ = Describe("Logs Parser", Label("logs"), Ordered, func() { objs = append(objs, kitk8s.NewNamespace(mockNs).K8sObject()) mockBackend := backend.New(mockBackendName, mockNs, backend.SignalTypeLogs) - mockLogProducer := logproducer.New(logProducerName, mockNs). + mockLogProducer := loggen.New(logProducerName, mockNs). WithAnnotations(map[string]string{"fluentbit.io/parser": "my-regex-parser"}) objs = append(objs, mockBackend.K8sObjects()...) objs = append(objs, mockLogProducer.K8sObject(kitk8s.WithLabel("app", "regex-parser-testing-service"))) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - logHTTPPipeline := kitlogpipeline.NewPipeline(pipelineName). + logHTTPPipeline := kitk8s.NewLogPipeline(pipelineName). WithSecretKeyRef(mockBackend.HostSecretRef()). WithHTTPOutput() @@ -49,7 +48,7 @@ Regex ^(?[^ ]*) (?[^ ]*)$ Time_Key time Time_Format %d/%b/%Y:%H:%M:%S %z Types user:string pass:string` - logRegexParser := kitlogpipeline.NewParser("my-regex-parser", parser) + logRegexParser := kitk8s.NewLogParser("my-regex-parser", parser) objs = append(objs, logHTTPPipeline.K8sObject()) objs = append(objs, logRegexParser.K8sObject()) diff --git a/test/e2e/logs_webhook_test.go b/test/e2e/logs_webhook_test.go index fb8b2843d..258d91c6d 100644 --- a/test/e2e/logs_webhook_test.go +++ b/test/e2e/logs_webhook_test.go @@ -9,7 +9,6 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - kitlogpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/log" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -31,12 +30,12 @@ var _ = Describe("Logs Validating Webhook", Label("logs"), Ordered, func() { }) It("Should reject a logpipeline with unknown custom filter", func() { - logPipeline := kitlogpipeline.NewPipeline("unknown-custom-filter-pipeline").WithStdout().WithFilter("Name unknown") + logPipeline := kitk8s.NewLogPipeline("unknown-custom-filter-pipeline").WithStdout().WithFilter("Name unknown") Expect(kitk8s.CreateObjects(ctx, k8sClient, logPipeline.K8sObject())).ShouldNot(Succeed()) }) It("Should reject a logpipeline with denied custom filter", func() { - logPipeline := kitlogpipeline.NewPipeline("denied-custom-filter-pipeline").WithStdout().WithFilter("Name kubernetes") + logPipeline := kitk8s.NewLogPipeline("denied-custom-filter-pipeline").WithStdout().WithFilter("Name kubernetes") Expect(kitk8s.CreateObjects(ctx, k8sClient, logPipeline.K8sObject())).ShouldNot(Succeed()) }) diff --git a/test/e2e/metrics_basic_test.go b/test/e2e/metrics_basic_test.go index b5d6b86f4..e5cb9ef34 100644 --- a/test/e2e/metrics_basic_test.go +++ b/test/e2e/metrics_basic_test.go @@ -18,9 +18,8 @@ import ( "github.com/kyma-project/telemetry-manager/internal/otelcollector/ports" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - kitmetrics "github.com/kyma-project/telemetry-manager/test/testkit/otlp/metrics" + kitmetrics "github.com/kyma-project/telemetry-manager/test/testkit/otel/metrics" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -45,7 +44,7 @@ var _ = Describe("Metrics Basic", Label("metrics"), func() { objs = append(objs, mockBackend.K8sObjects()...) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - metricPipeline := kitmetricpipeline.NewPipeline(fmt.Sprintf("%s-pipeline", mockBackend.Name())). + metricPipeline := kitk8s.NewMetricPipeline(fmt.Sprintf("%s-pipeline", mockBackend.Name())). WithOutputEndpointFromSecret(mockBackend.HostSecretRef()). Persistent(isOperational()) pipelineName = metricPipeline.Name() diff --git a/test/e2e/metrics_endpoint_path_validation_test.go b/test/e2e/metrics_endpoint_path_validation_test.go index e4bdcc4f7..78f02b47c 100644 --- a/test/e2e/metrics_endpoint_path_validation_test.go +++ b/test/e2e/metrics_endpoint_path_validation_test.go @@ -7,31 +7,30 @@ import ( . "github.com/onsi/gomega" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" ) var _ = Describe("Metrics Validating Endpoint Path", Label("metrics"), Ordered, func() { - metricPipelineDefaultGRPCWithPath := kitmetricpipeline.NewPipeline("metricpipeline-default-reject-with-path"). + metricPipelineDefaultGRPCWithPath := kitk8s.NewMetricPipeline("metricpipeline-default-reject-with-path"). WithOutputEndpoint("mock-endpoint:4817").WithEndpointPath("/v1/mock/metrics"). Persistent(isOperational()).K8sObject() - metricPipelineWithGRPCAndPath := kitmetricpipeline.NewPipeline("metricpipeline-reject-with-grpc-and-path"). + metricPipelineWithGRPCAndPath := kitk8s.NewMetricPipeline("metricpipeline-reject-with-grpc-and-path"). WithOutputEndpoint("mock-endpoint:4817").WithEndpointPath("/v1/mock/metrics"). WithProtocol("grpc"). Persistent(isOperational()).K8sObject() - metricPipelineWithGRPCAndWithoutPath := kitmetricpipeline.NewPipeline("metricpipeline-accept-with-grpc-and-no-path"). + metricPipelineWithGRPCAndWithoutPath := kitk8s.NewMetricPipeline("metricpipeline-accept-with-grpc-and-no-path"). WithOutputEndpoint("mock-endpoint:4817"). WithProtocol("grpc"). Persistent(isOperational()).K8sObject() - metricPipelineWithHTTPAndPath := kitmetricpipeline.NewPipeline("metricpipeline-accept-with-http-and-path"). + metricPipelineWithHTTPAndPath := kitk8s.NewMetricPipeline("metricpipeline-accept-with-http-and-path"). WithOutputEndpoint("mock-endpoint:4817").WithEndpointPath("/v1/mock/metrics"). WithProtocol("http"). Persistent(isOperational()).K8sObject() - metricPipelineWithHTTPAndWithoutPath := kitmetricpipeline.NewPipeline("metricpipeline-accept-with-http-and-no-path"). + metricPipelineWithHTTPAndWithoutPath := kitk8s.NewMetricPipeline("metricpipeline-accept-with-http-and-no-path"). WithOutputEndpoint("mock-endpoint:4817"). WithProtocol("http"). Persistent(isOperational()).K8sObject() diff --git a/test/e2e/metrics_endpoint_with_path_test.go b/test/e2e/metrics_endpoint_with_path_test.go index f1415f5c6..94cabf11b 100644 --- a/test/e2e/metrics_endpoint_with_path_test.go +++ b/test/e2e/metrics_endpoint_with_path_test.go @@ -11,7 +11,6 @@ import ( kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -26,7 +25,7 @@ var _ = Describe("Metrics Endpoint with Path", Label("metrics"), func() { makeResources := func() []client.Object { var objs []client.Object - metricPipeline := kitmetricpipeline.NewPipeline("mock-metric-endpoint-path"). + metricPipeline := kitk8s.NewMetricPipeline("mock-metric-endpoint-path"). WithProtocol("http"). WithOutputEndpoint(endpoint).WithEndpointPath(path) diff --git a/test/e2e/metrics_mtls_test.go b/test/e2e/metrics_mtls_test.go index e25c38fd9..fc4eac691 100644 --- a/test/e2e/metrics_mtls_test.go +++ b/test/e2e/metrics_mtls_test.go @@ -13,10 +13,9 @@ import ( "github.com/kyma-project/telemetry-manager/internal/otelcollector/ports" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/urlprovider" - kitmetrics "github.com/kyma-project/telemetry-manager/test/testkit/otlp/metrics" + kitmetrics "github.com/kyma-project/telemetry-manager/test/testkit/otel/metrics" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -38,7 +37,7 @@ var _ = Describe("Metrics mTLS", Label("metrics"), func() { objs = append(objs, mockBackend.K8sObjects()...) urls.SetMockBackendExport(mockBackend.Name(), mockBackend.TelemetryExportURL(proxyClient)) - metricPipeline := kitmetricpipeline.NewPipeline(fmt.Sprintf("%s-%s", mockBackend.Name(), "pipeline")). + metricPipeline := kitk8s.NewMetricPipeline(fmt.Sprintf("%s-%s", mockBackend.Name(), "pipeline")). WithOutputEndpointFromSecret(mockBackend.HostSecretRef()). WithTLS(mockBackend.TLSCerts) pipelineName = metricPipeline.Name() diff --git a/test/e2e/metrics_multi_pipeline_test.go b/test/e2e/metrics_multi_pipeline_test.go index e0be1d596..d0f9a04cc 100644 --- a/test/e2e/metrics_multi_pipeline_test.go +++ b/test/e2e/metrics_multi_pipeline_test.go @@ -17,10 +17,9 @@ import ( "github.com/kyma-project/telemetry-manager/internal/otelcollector/ports" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/urlprovider" - kitmetrics "github.com/kyma-project/telemetry-manager/test/testkit/otlp/metrics" + kitmetrics "github.com/kyma-project/telemetry-manager/test/testkit/otel/metrics" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -48,7 +47,7 @@ var _ = Describe("Metrics Multi-Pipeline", Label("metrics"), func() { mockNs, mockBackend.Name(), backend.TelemetryDataFilename, backend.HTTPWebPort), ) - metricPipeline := kitmetricpipeline.NewPipeline(fmt.Sprintf("%s-%s", mockBackend.Name(), "pipeline")).WithOutputEndpointFromSecret(mockBackend.HostSecretRef()) + metricPipeline := kitk8s.NewMetricPipeline(fmt.Sprintf("%s-%s", mockBackend.Name(), "pipeline")).WithOutputEndpointFromSecret(mockBackend.HostSecretRef()) pipelines.Append(metricPipeline.Name()) objs = append(objs, metricPipeline.K8sObject()) } @@ -101,7 +100,7 @@ var _ = Describe("Metrics Multi-Pipeline", Label("metrics"), func() { makeResources := func() []client.Object { var objs []client.Object for i := 0; i < maxNumberOfMetricPipelines; i++ { - pipeline := kitmetricpipeline.NewPipeline(fmt.Sprintf("pipeline-%d", i)) + pipeline := kitk8s.NewMetricPipeline(fmt.Sprintf("pipeline-%d", i)) pipelines.Append(pipeline.Name()) objs = append(objs, pipeline.K8sObject()) @@ -134,7 +133,7 @@ var _ = Describe("Metrics Multi-Pipeline", Label("metrics"), func() { It("Should have a pending pipeline", func() { By("Creating an additional pipeline", func() { - pipeline := kitmetricpipeline.NewPipeline("exceeding-pipeline") + pipeline := kitk8s.NewMetricPipeline("exceeding-pipeline") pipelineCreatedLater = pipeline.K8sObject() pipelines.Append(pipeline.Name()) @@ -181,13 +180,13 @@ var _ = Describe("Metrics Multi-Pipeline", Label("metrics"), func() { objs = append(objs, mockBackend.K8sObjects()...) urls.SetMockBackendExport(mockBackend.Name(), mockBackend.TelemetryExportURL(proxyClient)) - healthyPipeline := kitmetricpipeline.NewPipeline("healthy").WithOutputEndpointFromSecret(mockBackend.HostSecretRef()) + healthyPipeline := kitk8s.NewMetricPipeline("healthy").WithOutputEndpointFromSecret(mockBackend.HostSecretRef()) healthyPipelineName = healthyPipeline.Name() objs = append(objs, healthyPipeline.K8sObject()) unreachableHostSecret := kitk8s.NewOpaqueSecret("metric-rcv-hostname-broken", kitkyma.DefaultNamespaceName, kitk8s.WithStringData("metric-host", "http://unreachable:4317")) - brokenPipeline := kitmetricpipeline.NewPipeline("broken").WithOutputEndpointFromSecret(unreachableHostSecret.SecretKeyRef("metric-host")) + brokenPipeline := kitk8s.NewMetricPipeline("broken").WithOutputEndpointFromSecret(unreachableHostSecret.SecretKeyRef("metric-host")) brokenPipelineName = brokenPipeline.Name() objs = append(objs, brokenPipeline.K8sObject(), unreachableHostSecret.K8sObject()) diff --git a/test/e2e/metrics_namespace_selector_test.go b/test/e2e/metrics_namespace_selector_test.go index d2aa4c45f..1fc945bd1 100644 --- a/test/e2e/metrics_namespace_selector_test.go +++ b/test/e2e/metrics_namespace_selector_test.go @@ -10,11 +10,10 @@ import ( kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/mocks/metricproducer" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/prommetricgen" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/telemetrygen" - "github.com/kyma-project/telemetry-manager/test/testkit/otlp/kubeletstats" + "github.com/kyma-project/telemetry-manager/test/testkit/otel/kubeletstats" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -41,22 +40,22 @@ var _ = Describe("Metrics Namespace Selector", Label("metrics"), func() { telemetryExportURLs[backend1Name] = backend1.TelemetryExportURL(proxyClient) objs = append(objs, backend1.K8sObjects()...) - pipelineIncludeApp1Ns := kitmetricpipeline.NewPipeline("include-"+app1Ns). + pipelineIncludeApp1Ns := kitk8s.NewMetricPipeline("include-"+app1Ns). WithOutputEndpointFromSecret(backend1.HostSecretRef()). - PrometheusInput(true, kitmetricpipeline.IncludeNamespaces(app1Ns)). - RuntimeInput(true, kitmetricpipeline.IncludeNamespaces(app1Ns)). - OtlpInput(true, kitmetricpipeline.IncludeNamespaces(app1Ns)) + PrometheusInput(true, kitk8s.IncludeNamespaces(app1Ns)). + RuntimeInput(true, kitk8s.IncludeNamespaces(app1Ns)). + OtlpInput(true, kitk8s.IncludeNamespaces(app1Ns)) objs = append(objs, pipelineIncludeApp1Ns.K8sObject()) backend2 := backend.New(backend2Name, backendNs, backend.SignalTypeMetrics) telemetryExportURLs[backend2Name] = backend2.TelemetryExportURL(proxyClient) objs = append(objs, backend2.K8sObjects()...) - pipelineExcludeApp1Ns := kitmetricpipeline.NewPipeline("exclude-"+app1Ns). + pipelineExcludeApp1Ns := kitk8s.NewMetricPipeline("exclude-"+app1Ns). WithOutputEndpointFromSecret(backend2.HostSecretRef()). - PrometheusInput(true, kitmetricpipeline.ExcludeNamespaces(app1Ns)). - RuntimeInput(true, kitmetricpipeline.ExcludeNamespaces(app1Ns)). - OtlpInput(true, kitmetricpipeline.ExcludeNamespaces(app1Ns)) + PrometheusInput(true, kitk8s.ExcludeNamespaces(app1Ns)). + RuntimeInput(true, kitk8s.ExcludeNamespaces(app1Ns)). + OtlpInput(true, kitk8s.ExcludeNamespaces(app1Ns)) objs = append(objs, pipelineExcludeApp1Ns.K8sObject()) objs = append(objs, @@ -64,9 +63,9 @@ var _ = Describe("Metrics Namespace Selector", Label("metrics"), func() { telemetrygen.New(app2Ns).K8sObject(), telemetrygen.New(kitkyma.SystemNamespaceName).K8sObject(), - metricproducer.New(app1Ns).Pod().WithPrometheusAnnotations(metricproducer.SchemeHTTP).K8sObject(), - metricproducer.New(app2Ns).Pod().WithPrometheusAnnotations(metricproducer.SchemeHTTP).K8sObject(), - metricproducer.New(kitkyma.SystemNamespaceName).Pod().WithPrometheusAnnotations(metricproducer.SchemeHTTP).K8sObject(), + prommetricgen.New(app1Ns).Pod().WithPrometheusAnnotations(prommetricgen.SchemeHTTP).K8sObject(), + prommetricgen.New(app2Ns).Pod().WithPrometheusAnnotations(prommetricgen.SchemeHTTP).K8sObject(), + prommetricgen.New(kitkyma.SystemNamespaceName).Pod().WithPrometheusAnnotations(prommetricgen.SchemeHTTP).K8sObject(), ) return objs @@ -102,7 +101,7 @@ var _ = Describe("Metrics Namespace Selector", Label("metrics"), func() { }) It("Should deliver Prometheus metrics from app1Ns to backend1", func() { - verifiers.MetricsFromNamespaceShouldBeDelivered(proxyClient, telemetryExportURLs[backend1Name], app1Ns, metricproducer.MetricNames) + verifiers.MetricsFromNamespaceShouldBeDelivered(proxyClient, telemetryExportURLs[backend1Name], app1Ns, prommetricgen.MetricNames) }) It("Should deliver OTLP metrics from app1Ns to backend1", func() { @@ -119,7 +118,7 @@ var _ = Describe("Metrics Namespace Selector", Label("metrics"), func() { }) It("Should deliver Prometheus metrics from app2Ns to backend2", func() { - verifiers.MetricsFromNamespaceShouldBeDelivered(proxyClient, telemetryExportURLs[backend2Name], app2Ns, metricproducer.MetricNames) + verifiers.MetricsFromNamespaceShouldBeDelivered(proxyClient, telemetryExportURLs[backend2Name], app2Ns, prommetricgen.MetricNames) }) It("Should deliver OTLP metrics from app2Ns to backend2", func() { diff --git a/test/e2e/metrics_otlp_input_test.go b/test/e2e/metrics_otlp_input_test.go index d8b8f6b74..51b90885c 100644 --- a/test/e2e/metrics_otlp_input_test.go +++ b/test/e2e/metrics_otlp_input_test.go @@ -10,7 +10,6 @@ import ( kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/telemetrygen" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" @@ -32,7 +31,7 @@ var _ = Describe("Metrics OTLP Input", Label("metrics"), func() { telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) objs = append(objs, mockBackend.K8sObjects()...) - pipelineWithoutOTLP := kitmetricpipeline.NewPipeline("pipeline-without-otlp-input-enabled"). + pipelineWithoutOTLP := kitk8s.NewMetricPipeline("pipeline-without-otlp-input-enabled"). WithOutputEndpointFromSecret(mockBackend.HostSecretRef()). OtlpInput(false) objs = append(objs, pipelineWithoutOTLP.K8sObject()) diff --git a/test/e2e/metrics_prometheus_input_diagnostic_metric_test.go b/test/e2e/metrics_prometheus_input_diagnostic_metric_test.go index 44023179d..f45affd41 100644 --- a/test/e2e/metrics_prometheus_input_diagnostic_metric_test.go +++ b/test/e2e/metrics_prometheus_input_diagnostic_metric_test.go @@ -12,10 +12,9 @@ import ( kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/metric" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/mocks/metricproducer" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/prommetricgen" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -37,16 +36,16 @@ var _ = Describe("Metrics Prometheus Input Diagnostic Metrics", Label("metrics") // Mocks namespace objects. mockBackend := backend.New(mockBackendName, mockNs, backend.SignalTypeMetrics) - mockMetricProducer := metricproducer.New(mockNs) + mockMetricProducer := prommetricgen.New(mockNs) objs = append(objs, mockBackend.K8sObjects()...) objs = append(objs, []client.Object{ - mockMetricProducer.Pod().WithPrometheusAnnotations(metricproducer.SchemeHTTP).K8sObject(), - mockMetricProducer.Service().WithPrometheusAnnotations(metricproducer.SchemeHTTP).K8sObject(), + mockMetricProducer.Pod().WithPrometheusAnnotations(prommetricgen.SchemeHTTP).K8sObject(), + mockMetricProducer.Service().WithPrometheusAnnotations(prommetricgen.SchemeHTTP).K8sObject(), }...) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) // Default namespace objects. - metricPipeline := kitmetricpipeline.NewPipeline("pipeline-with-prometheus-input-diagnostic-enabled"). + metricPipeline := kitk8s.NewMetricPipeline("pipeline-with-prometheus-input-diagnostic-enabled"). WithOutputEndpointFromSecret(mockBackend.HostSecretRef()). PrometheusInput(true).PrometheusInputDiagnosticMetrics(true) pipelineName = metricPipeline.Name() diff --git a/test/e2e/metrics_prometheus_input_test.go b/test/e2e/metrics_prometheus_input_test.go index f0fa954f7..3e1733d92 100644 --- a/test/e2e/metrics_prometheus_input_test.go +++ b/test/e2e/metrics_prometheus_input_test.go @@ -12,11 +12,10 @@ import ( kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/metric" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/mocks/metricproducer" - "github.com/kyma-project/telemetry-manager/test/testkit/otlp/kubeletstats" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/prommetricgen" + "github.com/kyma-project/telemetry-manager/test/testkit/otel/kubeletstats" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -38,18 +37,18 @@ var _ = Describe("Metrics Prometheus Input", Label("metrics"), func() { // Mocks namespace objects. mockBackend := backend.New(mockBackendName, mockNs, backend.SignalTypeMetrics) - mockMetricProducer := metricproducer.New(mockNs) + mockMetricProducer := prommetricgen.New(mockNs) objs = append(objs, mockBackend.K8sObjects()...) objs = append(objs, []client.Object{ - mockMetricProducer.Pod().WithPrometheusAnnotations(metricproducer.SchemeHTTP).K8sObject(), - mockMetricProducer.Service().WithPrometheusAnnotations(metricproducer.SchemeHTTP).K8sObject(), + mockMetricProducer.Pod().WithPrometheusAnnotations(prommetricgen.SchemeHTTP).K8sObject(), + mockMetricProducer.Service().WithPrometheusAnnotations(prommetricgen.SchemeHTTP).K8sObject(), }...) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) // Default namespace objects. - metricPipeline := kitmetricpipeline.NewPipeline("pipeline-with-prometheus-input-enabled"). + metricPipeline := kitk8s.NewMetricPipeline("pipeline-with-prometheus-input-enabled"). WithOutputEndpointFromSecret(mockBackend.HostSecretRef()). - PrometheusInput(true, kitmetricpipeline.IncludeNamespaces(mockNs)) + PrometheusInput(true, kitk8s.IncludeNamespaces(mockNs)) pipelineName = metricPipeline.Name() objs = append(objs, metricPipeline.K8sObject()) @@ -92,20 +91,20 @@ var _ = Describe("Metrics Prometheus Input", Label("metrics"), func() { // targets discovered via annotated pods must have no service label g.Expect(resp).To(HaveHTTPBody(SatisfyAll( ContainMd(ContainMetric(SatisfyAll( - WithName(Equal(metricproducer.MetricCPUTemperature.Name)), - WithType(Equal(metricproducer.MetricCPUTemperature.Type)), + WithName(Equal(prommetricgen.MetricCPUTemperature.Name)), + WithType(Equal(prommetricgen.MetricCPUTemperature.Type)), ))), ContainMd(ContainMetric(SatisfyAll( - WithName(Equal(metricproducer.MetricCPUEnergyHistogram.Name)), - WithType(Equal(metricproducer.MetricCPUEnergyHistogram.Type)), + WithName(Equal(prommetricgen.MetricCPUEnergyHistogram.Name)), + WithType(Equal(prommetricgen.MetricCPUEnergyHistogram.Type)), ))), ContainMd(ContainMetric(SatisfyAll( - WithName(Equal(metricproducer.MetricHardwareHumidity.Name)), - WithType(Equal(metricproducer.MetricHardwareHumidity.Type)), + WithName(Equal(prommetricgen.MetricHardwareHumidity.Name)), + WithType(Equal(prommetricgen.MetricHardwareHumidity.Type)), ))), ContainMd(ContainMetric(SatisfyAll( - WithName(Equal(metricproducer.MetricHardDiskErrorsTotal.Name)), - WithType(Equal(metricproducer.MetricHardDiskErrorsTotal.Type)), + WithName(Equal(prommetricgen.MetricHardDiskErrorsTotal.Name)), + WithType(Equal(prommetricgen.MetricHardDiskErrorsTotal.Type)), ))), ), )) @@ -119,23 +118,23 @@ var _ = Describe("Metrics Prometheus Input", Label("metrics"), func() { g.Expect(resp).To(HaveHTTPStatus(http.StatusOK)) g.Expect(resp).To(HaveHTTPBody(SatisfyAll( ContainMd(ContainMetric(SatisfyAll( - WithName(Equal(metricproducer.MetricCPUTemperature.Name)), - WithType(Equal(metricproducer.MetricCPUTemperature.Type)), + WithName(Equal(prommetricgen.MetricCPUTemperature.Name)), + WithType(Equal(prommetricgen.MetricCPUTemperature.Type)), ContainDataPointAttrs(HaveKey("service")), ))), ContainMd(ContainMetric(SatisfyAll( - WithName(Equal(metricproducer.MetricCPUEnergyHistogram.Name)), - WithType(Equal(metricproducer.MetricCPUEnergyHistogram.Type)), + WithName(Equal(prommetricgen.MetricCPUEnergyHistogram.Name)), + WithType(Equal(prommetricgen.MetricCPUEnergyHistogram.Type)), ContainDataPointAttrs(HaveKey("service")), ))), ContainMd(ContainMetric(SatisfyAll( - WithName(Equal(metricproducer.MetricHardwareHumidity.Name)), - WithType(Equal(metricproducer.MetricHardwareHumidity.Type)), + WithName(Equal(prommetricgen.MetricHardwareHumidity.Name)), + WithType(Equal(prommetricgen.MetricHardwareHumidity.Type)), ContainDataPointAttrs(HaveKey("service")), ))), ContainMd(ContainMetric(SatisfyAll( - WithName(Equal(metricproducer.MetricHardDiskErrorsTotal.Name)), - WithType(Equal(metricproducer.MetricHardDiskErrorsTotal.Type)), + WithName(Equal(prommetricgen.MetricHardDiskErrorsTotal.Name)), + WithType(Equal(prommetricgen.MetricHardDiskErrorsTotal.Type)), ContainDataPointAttrs(HaveKey("service")), ))), ), diff --git a/test/e2e/metrics_runtime_input_test.go b/test/e2e/metrics_runtime_input_test.go index edd56ac17..ee4de3389 100644 --- a/test/e2e/metrics_runtime_input_test.go +++ b/test/e2e/metrics_runtime_input_test.go @@ -15,10 +15,9 @@ import ( "github.com/kyma-project/telemetry-manager/internal/otelcollector/ports" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/metric" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/otlp/kubeletstats" + "github.com/kyma-project/telemetry-manager/test/testkit/otel/kubeletstats" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -42,7 +41,7 @@ var _ = Describe("Metrics Runtime Input", Label("metrics"), func() { objs = append(objs, mockBackend.K8sObjects()...) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - metricPipeline := kitmetricpipeline.NewPipeline("pipeline-with-runtime-input-enabled"). + metricPipeline := kitk8s.NewMetricPipeline("pipeline-with-runtime-input-enabled"). WithOutputEndpointFromSecret(mockBackend.HostSecretRef()). RuntimeInput(true) pipelineName = metricPipeline.Name() diff --git a/test/e2e/metrics_secret_rotation_test.go b/test/e2e/metrics_secret_rotation_test.go index 7028099ea..c822810c8 100644 --- a/test/e2e/metrics_secret_rotation_test.go +++ b/test/e2e/metrics_secret_rotation_test.go @@ -14,7 +14,6 @@ import ( "github.com/kyma-project/telemetry-manager/internal/conditions" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -23,7 +22,7 @@ var _ = Describe("Metrics Secret Rotation", Label("metrics"), func() { Context("When a metricpipeline with missing secret reference exists", Ordered, func() { hostSecret := kitk8s.NewOpaqueSecret("metric-rcv-hostname", kitkyma.DefaultNamespaceName, kitk8s.WithStringData("metric-host", "http://localhost:4317")) - metricPipeline := kitmetricpipeline.NewPipeline("without-secret").WithOutputEndpointFromSecret(hostSecret.SecretKeyRef("metric-host")) + metricPipeline := kitk8s.NewMetricPipeline("without-secret").WithOutputEndpointFromSecret(hostSecret.SecretKeyRef("metric-host")) BeforeAll(func() { Expect(kitk8s.CreateObjects(ctx, k8sClient, metricPipeline.K8sObject())).Should(Succeed()) diff --git a/test/e2e/metrics_service_name_test.go b/test/e2e/metrics_service_name_test.go index 26784a0bb..a8f1a71b9 100644 --- a/test/e2e/metrics_service_name_test.go +++ b/test/e2e/metrics_service_name_test.go @@ -13,12 +13,11 @@ import ( "github.com/kyma-project/telemetry-manager/internal/otelcollector/ports" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/metric" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/servicenamebundle" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/telemetrygen" - kitmetrics "github.com/kyma-project/telemetry-manager/test/testkit/otlp/metrics" + kitmetrics "github.com/kyma-project/telemetry-manager/test/testkit/otel/metrics" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -43,9 +42,9 @@ var _ = Describe("Metrics Service Name", Label("metrics"), func() { telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - runtimeInputPipeline := kitmetricpipeline.NewPipeline("pipeline-service-name-test"). + runtimeInputPipeline := kitk8s.NewMetricPipeline("pipeline-service-name-test"). WithOutputEndpointFromSecret(mockBackend.HostSecretRef()). - RuntimeInput(true, kitmetricpipeline.IncludeNamespaces(kitkyma.SystemNamespaceName)) + RuntimeInput(true, kitk8s.IncludeNamespaces(kitkyma.SystemNamespaceName)) runtimeInputPipelineName = runtimeInputPipeline.Name() objs = append(objs, runtimeInputPipeline.K8sObject()) diff --git a/test/e2e/overrides_test.go b/test/e2e/overrides_test.go index 70c185144..a679bd4ec 100644 --- a/test/e2e/overrides_test.go +++ b/test/e2e/overrides_test.go @@ -14,10 +14,6 @@ import ( telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - kitovrr "github.com/kyma-project/telemetry-manager/test/testkit/kyma/overrides" - kitlogpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/log" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" - kittracepipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/trace" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/log" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" @@ -43,12 +39,12 @@ var _ = Describe("Overrides", Label("telemetry"), Ordered, func() { objs = append(objs, mockBackend.K8sObjects()...) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - logPipeline := kitlogpipeline.NewPipeline(pipelineName). + logPipeline := kitk8s.NewLogPipeline(pipelineName). WithSystemNamespaces(true). WithSecretKeyRef(mockBackend.HostSecretRef()). WithHTTPOutput() - metricPipeline := kitmetricpipeline.NewPipeline(pipelineName) - tracePipeline := kittracepipeline.NewPipeline(pipelineName) + metricPipeline := kitk8s.NewMetricPipeline(pipelineName) + tracePipeline := kitk8s.NewTracePipeline(pipelineName) objs = append(objs, logPipeline.K8sObject(), metricPipeline.K8sObject(), tracePipeline.K8sObject()) return objs @@ -112,7 +108,7 @@ var _ = Describe("Overrides", Label("telemetry"), Ordered, func() { }) It("Should add the overrides configmap and modify the log pipeline", func() { - overrides = kitovrr.NewOverrides(kitovrr.DEBUG).K8sObject() + overrides = kitk8s.NewOverrides(kitk8s.DEBUG).K8sObject() Expect(kitk8s.CreateObjects(ctx, k8sClient, overrides)).Should(Succeed()) lookupKey := types.NamespacedName{ diff --git a/test/e2e/suite_test.go b/test/e2e/suite_test.go index 8bd88ca75..78cb10e77 100644 --- a/test/e2e/suite_test.go +++ b/test/e2e/suite_test.go @@ -19,8 +19,8 @@ import ( operatorv1alpha1 "github.com/kyma-project/telemetry-manager/apis/operator/v1alpha1" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" + "github.com/kyma-project/telemetry-manager/test/testkit/apiserverproxy" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - "github.com/kyma-project/telemetry-manager/test/testkit/k8s/apiserver" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" ) @@ -35,7 +35,7 @@ var ( ctx context.Context cancel context.CancelFunc k8sClient client.Client - proxyClient *apiserver.ProxyClient + proxyClient *apiserverproxy.Client testEnv *envtest.Environment telemetryK8sObject client.Object k8sObjects []client.Object @@ -78,7 +78,7 @@ var _ = BeforeSuite(func() { Expect(kitk8s.CreateObjects(ctx, k8sClient, k8sObjects...)).To(Succeed()) - proxyClient, err = apiserver.NewProxyClient(testEnv.Config) + proxyClient, err = apiserverproxy.NewClient(testEnv.Config) Expect(err).NotTo(HaveOccurred()) }) diff --git a/test/e2e/telemetry_test.go b/test/e2e/telemetry_test.go index fea0f6b99..4cf22ddf2 100644 --- a/test/e2e/telemetry_test.go +++ b/test/e2e/telemetry_test.go @@ -14,7 +14,6 @@ import ( operatorv1alpha1 "github.com/kyma-project/telemetry-manager/apis/operator/v1alpha1" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kitlogpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/log" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" ) @@ -217,7 +216,7 @@ func testWebhookReconciliation() { } func makeTestPipelineK8sObjects() []client.Object { - logPipeline := kitlogpipeline.NewPipeline(telemetryTestK8SObjectName).WithStdout() + logPipeline := kitk8s.NewLogPipeline(telemetryTestK8SObjectName).WithStdout() return []client.Object{ logPipeline.K8sObject(), } diff --git a/test/e2e/traces_basic_test.go b/test/e2e/traces_basic_test.go index 3cb93d37f..2f999e16c 100644 --- a/test/e2e/traces_basic_test.go +++ b/test/e2e/traces_basic_test.go @@ -18,9 +18,8 @@ import ( "github.com/kyma-project/telemetry-manager/internal/otelcollector/ports" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kittracepipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/trace" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - kittraces "github.com/kyma-project/telemetry-manager/test/testkit/otlp/traces" + kittraces "github.com/kyma-project/telemetry-manager/test/testkit/otel/traces" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -45,7 +44,7 @@ var _ = Describe("Traces Basic", Label("traces"), func() { objs = append(objs, mockBackend.K8sObjects()...) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - pipeline := kittracepipeline.NewPipeline(fmt.Sprintf("%s-pipeline", mockBackend.Name())). + pipeline := kitk8s.NewTracePipeline(fmt.Sprintf("%s-pipeline", mockBackend.Name())). WithOutputEndpointFromSecret(mockBackend.HostSecretRef()). Persistent(isOperational()) pipelineName = pipeline.Name() diff --git a/test/e2e/traces_endpoint_path_validation_test.go b/test/e2e/traces_endpoint_path_validation_test.go index 44be5d3f4..5ec473e92 100644 --- a/test/e2e/traces_endpoint_path_validation_test.go +++ b/test/e2e/traces_endpoint_path_validation_test.go @@ -7,31 +7,30 @@ import ( . "github.com/onsi/gomega" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - kittracepipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/trace" ) var _ = Describe("Traces Validating Endpoint Path", Label("tracing"), Ordered, func() { - tracePipelineDefaultGRPCWithPath := kittracepipeline.NewPipeline("tracepipeline-default-reject-with-path"). + tracePipelineDefaultGRPCWithPath := kitk8s.NewTracePipeline("tracepipeline-default-reject-with-path"). WithOutputEndpoint("mock-endpoint:4817").WithEndpointPath("/v1/mock/traces"). Persistent(isOperational()).K8sObject() - tracePipelineWithGRPCAndPath := kittracepipeline.NewPipeline("tracepipeline-reject-with-grpc-and-path"). + tracePipelineWithGRPCAndPath := kitk8s.NewTracePipeline("tracepipeline-reject-with-grpc-and-path"). WithOutputEndpoint("mock-endpoint:4817").WithEndpointPath("/v1/mock/traces"). WithProtocol("grpc"). Persistent(isOperational()).K8sObject() - tracePipelineWithGRPCAndWithoutPath := kittracepipeline.NewPipeline("tracepipeline-accept-with-grpc-and-no-path"). + tracePipelineWithGRPCAndWithoutPath := kitk8s.NewTracePipeline("tracepipeline-accept-with-grpc-and-no-path"). WithOutputEndpoint("mock-endpoint:4817"). WithProtocol("grpc"). Persistent(isOperational()).K8sObject() - tracePipelineWithHTTPAndPath := kittracepipeline.NewPipeline("tracepipeline-accept-with-http-and-path"). + tracePipelineWithHTTPAndPath := kitk8s.NewTracePipeline("tracepipeline-accept-with-http-and-path"). WithOutputEndpoint("mock-endpoint:4817").WithEndpointPath("/v1/mock/traces"). WithProtocol("http"). Persistent(isOperational()).K8sObject() - tracePipelineWithHTTPAndWithoutPath := kittracepipeline.NewPipeline("tracepipeline-accept-with-http-and-no-path"). + tracePipelineWithHTTPAndWithoutPath := kitk8s.NewTracePipeline("tracepipeline-accept-with-http-and-no-path"). WithOutputEndpoint("mock-endpoint:4817"). WithProtocol("http"). Persistent(isOperational()).K8sObject() diff --git a/test/e2e/traces_endpoint_with_path_test.go b/test/e2e/traces_endpoint_with_path_test.go index 2eb9cb27e..607ec3cbc 100644 --- a/test/e2e/traces_endpoint_with_path_test.go +++ b/test/e2e/traces_endpoint_with_path_test.go @@ -11,7 +11,6 @@ import ( kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kittracepipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/trace" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -26,7 +25,7 @@ var _ = Describe("Traces Endpoint with Path", Label("tracing"), func() { makeResources := func() []client.Object { var objs []client.Object - tracePipeline := kittracepipeline.NewPipeline("mock-trace-endpoint-path"). + tracePipeline := kitk8s.NewTracePipeline("mock-trace-endpoint-path"). WithProtocol("http"). WithOutputEndpoint(endpoint).WithEndpointPath(path) diff --git a/test/e2e/traces_mtls_test.go b/test/e2e/traces_mtls_test.go index 1717e66ae..97702ed79 100644 --- a/test/e2e/traces_mtls_test.go +++ b/test/e2e/traces_mtls_test.go @@ -13,10 +13,9 @@ import ( "github.com/kyma-project/telemetry-manager/internal/otelcollector/ports" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kittracepipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/trace" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/urlprovider" - kittraces "github.com/kyma-project/telemetry-manager/test/testkit/otlp/traces" + kittraces "github.com/kyma-project/telemetry-manager/test/testkit/otel/traces" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -38,7 +37,7 @@ var _ = Describe("Traces mTLS", Label("traces"), func() { objs = append(objs, mockBackend.K8sObjects()...) urls.SetMockBackendExport(mockBackend.Name(), mockBackend.TelemetryExportURL(proxyClient)) - pipeline := kittracepipeline.NewPipeline(fmt.Sprintf("%s-%s", mockBackend.Name(), "pipeline")). + pipeline := kitk8s.NewTracePipeline(fmt.Sprintf("%s-%s", mockBackend.Name(), "pipeline")). WithOutputEndpointFromSecret(mockBackend.HostSecretRef()). WithTLS(mockBackend.TLSCerts) pipelineName = pipeline.Name() diff --git a/test/e2e/traces_multi_pipeline_test.go b/test/e2e/traces_multi_pipeline_test.go index 73be0b064..3e5b0c3c7 100644 --- a/test/e2e/traces_multi_pipeline_test.go +++ b/test/e2e/traces_multi_pipeline_test.go @@ -15,10 +15,9 @@ import ( "github.com/kyma-project/telemetry-manager/internal/otelcollector/ports" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kittracepipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/trace" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/urlprovider" - kittraces "github.com/kyma-project/telemetry-manager/test/testkit/otlp/traces" + kittraces "github.com/kyma-project/telemetry-manager/test/testkit/otel/traces" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -43,7 +42,7 @@ var _ = Describe("Traces Multi-Pipeline", Label("traces"), func() { objs = append(objs, mockBackend.K8sObjects()...) urls.SetMockBackendExport(mockBackend.Name(), mockBackend.TelemetryExportURL(proxyClient)) - pipeline := kittracepipeline.NewPipeline(fmt.Sprintf("%s-%s", mockBackend.Name(), "pipeline")).WithOutputEndpointFromSecret(mockBackend.HostSecretRef()) + pipeline := kitk8s.NewTracePipeline(fmt.Sprintf("%s-%s", mockBackend.Name(), "pipeline")).WithOutputEndpointFromSecret(mockBackend.HostSecretRef()) pipelines.Append(pipeline.Name()) objs = append(objs, pipeline.K8sObject()) } @@ -90,7 +89,7 @@ var _ = Describe("Traces Multi-Pipeline", Label("traces"), func() { makeResources := func() []client.Object { var objs []client.Object for i := 0; i < maxNumberOfTracePipelines; i++ { - pipeline := kittracepipeline.NewPipeline(fmt.Sprintf("pipeline-%d", i)) + pipeline := kitk8s.NewTracePipeline(fmt.Sprintf("pipeline-%d", i)) pipelines.Append(pipeline.Name()) objs = append(objs, pipeline.K8sObject()) @@ -123,7 +122,7 @@ var _ = Describe("Traces Multi-Pipeline", Label("traces"), func() { It("Should have a pending pipeline", func() { By("Creating an additional pipeline", func() { - pipeline := kittracepipeline.NewPipeline("exceeding-pipeline") + pipeline := kitk8s.NewTracePipeline("exceeding-pipeline") pipelineCreatedLater = pipeline.K8sObject() pipelines.Append(pipeline.Name()) @@ -163,13 +162,13 @@ var _ = Describe("Traces Multi-Pipeline", Label("traces"), func() { objs = append(objs, mockBackend.K8sObjects()...) urls.SetMockBackendExport(mockBackend.Name(), mockBackend.TelemetryExportURL(proxyClient)) - healthyPipeline := kittracepipeline.NewPipeline("healthy").WithOutputEndpointFromSecret(mockBackend.HostSecretRef()) + healthyPipeline := kitk8s.NewTracePipeline("healthy").WithOutputEndpointFromSecret(mockBackend.HostSecretRef()) healthyPipelineName = healthyPipeline.Name() objs = append(objs, healthyPipeline.K8sObject()) unreachableHostSecret := kitk8s.NewOpaqueSecret("metric-rcv-hostname-broken", kitkyma.DefaultNamespaceName, kitk8s.WithStringData("metric-host", "http://unreachable:4317")) - brokenPipeline := kittracepipeline.NewPipeline("broken").WithOutputEndpointFromSecret(unreachableHostSecret.SecretKeyRef("metric-host")) + brokenPipeline := kitk8s.NewTracePipeline("broken").WithOutputEndpointFromSecret(unreachableHostSecret.SecretKeyRef("metric-host")) brokenPipelineName = brokenPipeline.Name() objs = append(objs, brokenPipeline.K8sObject(), unreachableHostSecret.K8sObject()) diff --git a/test/e2e/traces_noisy_span_filter_test.go b/test/e2e/traces_noisy_span_filter_test.go index 0511dde20..b5f5a8457 100644 --- a/test/e2e/traces_noisy_span_filter_test.go +++ b/test/e2e/traces_noisy_span_filter_test.go @@ -13,10 +13,9 @@ import ( "github.com/kyma-project/telemetry-manager/internal/otelcollector/ports" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kittracepipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/trace" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/urlprovider" - kittraces "github.com/kyma-project/telemetry-manager/test/testkit/otlp/traces" + kittraces "github.com/kyma-project/telemetry-manager/test/testkit/otel/traces" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -41,7 +40,7 @@ var _ = Describe("Traces Noisy Span Filter", Label("traces"), func() { objs = append(objs, mockBackend.K8sObjects()...) urls.SetMockBackendExport(mockBackend.Name(), mockBackend.TelemetryExportURL(proxyClient)) - pipeline := kittracepipeline.NewPipeline(fmt.Sprintf("%s-pipeline", mockBackend.Name())). + pipeline := kitk8s.NewTracePipeline(fmt.Sprintf("%s-pipeline", mockBackend.Name())). WithOutputEndpointFromSecret(mockBackend.HostSecretRef()) pipelineName = pipeline.Name() objs = append(objs, pipeline.K8sObject()) diff --git a/test/e2e/traces_secret_rotation_test.go b/test/e2e/traces_secret_rotation_test.go index 99ef16af2..577b1251a 100644 --- a/test/e2e/traces_secret_rotation_test.go +++ b/test/e2e/traces_secret_rotation_test.go @@ -10,7 +10,6 @@ import ( kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kittracepipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/trace" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -18,7 +17,7 @@ import ( var _ = Describe("Traces Secret Rotation", Label("traces"), func() { Context("When tracepipeline with missing secret reference exists", Ordered, func() { hostSecret := kitk8s.NewOpaqueSecret("trace-rcv-hostname", kitkyma.DefaultNamespaceName, kitk8s.WithStringData("trace-host", "http://localhost:4317")) - tracePipeline := kittracepipeline.NewPipeline("without-secret").WithOutputEndpointFromSecret(hostSecret.SecretKeyRef("trace-host")) + tracePipeline := kitk8s.NewTracePipeline("without-secret").WithOutputEndpointFromSecret(hostSecret.SecretKeyRef("trace-host")) BeforeAll(func() { Expect(kitk8s.CreateObjects(ctx, k8sClient, tracePipeline.K8sObject())).Should(Succeed()) diff --git a/test/e2e/traces_service_name_test.go b/test/e2e/traces_service_name_test.go index 3732cddd6..ef01aee2d 100644 --- a/test/e2e/traces_service_name_test.go +++ b/test/e2e/traces_service_name_test.go @@ -13,12 +13,11 @@ import ( "github.com/kyma-project/telemetry-manager/internal/otelcollector/ports" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kittracepipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/trace" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/trace" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/servicenamebundle" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/telemetrygen" - kittraces "github.com/kyma-project/telemetry-manager/test/testkit/otlp/traces" + kittraces "github.com/kyma-project/telemetry-manager/test/testkit/otel/traces" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -43,7 +42,7 @@ var _ = Describe("Traces Service Name", Label("traces"), func() { telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - tracePipeline := kittracepipeline.NewPipeline("pipeline-service-name-test"). + tracePipeline := kitk8s.NewTracePipeline("pipeline-service-name-test"). WithOutputEndpointFromSecret(mockBackend.HostSecretRef()) pipelineName = tracePipeline.Name() objs = append(objs, tracePipeline.K8sObject()) diff --git a/test/integration/istio/access_logs_test.go b/test/integration/istio/access_logs_test.go index 9aaa865ba..c2ded7b84 100644 --- a/test/integration/istio/access_logs_test.go +++ b/test/integration/istio/access_logs_test.go @@ -11,14 +11,13 @@ import ( telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - "github.com/kyma-project/telemetry-manager/test/testkit/kyma/istio" - kitlogpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/log" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/mocks/metricproducer" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/prommetricgen" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/urlprovider" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" + "github.com/kyma-project/telemetry-manager/test/testkit/istio" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/log" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -45,7 +44,7 @@ var _ = Describe("Access Logs", Label("logs"), func() { objs = append(objs, mockBackend.K8sObjects()...) urls.SetMockBackendExport(mockBackend.Name(), mockBackend.TelemetryExportURL(proxyClient)) - istioAccessLogsPipeline := kitlogpipeline.NewPipeline("pipeline-istio-access-logs"). + istioAccessLogsPipeline := kitk8s.NewLogPipeline("pipeline-istio-access-logs"). WithSecretKeyRef(mockBackend.HostSecretRef()). WithIncludeContainers([]string{"istio-proxy"}). WithHTTPOutput() @@ -53,7 +52,7 @@ var _ = Describe("Access Logs", Label("logs"), func() { objs = append(objs, istioAccessLogsPipeline.K8sObject()) // Abusing metrics provider for istio access logs - sampleApp := metricproducer.New(sampleAppNs, metricproducer.WithName("access-log-emitter")) + sampleApp := prommetricgen.New(sampleAppNs, prommetricgen.WithName("access-log-emitter")) objs = append(objs, sampleApp.Pod().K8sObject()) urls.SetMetricPodURL(proxyClient.ProxyURLForPod(sampleAppNs, sampleApp.Name(), sampleApp.MetricsEndpoint(), sampleApp.MetricsPort())) diff --git a/test/integration/istio/metrics_istio_input_test.go b/test/integration/istio/metrics_istio_input_test.go index 1ff6699f3..53ccfbc3c 100644 --- a/test/integration/istio/metrics_istio_input_test.go +++ b/test/integration/istio/metrics_istio_input_test.go @@ -13,7 +13,6 @@ import ( kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/metric" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" @@ -116,10 +115,10 @@ var _ = Describe("Metrics Istio Input", Label("metrics"), func() { objs = append(objs, mockBackend.K8sObjects()...) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - metricPipeline := kitmetricpipeline.NewPipeline("pipeline-with-istio-input-enabled"). + metricPipeline := kitk8s.NewMetricPipeline("pipeline-with-istio-input-enabled"). WithOutputEndpointFromSecret(mockBackend.HostSecretRef()). OtlpInput(false). - IstioInput(true, kitmetricpipeline.IncludeNamespaces(app1Ns)) + IstioInput(true, kitk8s.IncludeNamespaces(app1Ns)) objs = append(objs, metricPipeline.K8sObject()) source1 := kitk8s.NewPod("source", app1Ns).WithPodSpec(sourcePodSpec()) diff --git a/test/integration/istio/metrics_otlp_input_test.go b/test/integration/istio/metrics_otlp_input_test.go index c228166a7..3b2162854 100644 --- a/test/integration/istio/metrics_otlp_input_test.go +++ b/test/integration/istio/metrics_otlp_input_test.go @@ -11,8 +11,6 @@ import ( kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - "github.com/kyma-project/telemetry-manager/test/testkit/kyma/istio" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -44,19 +42,19 @@ var _ = Describe("Metrics OTLP Input", Label("metrics"), func() { objs = append(objs, mockIstiofiedBackend.K8sObjects()...) telemetryIstiofiedExportURL = mockIstiofiedBackend.TelemetryExportURL(proxyClient) - metricPipeline := kitmetricpipeline.NewPipeline("pipeline-with-otlp-input-enabled"). + metricPipeline := kitk8s.NewMetricPipeline("pipeline-with-otlp-input-enabled"). WithOutputEndpointFromSecret(mockBackend.HostSecretRef()). OtlpInput(true) objs = append(objs, metricPipeline.K8sObject()) - metricPipelineIstiofiedBackend := kitmetricpipeline.NewPipeline("pipeline-with-otlp-input-enabled-with-istiofied-backend"). + metricPipelineIstiofiedBackend := kitk8s.NewMetricPipeline("pipeline-with-otlp-input-enabled-with-istiofied-backend"). WithOutputEndpointFromSecret(mockIstiofiedBackend.HostSecretRef()). OtlpInput(true) objs = append(objs, metricPipelineIstiofiedBackend.K8sObject()) // set peerauthentication to strict explicitly - peerAuth := istio.NewPeerAuthentication(istiofiedBackendName, istiofiedBackendNs) + peerAuth := kitk8s.NewPeerAuthentication(istiofiedBackendName, istiofiedBackendNs) objs = append(objs, peerAuth.K8sObject(kitk8s.WithLabel("app", istiofiedBackendName))) // Create 2 deployments (with and without side-car) which would push the metrics to the metrics gateway. diff --git a/test/integration/istio/metrics_prometheus_input_test.go b/test/integration/istio/metrics_prometheus_input_test.go index c634b8847..2d39c4fdd 100644 --- a/test/integration/istio/metrics_prometheus_input_test.go +++ b/test/integration/istio/metrics_prometheus_input_test.go @@ -12,10 +12,9 @@ import ( kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kitmetricpipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/metric" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/metric" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/mocks/metricproducer" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/prommetricgen" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" ) @@ -40,19 +39,19 @@ var _ = Describe("Metrics Prometheus Input", Label("metrics"), func() { objs = append(objs, mockBackend.K8sObjects()...) telemetryExportURL = mockBackend.TelemetryExportURL(proxyClient) - httpsAnnotatedMetricProducer := metricproducer.New(mockNs, metricproducer.WithName(httpsAnnotatedMetricProducerName)) - httpAnnotatedMetricProducer := metricproducer.New(mockNs, metricproducer.WithName(httpAnnotatedMetricProducerName)) - unannotatedMetricProducer := metricproducer.New(mockNs, metricproducer.WithName(unannotatedMetricProducerName)) + httpsAnnotatedMetricProducer := prommetricgen.New(mockNs, prommetricgen.WithName(httpsAnnotatedMetricProducerName)) + httpAnnotatedMetricProducer := prommetricgen.New(mockNs, prommetricgen.WithName(httpAnnotatedMetricProducerName)) + unannotatedMetricProducer := prommetricgen.New(mockNs, prommetricgen.WithName(unannotatedMetricProducerName)) objs = append(objs, []client.Object{ - httpsAnnotatedMetricProducer.Pod().WithSidecarInjection().WithPrometheusAnnotations(metricproducer.SchemeHTTPS).K8sObject(), - httpsAnnotatedMetricProducer.Service().WithPrometheusAnnotations(metricproducer.SchemeHTTPS).K8sObject(), - httpAnnotatedMetricProducer.Pod().WithPrometheusAnnotations(metricproducer.SchemeHTTP).K8sObject(), - httpAnnotatedMetricProducer.Service().WithPrometheusAnnotations(metricproducer.SchemeHTTP).K8sObject(), - unannotatedMetricProducer.Pod().WithPrometheusAnnotations(metricproducer.SchemeHTTP).K8sObject(), - unannotatedMetricProducer.Service().WithPrometheusAnnotations(metricproducer.SchemeHTTP).K8sObject(), + httpsAnnotatedMetricProducer.Pod().WithSidecarInjection().WithPrometheusAnnotations(prommetricgen.SchemeHTTPS).K8sObject(), + httpsAnnotatedMetricProducer.Service().WithPrometheusAnnotations(prommetricgen.SchemeHTTPS).K8sObject(), + httpAnnotatedMetricProducer.Pod().WithPrometheusAnnotations(prommetricgen.SchemeHTTP).K8sObject(), + httpAnnotatedMetricProducer.Service().WithPrometheusAnnotations(prommetricgen.SchemeHTTP).K8sObject(), + unannotatedMetricProducer.Pod().WithPrometheusAnnotations(prommetricgen.SchemeHTTP).K8sObject(), + unannotatedMetricProducer.Service().WithPrometheusAnnotations(prommetricgen.SchemeHTTP).K8sObject(), }...) - metricPipeline := kitmetricpipeline.NewPipeline("pipeline-with-prometheus-input-enabled"). + metricPipeline := kitk8s.NewMetricPipeline("pipeline-with-prometheus-input-enabled"). WithOutputEndpointFromSecret(mockBackend.HostSecretRef()). PrometheusInput(true) objs = append(objs, metricPipeline.K8sObject()) @@ -126,7 +125,7 @@ func podScrapedMetricsShouldBeDelivered(proxyURL, podName string) { g.Expect(resp).To(HaveHTTPStatus(http.StatusOK)) g.Expect(resp).To(HaveHTTPBody(ContainMd(SatisfyAll( ContainResourceAttrs(HaveKeyWithValue("k8s.pod.name", podName)), - ContainMetric(WithName(BeElementOf(metricproducer.MetricNames))), + ContainMetric(WithName(BeElementOf(prommetricgen.MetricNames))), )))) }, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed()) } @@ -138,7 +137,7 @@ func serviceScrapedMetricsShouldBeDelivered(proxyURL, serviceName string) { g.Expect(resp).To(HaveHTTPStatus(http.StatusOK)) g.Expect(resp).To(HaveHTTPBody(ContainMd( ContainMetric(SatisfyAll( - WithName(BeElementOf(metricproducer.MetricNames)), + WithName(BeElementOf(prommetricgen.MetricNames)), ContainDataPointAttrs(HaveKeyWithValue("service", serviceName)), ))))) }, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed()) diff --git a/test/integration/istio/suite_test.go b/test/integration/istio/suite_test.go index 5c87c997b..7f5224cb4 100644 --- a/test/integration/istio/suite_test.go +++ b/test/integration/istio/suite_test.go @@ -18,9 +18,9 @@ import ( operatorv1alpha1 "github.com/kyma-project/telemetry-manager/apis/operator/v1alpha1" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - "github.com/kyma-project/telemetry-manager/test/testkit/k8s/apiserver" istiosecv1beta1 "istio.io/client-go/pkg/apis/security/v1beta1" + "github.com/kyma-project/telemetry-manager/test/testkit/apiserverproxy" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" . "github.com/onsi/ginkgo/v2" @@ -46,7 +46,7 @@ var ( ctx context.Context cancel context.CancelFunc k8sClient client.Client - proxyClient *apiserver.ProxyClient + proxyClient *apiserverproxy.Client testEnv *envtest.Environment telemetryK8sObject client.Object k8sObjects []client.Object @@ -90,7 +90,7 @@ var _ = BeforeSuite(func() { Expect(kitk8s.CreateObjects(ctx, k8sClient, k8sObjects...)).To(Succeed()) - proxyClient, err = apiserver.NewProxyClient(testEnv.Config) + proxyClient, err = apiserverproxy.NewClient(testEnv.Config) Expect(err).NotTo(HaveOccurred()) }) diff --git a/test/integration/istio/traces_test.go b/test/integration/istio/traces_test.go index 9ec10088e..499fa4c34 100644 --- a/test/integration/istio/traces_test.go +++ b/test/integration/istio/traces_test.go @@ -6,10 +6,9 @@ import ( "github.com/kyma-project/telemetry-manager/internal/otelcollector/ports" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" - kittracepipeline "github.com/kyma-project/telemetry-manager/test/testkit/kyma/telemetry/trace" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/trace" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend" - "github.com/kyma-project/telemetry-manager/test/testkit/mocks/metricproducer" + "github.com/kyma-project/telemetry-manager/test/testkit/mocks/prommetricgen" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/urlprovider" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" "github.com/kyma-project/telemetry-manager/test/testkit/verifiers" @@ -60,11 +59,11 @@ var _ = Describe("Traces", Label("traces"), Ordered, func() { objs = append(objs, mockIstiofiedBackend.K8sObjects()...) telemetryIstiofiedExportURL = mockBackend.TelemetryExportURL(proxyClient) - istioTracePipeline := kittracepipeline.NewPipeline("istiofied-app-traces").WithOutputEndpointFromSecret(mockIstiofiedBackend.HostSecretRef()) + istioTracePipeline := kitk8s.NewTracePipeline("istiofied-app-traces").WithOutputEndpointFromSecret(mockIstiofiedBackend.HostSecretRef()) istiofiedPipelineName = istioTracePipeline.Name() objs = append(objs, istioTracePipeline.K8sObject()) - tracePipeline := kittracepipeline.NewPipeline("app-traces").WithOutputEndpointFromSecret(mockBackend.HostSecretRef()) + tracePipeline := kitk8s.NewTracePipeline("app-traces").WithOutputEndpointFromSecret(mockBackend.HostSecretRef()) pipelineName = tracePipeline.Name() objs = append(objs, tracePipeline.K8sObject()) @@ -75,11 +74,11 @@ var _ = Describe("Traces", Label("traces"), Ordered, func() { objs = append(objs, traceGatewayExternalService.K8sObject(kitk8s.WithLabel("app.kubernetes.io/name", "telemetry-trace-collector"))) // Abusing metrics provider for istio traces - istioSampleApp := metricproducer.New(istiofiedSampleAppNs, metricproducer.WithName(istiofiedSampleAppName)) + istioSampleApp := prommetricgen.New(istiofiedSampleAppNs, prommetricgen.WithName(istiofiedSampleAppName)) objs = append(objs, istioSampleApp.Pod().K8sObject()) istiofiedAppURL = istioSampleApp.PodURL(proxyClient) - sampleApp := metricproducer.New(sampleAppNs, metricproducer.WithName(sampleAppName)) + sampleApp := prommetricgen.New(sampleAppNs, prommetricgen.WithName(sampleAppName)) objs = append(objs, sampleApp.Pod().K8sObject()) appURL = sampleApp.PodURL(proxyClient) diff --git a/test/testkit/k8s/apiserver/proxy_client.go b/test/testkit/apiserverproxy/proxy_client.go similarity index 74% rename from test/testkit/k8s/apiserver/proxy_client.go rename to test/testkit/apiserverproxy/proxy_client.go index 8890fbdec..27f69599b 100644 --- a/test/testkit/k8s/apiserver/proxy_client.go +++ b/test/testkit/apiserverproxy/proxy_client.go @@ -1,4 +1,4 @@ -package apiserver +package apiserverproxy import ( "crypto/tls" @@ -10,15 +10,15 @@ import ( "k8s.io/client-go/transport" ) -type ProxyClient struct { +type Client struct { bearerToken string tlsClientConfig *tls.Config apiURL string } -// NewProxyClient returns a provider for all HTTPS-related authentication information to be used +// NewClient returns a provider for all HTTPS-related authentication information to be used // for accessing in-cluster resources. -func NewProxyClient(config *rest.Config) (*ProxyClient, error) { +func NewClient(config *rest.Config) (*Client, error) { transportConfig, err := config.TransportConfig() if err != nil { return nil, fmt.Errorf("failed to create transport config: %w", err) @@ -31,23 +31,23 @@ func NewProxyClient(config *rest.Config) (*ProxyClient, error) { } tlsClientConfig.InsecureSkipVerify = true - return &ProxyClient{ + return &Client{ bearerToken: transportConfig.BearerToken, tlsClientConfig: tlsClientConfig, apiURL: config.Host, }, nil } -func (a ProxyClient) TLSConfig() *tls.Config { +func (a Client) TLSConfig() *tls.Config { return a.tlsClientConfig } -func (a ProxyClient) Token() string { +func (a Client) Token() string { return "Bearer " + a.bearerToken } // ProxyURLForService composes a proxy url for a service. -func (a ProxyClient) ProxyURLForService(namespace, service, path string, port int) string { +func (a Client) ProxyURLForService(namespace, service, path string, port int) string { return fmt.Sprintf( `%s/api/v1/namespaces/%s/services/http:%s:%d/proxy/%s`, a.apiURL, @@ -59,7 +59,7 @@ func (a ProxyClient) ProxyURLForService(namespace, service, path string, port in } // ProxyURLForPod composes a proxy url for a pod. -func (a ProxyClient) ProxyURLForPod(namespace, pod, path string, port int) string { +func (a Client) ProxyURLForPod(namespace, pod, path string, port int) string { return fmt.Sprintf( `%s/api/v1/namespaces/%s/pods/http:%s:%d/proxy/%s`, a.apiURL, @@ -71,7 +71,7 @@ func (a ProxyClient) ProxyURLForPod(namespace, pod, path string, port int) strin } // Get performs an HTTPS request to the in-cluster resource identifiable by ProxyURLForService or ProxyURLForPod. -func (a ProxyClient) Get(proxyURL string) (*http.Response, error) { +func (a Client) Get(proxyURL string) (*http.Response, error) { client := &http.Client{Transport: &http.Transport{ TLSClientConfig: a.tlsClientConfig, }} diff --git a/test/testkit/kyma/istio/istio.go b/test/testkit/istio/istio.go similarity index 100% rename from test/testkit/kyma/istio/istio.go rename to test/testkit/istio/istio.go diff --git a/test/testkit/kyma/telemetry/log/parser.go b/test/testkit/k8s/log_parser.go similarity index 69% rename from test/testkit/kyma/telemetry/log/parser.go rename to test/testkit/k8s/log_parser.go index 3032a63e4..f3a2154ec 100644 --- a/test/testkit/kyma/telemetry/log/parser.go +++ b/test/testkit/k8s/log_parser.go @@ -1,4 +1,4 @@ -package log +package k8s import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -6,19 +6,19 @@ import ( telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" ) -type Parser struct { +type LogParser struct { name string parser string } -func NewParser(name, parser string) *Parser { - return &Parser{ +func NewLogParser(name, parser string) *LogParser { + return &LogParser{ name: name, parser: parser, } } -func (p *Parser) K8sObject() *telemetryv1alpha1.LogParser { +func (p *LogParser) K8sObject() *telemetryv1alpha1.LogParser { return &telemetryv1alpha1.LogParser{ ObjectMeta: metav1.ObjectMeta{ Name: p.name, diff --git a/test/testkit/kyma/telemetry/log/pipeline.go b/test/testkit/k8s/log_pipeline.go similarity index 72% rename from test/testkit/kyma/telemetry/log/pipeline.go rename to test/testkit/k8s/log_pipeline.go index e257fce13..29b5ed0ce 100644 --- a/test/testkit/kyma/telemetry/log/pipeline.go +++ b/test/testkit/k8s/log_pipeline.go @@ -1,4 +1,4 @@ -package log +package k8s import ( "strings" @@ -6,11 +6,10 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" - kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend/tls" ) -type Pipeline struct { +type LogPipeline struct { persistent bool name string @@ -24,54 +23,54 @@ type Pipeline struct { filters []telemetryv1alpha1.Filter } -func NewPipeline(name string) *Pipeline { - return &Pipeline{ +func NewLogPipeline(name string) *LogPipeline { + return &LogPipeline{ name: name, } } -func (p *Pipeline) Name() string { +func (p *LogPipeline) Name() string { return p.name } -func (p *Pipeline) WithSecretKeyRef(secretKeyRef *telemetryv1alpha1.SecretKeyRef) *Pipeline { +func (p *LogPipeline) WithSecretKeyRef(secretKeyRef *telemetryv1alpha1.SecretKeyRef) *LogPipeline { p.secretKeyRef = secretKeyRef return p } -func (p *Pipeline) WithSystemNamespaces(enable bool) *Pipeline { +func (p *LogPipeline) WithSystemNamespaces(enable bool) *LogPipeline { p.systemNamespaces = enable return p } -func (p *Pipeline) WithIncludeContainers(names []string) *Pipeline { +func (p *LogPipeline) WithIncludeContainers(names []string) *LogPipeline { p.includeContainers = names return p } -func (p *Pipeline) WithExcludeContainers(names []string) *Pipeline { +func (p *LogPipeline) WithExcludeContainers(names []string) *LogPipeline { p.excludeContainers = names return p } -func (p *Pipeline) KeepAnnotations(enable bool) *Pipeline { +func (p *LogPipeline) KeepAnnotations(enable bool) *LogPipeline { p.keepAnnotations = enable return p } -func (p *Pipeline) DropLabels(enable bool) *Pipeline { +func (p *LogPipeline) DropLabels(enable bool) *LogPipeline { p.dropLabels = enable return p } -func (p *Pipeline) WithStdout() *Pipeline { +func (p *LogPipeline) WithStdout() *LogPipeline { p.output = telemetryv1alpha1.Output{ Custom: "Name stdout", } return p } -func (p *Pipeline) WithHTTPOutput() *Pipeline { +func (p *LogPipeline) WithHTTPOutput() *LogPipeline { p.output = telemetryv1alpha1.Output{ HTTP: &telemetryv1alpha1.HTTPOutput{ Dedot: true, @@ -92,7 +91,7 @@ func (p *Pipeline) WithHTTPOutput() *Pipeline { return p } -func (p *Pipeline) WithTLS(certs tls.Certs) *Pipeline { +func (p *LogPipeline) WithTLS(certs tls.Certs) *LogPipeline { if !p.output.IsHTTPDefined() { return p } @@ -114,7 +113,7 @@ func (p *Pipeline) WithTLS(certs tls.Certs) *Pipeline { return p } -func (p *Pipeline) WithCustomOutput(host string) *Pipeline { +func (p *LogPipeline) WithCustomOutput(host string) *LogPipeline { const customOutputTemplate = ` name http port 9880 @@ -127,23 +126,23 @@ func (p *Pipeline) WithCustomOutput(host string) *Pipeline { return p } -func (p *Pipeline) WithFilter(filter string) *Pipeline { +func (p *LogPipeline) WithFilter(filter string) *LogPipeline { p.filters = append(p.filters, telemetryv1alpha1.Filter{ Custom: filter, }) return p } -func (p *Pipeline) Persistent(persistent bool) *Pipeline { +func (p *LogPipeline) Persistent(persistent bool) *LogPipeline { p.persistent = persistent return p } -func (p *Pipeline) K8sObject() *telemetryv1alpha1.LogPipeline { - var labels kitk8s.Labels +func (p *LogPipeline) K8sObject() *telemetryv1alpha1.LogPipeline { + var labels Labels if p.persistent { - labels = kitk8s.PersistentLabel + labels = PersistentLabel } return &telemetryv1alpha1.LogPipeline{ diff --git a/test/testkit/kyma/telemetry/metric/pipeline.go b/test/testkit/k8s/metric_pipeline.go similarity index 76% rename from test/testkit/kyma/telemetry/metric/pipeline.go rename to test/testkit/k8s/metric_pipeline.go index 74d47ba43..3bb73595b 100644 --- a/test/testkit/kyma/telemetry/metric/pipeline.go +++ b/test/testkit/k8s/metric_pipeline.go @@ -1,4 +1,4 @@ -package metric +package k8s import ( "fmt" @@ -7,13 +7,12 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" - kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend/tls" ) const version = "1.0.0" -type Pipeline struct { +type MetricPipeline struct { persistent bool id string @@ -29,32 +28,32 @@ type Pipeline struct { endpointPath string } -func NewPipeline(name string) *Pipeline { - return &Pipeline{ +func NewMetricPipeline(name string) *MetricPipeline { + return &MetricPipeline{ id: uuid.New().String(), name: name, otlpEndpoint: "http://unreachable:4317", } } -func (p *Pipeline) WithOutputEndpoint(otlpEndpoint string) *Pipeline { +func (p *MetricPipeline) WithOutputEndpoint(otlpEndpoint string) *MetricPipeline { p.otlpEndpoint = otlpEndpoint return p } -func (p *Pipeline) WithOutputEndpointFromSecret(otlpEndpointRef *telemetryv1alpha1.SecretKeyRef) *Pipeline { +func (p *MetricPipeline) WithOutputEndpointFromSecret(otlpEndpointRef *telemetryv1alpha1.SecretKeyRef) *MetricPipeline { p.otlpEndpointRef = otlpEndpointRef return p } -func (p *Pipeline) Name() string { +func (p *MetricPipeline) Name() string { if p.persistent { return p.name } return fmt.Sprintf("%s-%s", p.name, p.id) } -func (p *Pipeline) Persistent(persistent bool) *Pipeline { +func (p *MetricPipeline) Persistent(persistent bool) *MetricPipeline { p.persistent = persistent return p } @@ -73,7 +72,7 @@ func ExcludeNamespaces(namespaces ...string) InputOptions { } } -func (p *Pipeline) OtlpInput(enable bool, opts ...InputOptions) *Pipeline { +func (p *MetricPipeline) OtlpInput(enable bool, opts ...InputOptions) *MetricPipeline { p.otlp = &telemetryv1alpha1.MetricPipelineOtlpInput{ Disabled: !enable, } @@ -89,7 +88,7 @@ func (p *Pipeline) OtlpInput(enable bool, opts ...InputOptions) *Pipeline { return p } -func (p *Pipeline) RuntimeInput(enable bool, opts ...InputOptions) *Pipeline { +func (p *MetricPipeline) RuntimeInput(enable bool, opts ...InputOptions) *MetricPipeline { p.runtime = &telemetryv1alpha1.MetricPipelineRuntimeInput{ Enabled: enable, } @@ -105,7 +104,7 @@ func (p *Pipeline) RuntimeInput(enable bool, opts ...InputOptions) *Pipeline { return p } -func (p *Pipeline) PrometheusInput(enable bool, opts ...InputOptions) *Pipeline { +func (p *MetricPipeline) PrometheusInput(enable bool, opts ...InputOptions) *MetricPipeline { p.prometheus = &telemetryv1alpha1.MetricPipelinePrometheusInput{ Enabled: enable, } @@ -121,7 +120,7 @@ func (p *Pipeline) PrometheusInput(enable bool, opts ...InputOptions) *Pipeline return p } -func (p *Pipeline) IstioInput(enable bool, opts ...InputOptions) *Pipeline { +func (p *MetricPipeline) IstioInput(enable bool, opts ...InputOptions) *MetricPipeline { p.istio = &telemetryv1alpha1.MetricPipelineIstioInput{ Enabled: enable, } @@ -137,21 +136,21 @@ func (p *Pipeline) IstioInput(enable bool, opts ...InputOptions) *Pipeline { return p } -func (p *Pipeline) PrometheusInputDiagnosticMetrics(enable bool) *Pipeline { +func (p *MetricPipeline) PrometheusInputDiagnosticMetrics(enable bool) *MetricPipeline { p.prometheus.DiagnosticMetrics = &telemetryv1alpha1.DiagnosticMetrics{ Enabled: enable, } return p } -func (p *Pipeline) IstioInputDiagnosticMetrics(enable bool) *Pipeline { +func (p *MetricPipeline) IstioInputDiagnosticMetrics(enable bool) *MetricPipeline { p.istio.DiagnosticMetrics = &telemetryv1alpha1.DiagnosticMetrics{ Enabled: enable, } return p } -func (p *Pipeline) WithTLS(certs tls.Certs) *Pipeline { +func (p *MetricPipeline) WithTLS(certs tls.Certs) *MetricPipeline { p.tls = &telemetryv1alpha1.OtlpTLS{ Insecure: false, InsecureSkipVerify: false, @@ -169,20 +168,20 @@ func (p *Pipeline) WithTLS(certs tls.Certs) *Pipeline { return p } -func (p *Pipeline) WithProtocol(protocol string) *Pipeline { +func (p *MetricPipeline) WithProtocol(protocol string) *MetricPipeline { p.protocol = protocol return p } -func (p *Pipeline) WithEndpointPath(path string) *Pipeline { +func (p *MetricPipeline) WithEndpointPath(path string) *MetricPipeline { p.endpointPath = path return p } -func (p *Pipeline) K8sObject() *telemetryv1alpha1.MetricPipeline { - var labels kitk8s.Labels +func (p *MetricPipeline) K8sObject() *telemetryv1alpha1.MetricPipeline { + var labels Labels if p.persistent { - labels = kitk8s.PersistentLabel + labels = PersistentLabel } labels.Version(version) diff --git a/test/testkit/kyma/overrides/overrides.go b/test/testkit/k8s/overrides.go similarity index 98% rename from test/testkit/kyma/overrides/overrides.go rename to test/testkit/k8s/overrides.go index 89e1a367e..523ae0f38 100644 --- a/test/testkit/kyma/overrides/overrides.go +++ b/test/testkit/k8s/overrides.go @@ -1,4 +1,4 @@ -package overrides +package k8s import ( "strings" diff --git a/test/testkit/kyma/istio/peerauthentication.go b/test/testkit/k8s/peer_authentication.go similarity index 88% rename from test/testkit/kyma/istio/peerauthentication.go rename to test/testkit/k8s/peer_authentication.go index c0afc71cd..284a999f8 100644 --- a/test/testkit/kyma/istio/peerauthentication.go +++ b/test/testkit/k8s/peer_authentication.go @@ -1,4 +1,4 @@ -package istio +package k8s import ( istiosecurityv1beta "istio.io/api/security/v1beta1" @@ -7,7 +7,6 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/kyma-project/telemetry-manager/test/testkit" - kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" ) type PeerAuthentication struct { @@ -23,7 +22,7 @@ func NewPeerAuthentication(name, namespace string) *PeerAuthentication { } func (d *PeerAuthentication) K8sObject(labelOpts ...testkit.OptFunc) *istiosecurityclientv1beta.PeerAuthentication { - labels := kitk8s.ProcessLabelOptions(labelOpts...) + labels := ProcessLabelOptions(labelOpts...) workLoadSelector := istiotypev1beta1.WorkloadSelector{MatchLabels: labels} return &istiosecurityclientv1beta.PeerAuthentication{ ObjectMeta: metav1.ObjectMeta{Name: d.name, Namespace: d.namespace}, diff --git a/test/testkit/kyma/telemetry/trace/pipeline.go b/test/testkit/k8s/trace_pipeline.go similarity index 72% rename from test/testkit/kyma/telemetry/trace/pipeline.go rename to test/testkit/k8s/trace_pipeline.go index 0e9b88417..d1d16d4bd 100644 --- a/test/testkit/kyma/telemetry/trace/pipeline.go +++ b/test/testkit/k8s/trace_pipeline.go @@ -1,4 +1,4 @@ -package trace +package k8s import ( "fmt" @@ -7,13 +7,10 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" - kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend/tls" ) -const version = "1.0.0" - -type Pipeline struct { +type TracePipeline struct { persistent bool id string @@ -25,25 +22,25 @@ type Pipeline struct { endpointPath string } -func NewPipeline(name string) *Pipeline { - return &Pipeline{ +func NewTracePipeline(name string) *TracePipeline { + return &TracePipeline{ id: uuid.New().String(), name: name, otlpEndpoint: "http://unreachable:4317", } } -func (p *Pipeline) WithOutputEndpoint(otlpEndpoint string) *Pipeline { +func (p *TracePipeline) WithOutputEndpoint(otlpEndpoint string) *TracePipeline { p.otlpEndpoint = otlpEndpoint return p } -func (p *Pipeline) WithOutputEndpointFromSecret(otlpEndpointRef *telemetryv1alpha1.SecretKeyRef) *Pipeline { +func (p *TracePipeline) WithOutputEndpointFromSecret(otlpEndpointRef *telemetryv1alpha1.SecretKeyRef) *TracePipeline { p.otlpEndpointRef = otlpEndpointRef return p } -func (p *Pipeline) WithTLS(certs tls.Certs) *Pipeline { +func (p *TracePipeline) WithTLS(certs tls.Certs) *TracePipeline { p.tls = &telemetryv1alpha1.OtlpTLS{ Insecure: false, InsecureSkipVerify: false, @@ -61,7 +58,7 @@ func (p *Pipeline) WithTLS(certs tls.Certs) *Pipeline { return p } -func (p *Pipeline) Name() string { +func (p *TracePipeline) Name() string { if p.persistent { return p.name } @@ -69,26 +66,26 @@ func (p *Pipeline) Name() string { return fmt.Sprintf("%s-%s", p.name, p.id) } -func (p *Pipeline) Persistent(persistent bool) *Pipeline { +func (p *TracePipeline) Persistent(persistent bool) *TracePipeline { p.persistent = persistent return p } -func (p *Pipeline) WithProtocol(protocol string) *Pipeline { +func (p *TracePipeline) WithProtocol(protocol string) *TracePipeline { p.protocol = protocol return p } -func (p *Pipeline) WithEndpointPath(path string) *Pipeline { +func (p *TracePipeline) WithEndpointPath(path string) *TracePipeline { p.endpointPath = path return p } -func (p *Pipeline) K8sObject() *telemetryv1alpha1.TracePipeline { - var labels kitk8s.Labels +func (p *TracePipeline) K8sObject() *telemetryv1alpha1.TracePipeline { + var labels Labels if p.persistent { - labels = kitk8s.PersistentLabel + labels = PersistentLabel } labels.Version(version) diff --git a/test/testkit/matchers/metric/metric_matchers_test.go b/test/testkit/matchers/metric/metric_matchers_test.go index d7509b848..9bb10ac1f 100644 --- a/test/testkit/matchers/metric/metric_matchers_test.go +++ b/test/testkit/matchers/metric/metric_matchers_test.go @@ -5,7 +5,7 @@ import ( . "github.com/onsi/gomega" "go.opentelemetry.io/collector/pdata/pmetric" - kitmetrics "github.com/kyma-project/telemetry-manager/test/testkit/otlp/metrics" + kitmetrics "github.com/kyma-project/telemetry-manager/test/testkit/otel/metrics" ) var _ = Describe("WithMds", func() { diff --git a/test/testkit/matchers/trace/trace_matchers_test.go b/test/testkit/matchers/trace/trace_matchers_test.go index b58260bc1..a6a131ac2 100644 --- a/test/testkit/matchers/trace/trace_matchers_test.go +++ b/test/testkit/matchers/trace/trace_matchers_test.go @@ -6,7 +6,7 @@ import ( "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/ptrace" - kittraces "github.com/kyma-project/telemetry-manager/test/testkit/otlp/traces" + kittraces "github.com/kyma-project/telemetry-manager/test/testkit/otel/traces" ) var _ = Describe("WithTds", func() { diff --git a/test/testkit/mocks/backend/backend.go b/test/testkit/mocks/backend/backend.go index b1ff50142..0b3d93c64 100644 --- a/test/testkit/mocks/backend/backend.go +++ b/test/testkit/mocks/backend/backend.go @@ -8,8 +8,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" + "github.com/kyma-project/telemetry-manager/test/testkit/apiserverproxy" kitk8s "github.com/kyma-project/telemetry-manager/test/testkit/k8s" - "github.com/kyma-project/telemetry-manager/test/testkit/k8s/apiserver" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend/fluentd" "github.com/kyma-project/telemetry-manager/test/testkit/mocks/backend/tls" ) @@ -112,7 +112,7 @@ func (b *Backend) HostSecretRef() *telemetryv1alpha1.SecretKeyRef { return b.HostSecret.SecretKeyRef("host") } -func (b *Backend) TelemetryExportURL(proxyClient *apiserver.ProxyClient) string { +func (b *Backend) TelemetryExportURL(proxyClient *apiserverproxy.Client) string { return proxyClient.ProxyURLForService(b.namespace, b.name, TelemetryDataFilename, HTTPWebPort) } diff --git a/test/testkit/mocks/logproducer/log_producer.go b/test/testkit/mocks/loggen/log_producer.go similarity index 98% rename from test/testkit/mocks/logproducer/log_producer.go rename to test/testkit/mocks/loggen/log_producer.go index 80f7e43c2..3d2ef1e18 100644 --- a/test/testkit/mocks/logproducer/log_producer.go +++ b/test/testkit/mocks/loggen/log_producer.go @@ -1,4 +1,4 @@ -package logproducer +package loggen import ( appsv1 "k8s.io/api/apps/v1" diff --git a/test/testkit/mocks/metricproducer/metric_producer.go b/test/testkit/mocks/prommetricgen/metric_producer.go similarity index 97% rename from test/testkit/mocks/metricproducer/metric_producer.go rename to test/testkit/mocks/prommetricgen/metric_producer.go index 3df79ca1d..982f23d81 100644 --- a/test/testkit/mocks/metricproducer/metric_producer.go +++ b/test/testkit/mocks/prommetricgen/metric_producer.go @@ -1,4 +1,4 @@ -package metricproducer +package prommetricgen import ( "maps" @@ -10,7 +10,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - "github.com/kyma-project/telemetry-manager/test/testkit/k8s/apiserver" + "github.com/kyma-project/telemetry-manager/test/testkit/apiserverproxy" ) const ( @@ -72,7 +72,7 @@ type MetricProducer struct { labels map[string]string } -func (mp *MetricProducer) PodURL(proxyClient *apiserver.ProxyClient) string { +func (mp *MetricProducer) PodURL(proxyClient *apiserverproxy.Client) string { return proxyClient.ProxyURLForPod(mp.namespace, mp.name, mp.MetricsEndpoint(), mp.MetricsPort()) } diff --git a/test/testkit/otlp/kubeletstats/metrics.go b/test/testkit/otel/kubeletstats/metrics.go similarity index 100% rename from test/testkit/otlp/kubeletstats/metrics.go rename to test/testkit/otel/kubeletstats/metrics.go diff --git a/test/testkit/otlp/metrics/exporter.go b/test/testkit/otel/metrics/exporter.go similarity index 100% rename from test/testkit/otlp/metrics/exporter.go rename to test/testkit/otel/metrics/exporter.go diff --git a/test/testkit/otlp/metrics/helpers.go b/test/testkit/otel/metrics/helpers.go similarity index 78% rename from test/testkit/otlp/metrics/helpers.go rename to test/testkit/otel/metrics/helpers.go index 5eeb4f70c..07cebf92b 100644 --- a/test/testkit/otlp/metrics/helpers.go +++ b/test/testkit/otel/metrics/helpers.go @@ -7,10 +7,10 @@ import ( "github.com/onsi/gomega" "go.opentelemetry.io/collector/pdata/pmetric" - "github.com/kyma-project/telemetry-manager/test/testkit/k8s/apiserver" + "github.com/kyma-project/telemetry-manager/test/testkit/apiserverproxy" ) -func MakeAndSendGaugeMetrics(proxyClient *apiserver.ProxyClient, otlpPushURL string) []pmetric.Metric { +func MakeAndSendGaugeMetrics(proxyClient *apiserverproxy.Client, otlpPushURL string) []pmetric.Metric { builder := NewBuilder() var gauges []pmetric.Metric for i := 0; i < 50; i++ { @@ -23,7 +23,7 @@ func MakeAndSendGaugeMetrics(proxyClient *apiserver.ProxyClient, otlpPushURL str return gauges } -func sendGaugeMetrics(ctx context.Context, proxyClient *apiserver.ProxyClient, metrics pmetric.Metrics, otlpPushURL string) error { +func sendGaugeMetrics(ctx context.Context, proxyClient *apiserverproxy.Client, metrics pmetric.Metrics, otlpPushURL string) error { sender, err := NewHTTPExporter(otlpPushURL, proxyClient) if err != nil { return fmt.Errorf("unable to create an OTLP HTTP Metric Exporter instance: %w", err) diff --git a/test/testkit/otlp/metrics/metrics.go b/test/testkit/otel/metrics/metrics.go similarity index 100% rename from test/testkit/otlp/metrics/metrics.go rename to test/testkit/otel/metrics/metrics.go diff --git a/test/testkit/otlp/traces/exporter.go b/test/testkit/otel/traces/exporter.go similarity index 100% rename from test/testkit/otlp/traces/exporter.go rename to test/testkit/otel/traces/exporter.go diff --git a/test/testkit/otlp/traces/helpers.go b/test/testkit/otel/traces/helpers.go similarity index 84% rename from test/testkit/otlp/traces/helpers.go rename to test/testkit/otel/traces/helpers.go index 186154195..5e184e5bd 100644 --- a/test/testkit/otlp/traces/helpers.go +++ b/test/testkit/otel/traces/helpers.go @@ -8,11 +8,11 @@ import ( "go.opentelemetry.io/collector/pdata/pcommon" "go.opentelemetry.io/collector/pdata/ptrace" - "github.com/kyma-project/telemetry-manager/test/testkit/k8s/apiserver" + "github.com/kyma-project/telemetry-manager/test/testkit/apiserverproxy" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" ) -func MakeAndSendTraces(proxyClient *apiserver.ProxyClient, otlpPushURL string) (pcommon.TraceID, []pcommon.SpanID, pcommon.Map) { +func MakeAndSendTraces(proxyClient *apiserverproxy.Client, otlpPushURL string) (pcommon.TraceID, []pcommon.SpanID, pcommon.Map) { traceID := NewTraceID() var spanIDs []pcommon.SpanID for i := 0; i < 100; i++ { @@ -30,7 +30,7 @@ func MakeAndSendTraces(proxyClient *apiserver.ProxyClient, otlpPushURL string) ( return traceID, spanIDs, attrs } -func MakeAndSendTracesWithAttributes(proxyClient *apiserver.ProxyClient, otlpPushURL string, attributes pcommon.Map, resAttributes pcommon.Map) (pcommon.TraceID, []pcommon.SpanID) { +func MakeAndSendTracesWithAttributes(proxyClient *apiserverproxy.Client, otlpPushURL string, attributes pcommon.Map, resAttributes pcommon.Map) (pcommon.TraceID, []pcommon.SpanID) { traceID := NewTraceID() var spanIDs = []pcommon.SpanID{NewSpanID()} @@ -41,7 +41,7 @@ func MakeAndSendTracesWithAttributes(proxyClient *apiserver.ProxyClient, otlpPus return traceID, spanIDs } -func MakeAndSendVictoriaMetricsAgentTraces(proxyClient *apiserver.ProxyClient, otlpPushURL string) pcommon.TraceID { +func MakeAndSendVictoriaMetricsAgentTraces(proxyClient *apiserverproxy.Client, otlpPushURL string) pcommon.TraceID { spanAttrs := pcommon.NewMap() spanAttrs.PutStr("http.method", "GET") spanAttrs.PutStr("component", "proxy") @@ -54,7 +54,7 @@ func MakeAndSendVictoriaMetricsAgentTraces(proxyClient *apiserver.ProxyClient, o return traceID } -func MakeAndSendMetricAgentScrapeTraces(proxyClient *apiserver.ProxyClient, otlpPushURL string) pcommon.TraceID { +func MakeAndSendMetricAgentScrapeTraces(proxyClient *apiserverproxy.Client, otlpPushURL string) pcommon.TraceID { spanAttrs := pcommon.NewMap() spanAttrs.PutStr("http.method", "GET") spanAttrs.PutStr("component", "proxy") @@ -67,7 +67,7 @@ func MakeAndSendMetricAgentScrapeTraces(proxyClient *apiserver.ProxyClient, otlp return traceID } -func MakeAndSendIstioHealthzEndpointTraces(proxyClient *apiserver.ProxyClient, otlpPushURL string) pcommon.TraceID { +func MakeAndSendIstioHealthzEndpointTraces(proxyClient *apiserverproxy.Client, otlpPushURL string) pcommon.TraceID { spanAttrs := pcommon.NewMap() spanAttrs.PutStr("http.method", "GET") spanAttrs.PutStr("component", "proxy") @@ -82,7 +82,7 @@ func MakeAndSendIstioHealthzEndpointTraces(proxyClient *apiserver.ProxyClient, o return traceID } -func MakeAndSendTraceServiceTraces(proxyClient *apiserver.ProxyClient, otlpPushURL string) pcommon.TraceID { +func MakeAndSendTraceServiceTraces(proxyClient *apiserverproxy.Client, otlpPushURL string) pcommon.TraceID { spanAttrs := pcommon.NewMap() spanAttrs.PutStr("http.method", "POST") spanAttrs.PutStr("component", "proxy") @@ -96,7 +96,7 @@ func MakeAndSendTraceServiceTraces(proxyClient *apiserver.ProxyClient, otlpPushU return traceID } -func MakeAndSendTraceInternalServiceTraces(proxyClient *apiserver.ProxyClient, otlpPushURL string) pcommon.TraceID { +func MakeAndSendTraceInternalServiceTraces(proxyClient *apiserverproxy.Client, otlpPushURL string) pcommon.TraceID { spanAttrs := pcommon.NewMap() spanAttrs.PutStr("http.method", "POST") spanAttrs.PutStr("component", "proxy") @@ -110,7 +110,7 @@ func MakeAndSendTraceInternalServiceTraces(proxyClient *apiserver.ProxyClient, o return traceID } -func MakeAndSendMetricServiceTraces(proxyClient *apiserver.ProxyClient, otlpPushURL string) pcommon.TraceID { +func MakeAndSendMetricServiceTraces(proxyClient *apiserverproxy.Client, otlpPushURL string) pcommon.TraceID { spanAttrs := pcommon.NewMap() spanAttrs.PutStr("http.method", "POST") spanAttrs.PutStr("component", "proxy") @@ -124,7 +124,7 @@ func MakeAndSendMetricServiceTraces(proxyClient *apiserver.ProxyClient, otlpPush return traceID } -func MakeAndSendTraceGatewayTraces(proxyClient *apiserver.ProxyClient, otlpPushURL string) pcommon.TraceID { +func MakeAndSendTraceGatewayTraces(proxyClient *apiserverproxy.Client, otlpPushURL string) pcommon.TraceID { spanAttrs := pcommon.NewMap() spanAttrs.PutStr("component", "proxy") spanAttrs.PutStr("istio.canonical_service", "telemetry-trace-collector") @@ -136,7 +136,7 @@ func MakeAndSendTraceGatewayTraces(proxyClient *apiserver.ProxyClient, otlpPushU return traceID } -func MakeAndSendMetricGatewayTraces(proxyClient *apiserver.ProxyClient, otlpPushURL string) pcommon.TraceID { +func MakeAndSendMetricGatewayTraces(proxyClient *apiserverproxy.Client, otlpPushURL string) pcommon.TraceID { spanAttrs := pcommon.NewMap() spanAttrs.PutStr("component", "proxy") spanAttrs.PutStr("istio.canonical_service", "telemetry-metric-gateway") @@ -148,7 +148,7 @@ func MakeAndSendMetricGatewayTraces(proxyClient *apiserver.ProxyClient, otlpPush return traceID } -func MakeAndSendMetricAgentTraces(proxyClient *apiserver.ProxyClient, otlpPushURL string) pcommon.TraceID { +func MakeAndSendMetricAgentTraces(proxyClient *apiserverproxy.Client, otlpPushURL string) pcommon.TraceID { spanAttrs := pcommon.NewMap() spanAttrs.PutStr("component", "proxy") spanAttrs.PutStr("istio.canonical_service", "telemetry-metric-agent") @@ -160,7 +160,7 @@ func MakeAndSendMetricAgentTraces(proxyClient *apiserver.ProxyClient, otlpPushUR return traceID } -func MakeAndSendFluentBitTraces(proxyClient *apiserver.ProxyClient, otlpPushURL string) pcommon.TraceID { +func MakeAndSendFluentBitTraces(proxyClient *apiserverproxy.Client, otlpPushURL string) pcommon.TraceID { spanAttrs := pcommon.NewMap() spanAttrs.PutStr("component", "proxy") spanAttrs.PutStr("istio.canonical_service", "telemetry-fluent-bit") @@ -172,7 +172,7 @@ func MakeAndSendFluentBitTraces(proxyClient *apiserver.ProxyClient, otlpPushURL return traceID } -func sendTraces(ctx context.Context, proxyClient *apiserver.ProxyClient, traces ptrace.Traces, otlpPushURL string) error { +func sendTraces(ctx context.Context, proxyClient *apiserverproxy.Client, traces ptrace.Traces, otlpPushURL string) error { sender, err := NewHTTPSender(ctx, otlpPushURL, proxyClient) if err != nil { return fmt.Errorf("unable to create an OTLP HTTP Metric Exporter instance: %w", err) diff --git a/test/testkit/otlp/traces/traces.go b/test/testkit/otel/traces/traces.go similarity index 100% rename from test/testkit/otlp/traces/traces.go rename to test/testkit/otel/traces/traces.go diff --git a/test/testkit/verifiers/daemonset.go b/test/testkit/verifiers/daemon_set.go similarity index 100% rename from test/testkit/verifiers/daemonset.go rename to test/testkit/verifiers/daemon_set.go diff --git a/test/testkit/verifiers/logs.go b/test/testkit/verifiers/logs.go index 64524837d..e8ed413a9 100644 --- a/test/testkit/verifiers/logs.go +++ b/test/testkit/verifiers/logs.go @@ -9,12 +9,12 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" - "github.com/kyma-project/telemetry-manager/test/testkit/k8s/apiserver" + "github.com/kyma-project/telemetry-manager/test/testkit/apiserverproxy" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/log" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" ) -func LogsShouldBeDelivered(proxyClient *apiserver.ProxyClient, expectedPodNamePrefix string, telemetryExportURL string) { +func LogsShouldBeDelivered(proxyClient *apiserverproxy.Client, expectedPodNamePrefix string, telemetryExportURL string) { Eventually(func(g Gomega) { resp, err := proxyClient.Get(telemetryExportURL) g.Expect(err).NotTo(HaveOccurred()) diff --git a/test/testkit/verifiers/metrics.go b/test/testkit/verifiers/metrics.go index d1b9e6225..2081e6847 100644 --- a/test/testkit/verifiers/metrics.go +++ b/test/testkit/verifiers/metrics.go @@ -15,7 +15,7 @@ import ( telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" "github.com/kyma-project/telemetry-manager/internal/conditions" - "github.com/kyma-project/telemetry-manager/test/testkit/k8s/apiserver" + "github.com/kyma-project/telemetry-manager/test/testkit/apiserverproxy" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/metric" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" @@ -52,7 +52,7 @@ func MetricGatewayConfigShouldNotContainPipeline(ctx context.Context, k8sClient }, periodic.ConsistentlyTimeout, periodic.DefaultInterval).Should(BeTrue()) } -func MetricsShouldBeDelivered(proxyClient *apiserver.ProxyClient, telemetryExportURL string, metrics []pmetric.Metric) { +func MetricsShouldBeDelivered(proxyClient *apiserverproxy.Client, telemetryExportURL string, metrics []pmetric.Metric) { Eventually(func(g Gomega) { resp, err := proxyClient.Get(telemetryExportURL) g.Expect(err).NotTo(HaveOccurred()) @@ -63,7 +63,7 @@ func MetricsShouldBeDelivered(proxyClient *apiserver.ProxyClient, telemetryExpor }, periodic.EventuallyTimeout, periodic.TelemetryInterval).Should(Succeed()) } -func MetricsFromNamespaceShouldBeDelivered(proxyClient *apiserver.ProxyClient, telemetryExportURL, namespace string, metricNames []string) { +func MetricsFromNamespaceShouldBeDelivered(proxyClient *apiserverproxy.Client, telemetryExportURL, namespace string, metricNames []string) { Eventually(func(g Gomega) { resp, err := proxyClient.Get(telemetryExportURL) g.Expect(err).NotTo(HaveOccurred()) @@ -79,7 +79,7 @@ func MetricsFromNamespaceShouldBeDelivered(proxyClient *apiserver.ProxyClient, t }, periodic.TelemetryEventuallyTimeout, periodic.TelemetryInterval).Should(Succeed()) } -func MetricsFromNamespaceShouldNotBeDelivered(proxyClient *apiserver.ProxyClient, telemetryExportURL, namespace string) { +func MetricsFromNamespaceShouldNotBeDelivered(proxyClient *apiserverproxy.Client, telemetryExportURL, namespace string) { Consistently(func(g Gomega) { resp, err := proxyClient.Get(telemetryExportURL) g.Expect(err).NotTo(HaveOccurred()) diff --git a/test/testkit/verifiers/monitoring.go b/test/testkit/verifiers/monitoring.go index 7c0592bc9..24f23e7fb 100644 --- a/test/testkit/verifiers/monitoring.go +++ b/test/testkit/verifiers/monitoring.go @@ -5,12 +5,12 @@ import ( . "github.com/onsi/gomega" - "github.com/kyma-project/telemetry-manager/test/testkit/k8s/apiserver" + "github.com/kyma-project/telemetry-manager/test/testkit/apiserverproxy" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/prometheus" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" ) -func ShouldExposeCollectorMetrics(proxyClient *apiserver.ProxyClient, metricsURL string) { +func ShouldExposeCollectorMetrics(proxyClient *apiserverproxy.Client, metricsURL string) { Eventually(func(g Gomega) { resp, err := proxyClient.Get(metricsURL) g.Expect(err).NotTo(HaveOccurred()) diff --git a/test/testkit/verifiers/traces.go b/test/testkit/verifiers/traces.go index 7037b9aa4..4a8cb6845 100644 --- a/test/testkit/verifiers/traces.go +++ b/test/testkit/verifiers/traces.go @@ -13,7 +13,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" telemetryv1alpha1 "github.com/kyma-project/telemetry-manager/apis/telemetry/v1alpha1" - "github.com/kyma-project/telemetry-manager/test/testkit/k8s/apiserver" + "github.com/kyma-project/telemetry-manager/test/testkit/apiserverproxy" kitkyma "github.com/kyma-project/telemetry-manager/test/testkit/kyma" . "github.com/kyma-project/telemetry-manager/test/testkit/matchers/trace" "github.com/kyma-project/telemetry-manager/test/testkit/periodic" @@ -57,7 +57,7 @@ func TraceCollectorConfigShouldNotContainPipeline(ctx context.Context, k8sClient }, periodic.ConsistentlyTimeout, periodic.DefaultInterval).Should(BeTrue()) } -func TracesShouldBeDelivered(proxyClient *apiserver.ProxyClient, telemetryExportURL string, +func TracesShouldBeDelivered(proxyClient *apiserverproxy.Client, telemetryExportURL string, traceID pcommon.TraceID, spanIDs []pcommon.SpanID, spanAttrs pcommon.Map) { @@ -81,7 +81,7 @@ func TracesShouldBeDelivered(proxyClient *apiserver.ProxyClient, telemetryExport }, periodic.EventuallyTimeout, periodic.TelemetryInterval).Should(Succeed()) } -func TracesShouldNotBePresent(proxyClient *apiserver.ProxyClient, telemetryExportURL string, traceID pcommon.TraceID) { +func TracesShouldNotBePresent(proxyClient *apiserverproxy.Client, telemetryExportURL string, traceID pcommon.TraceID) { Consistently(func(g Gomega) { resp, err := proxyClient.Get(telemetryExportURL) g.Expect(err).NotTo(HaveOccurred())