2023-02-17 13:35:58 +08:00
|
|
|
package trace
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
|
|
"testing"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestConfig_getEndpointHost(t *testing.T) {
|
|
|
|
|
logx.Disable()
|
|
|
|
|
|
|
|
|
|
c1 := Config{
|
2023-02-17 13:37:27 +08:00
|
|
|
Name: "not UDP",
|
2023-02-17 13:35:58 +08:00
|
|
|
Endpoint: "http://localhost:14268/api/traces",
|
2023-02-17 13:37:27 +08:00
|
|
|
Batcher: kindJaegerUdp,
|
2023-02-17 13:35:58 +08:00
|
|
|
}
|
|
|
|
|
c2 := Config{
|
2023-02-17 13:37:27 +08:00
|
|
|
Name: "UDP",
|
2023-02-17 13:35:58 +08:00
|
|
|
Endpoint: "localhost:6831",
|
2023-02-17 13:37:27 +08:00
|
|
|
Batcher: kindJaegerUdp,
|
2023-02-17 13:35:58 +08:00
|
|
|
}
|
|
|
|
|
assert.NotEqual(t, "localhost", c1.getEndpointHost())
|
|
|
|
|
assert.NotEqual(t, "14268", c1.getEndpointPort())
|
|
|
|
|
assert.Equal(t, "localhost", c2.getEndpointHost())
|
|
|
|
|
assert.Equal(t, "6831", c2.getEndpointPort())
|
|
|
|
|
}
|