Skip to content

Commit

Permalink
fixes in the tests
Browse files Browse the repository at this point in the history
Signed-off-by: Mritunjay Sharma <mritunjaysharma394@gmail.com>
  • Loading branch information
mritunjaysharma394 authored and VineethReddy02 committed Dec 14, 2021
1 parent 2bbc9a5 commit 9f6410d
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions pkg/collector/parser/receiver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"testing"

"github.com/go-logr/logr"
"github.com/open-telemetry/opentelemetry-operator/pkg/collector/parser"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
logf "sigs.k8s.io/controller-runtime/pkg/log"
Expand Down Expand Up @@ -97,20 +98,20 @@ func TestReceiverFailsWhenPortIsntString(t *testing.T) {
// verify
assert.Nil(t, p)
}

func TestReceiverFailsWhenNameIsKubeletStats(t *testing.T) {
// prepare
config := map[interface{}]interface{}{
"name": "kubeletstats",
}
func TestIgnorekubeletstatsEndpoint(t *testing.T) {
// ignore "kubeletstats" receiver endpoint field, this is special case
// as this receiver gets parsed by generic receiver parser
builder := parser.NewGenericReceiverParser(logger, "kubeletstats", map[interface{}]interface{}{
"endpoint": "0.0.0.0:9000",
})

// test
p := singlePortFromConfigEndpoint(logger, "myreceiver", config)
ports, err := builder.Ports()

// verify
assert.Nil(t, p)
assert.NoError(t, err)
assert.Len(t, ports, 0)
}

func TestReceiverFallbackWhenNotRegistered(t *testing.T) {
// test
p := For(logger, "myreceiver", map[interface{}]interface{}{})
Expand Down

0 comments on commit 9f6410d

Please sign in to comment.