forked from open-telemetry/opentelemetry-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bumped OpenTelemetry Collector to v0.16.0 (open-telemetry#135)
Signed-off-by: Juraci Paixão Kröhling <[email protected]>
- Loading branch information
1 parent
48c6989
commit 7c71db9
Showing
5 changed files
with
177 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,73 @@ | ||
package parser | ||
|
||
// all tests for the OTLP parser are currently part of the test TestDownstreamParsers | ||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestOTLPSelfRegisters(t *testing.T) { | ||
// verify | ||
assert.True(t, IsRegistered("otlp")) | ||
} | ||
|
||
func TestOTLPIsFoundByName(t *testing.T) { | ||
// test | ||
p := For(logger, "otlp", map[interface{}]interface{}{}) | ||
|
||
// verify | ||
assert.Equal(t, "__otlp", p.ParserName()) | ||
} | ||
|
||
func TestOTLPPortsOverridden(t *testing.T) { | ||
// prepare | ||
builder := NewOTLPReceiverParser(logger, "otlp", map[interface{}]interface{}{ | ||
"protocols": map[interface{}]interface{}{ | ||
"grpc": map[interface{}]interface{}{ | ||
"endpoint": "0.0.0.0:1234", | ||
}, | ||
}, | ||
}) | ||
|
||
// test | ||
ports, err := builder.Ports() | ||
|
||
// verify | ||
assert.NoError(t, err) | ||
assert.Len(t, ports, 1) | ||
assert.EqualValues(t, 1234, ports[0].Port) | ||
} | ||
|
||
func TestOTLPExposeDefaultPorts(t *testing.T) { | ||
// prepare | ||
builder := NewOTLPReceiverParser(logger, "otlp", map[interface{}]interface{}{ | ||
"protocols": map[interface{}]interface{}{ | ||
"grpc": map[interface{}]interface{}{}, | ||
}, | ||
}) | ||
|
||
expectedResults := map[string]struct { | ||
portNumber int32 | ||
seen bool | ||
}{ | ||
"otlp-grpc": {portNumber: 4317}, | ||
"otlp-grpc-legacy": {portNumber: 55680}, | ||
} | ||
|
||
// test | ||
ports, err := builder.Ports() | ||
|
||
// verify | ||
assert.NoError(t, err) | ||
assert.Len(t, ports, 2) | ||
|
||
for _, port := range ports { | ||
r := expectedResults[port.Name] | ||
r.seen = true | ||
expectedResults[port.Name] = r | ||
assert.EqualValues(t, r.portNumber, port.Port) | ||
} | ||
for k, v := range expectedResults { | ||
assert.True(t, v.seen, "the port %s wasn't included in the service ports", k) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters