config_test.go 601 B

1234567891011121314151617181920212223242526
  1. package trace
  2. import (
  3. "github.com/stretchr/testify/assert"
  4. "github.com/zeromicro/go-zero/core/logx"
  5. "testing"
  6. )
  7. func TestConfig_getEndpointHost(t *testing.T) {
  8. logx.Disable()
  9. c1 := Config{
  10. Name: "not UDP",
  11. Endpoint: "http://localhost:14268/api/traces",
  12. Batcher: kindJaegerUdp,
  13. }
  14. c2 := Config{
  15. Name: "UDP",
  16. Endpoint: "localhost:6831",
  17. Batcher: kindJaegerUdp,
  18. }
  19. assert.NotEqual(t, "localhost", c1.getEndpointHost())
  20. assert.NotEqual(t, "14268", c1.getEndpointPort())
  21. assert.Equal(t, "localhost", c2.getEndpointHost())
  22. assert.Equal(t, "6831", c2.getEndpointPort())
  23. }