config_test.go 611 B

12345678910111213141516171819202122232425262728
  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_parseEndpoint(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. host1, port1 := c1.parseEndpoint()
  20. assert.NotEqual(t, "localhost", host1)
  21. assert.NotEqual(t, "14268", port1)
  22. host2, port2 := c2.parseEndpoint()
  23. assert.Equal(t, "localhost", host2)
  24. assert.Equal(t, "6831", port2)
  25. }