From ec3f9bf1c25b1657147e79a63319034e82581edd Mon Sep 17 00:00:00 2001 From: Jared Tan Date: Thu, 14 Sep 2023 11:24:59 +0800 Subject: [PATCH] [extension/k8sobserver] unexport `NewNode`,`NewPod` (#26645) **Link to tracking Issue:** https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/26304 --------- Signed-off-by: Jared Tan --- cmd/checkapi/allowlist.txt | 1 - .../observer/k8sobserver/k8s_fixtures_test.go | 14 +++++++------- .../observer/k8sobserver/node_endpoint_test.go | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/cmd/checkapi/allowlist.txt b/cmd/checkapi/allowlist.txt index 5fdd4c40dd88..516f9cbc08e2 100644 --- a/cmd/checkapi/allowlist.txt +++ b/cmd/checkapi/allowlist.txt @@ -13,7 +13,6 @@ exporter/sentryexporter exporter/sumologicexporter extension/observer/ecsobserver extension/observer -extension/observer/k8sobserver processor/groupbyattrsprocessor processor/groupbytraceprocessor processor/probabilisticsamplerprocessor diff --git a/extension/observer/k8sobserver/k8s_fixtures_test.go b/extension/observer/k8sobserver/k8s_fixtures_test.go index ad6a8990bca0..10153c4d6a52 100644 --- a/extension/observer/k8sobserver/k8s_fixtures_test.go +++ b/extension/observer/k8sobserver/k8s_fixtures_test.go @@ -9,8 +9,8 @@ import ( "k8s.io/apimachinery/pkg/types" ) -// NewPod is a helper function for creating Pods for testing. -func NewPod(name, host string) *v1.Pod { +// newPod is a helper function for creating Pods for testing. +func newPod(name, host string) *v1.Pod { pod := &v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", @@ -38,7 +38,7 @@ func NewPod(name, host string) *v1.Pod { return pod } -var pod1V1 = NewPod("pod1", "localhost") +var pod1V1 = newPod("pod1", "localhost") var pod1V2 = func() *v1.Pod { pod := pod1V1.DeepCopy() pod.Labels["pod-version"] = "2" @@ -85,7 +85,7 @@ var container2StatusRunning = v1.ContainerStatus{ } var podWithNamedPorts = func() *v1.Pod { - pod := NewPod("pod-2", "localhost") + pod := newPod("pod-2", "localhost") pod.Labels = map[string]string{ "env": "prod", } @@ -104,8 +104,8 @@ func pointerBool(val bool) *bool { return &val } -// NewNode is a helper function for creating Nodes for testing. -func NewNode(name, hostname string) *v1.Node { +// newNode is a helper function for creating Nodes for testing. +func newNode(name, hostname string) *v1.Node { return &v1.Node{ ObjectMeta: metav1.ObjectMeta{ Namespace: "namespace", @@ -147,7 +147,7 @@ func NewNode(name, hostname string) *v1.Node { } } -var node1V1 = NewNode("node1", "localhost") +var node1V1 = newNode("node1", "localhost") var node1V2 = func() *v1.Node { node := node1V1.DeepCopy() node.Labels["node-version"] = "2" diff --git a/extension/observer/k8sobserver/node_endpoint_test.go b/extension/observer/k8sobserver/node_endpoint_test.go index e547581d33c6..cba65151b03e 100644 --- a/extension/observer/k8sobserver/node_endpoint_test.go +++ b/extension/observer/k8sobserver/node_endpoint_test.go @@ -29,6 +29,6 @@ func TestNodeObjectToK8sNodeEndpoint(t *testing.T) { }, } - endpoint := convertNodeToEndpoint("namespace", NewNode("name", "hostname")) + endpoint := convertNodeToEndpoint("namespace", newNode("name", "hostname")) require.Equal(t, expectedNode, endpoint) }