config_test.go 505 B

12345678910111213141516171819202122
  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. Endpoint: "http://localhost:14268/api/traces",
  11. }
  12. c2 := Config{
  13. Endpoint: "localhost:6831",
  14. }
  15. assert.NotEqual(t, "localhost", c1.getEndpointHost())
  16. assert.NotEqual(t, "14268", c1.getEndpointPort())
  17. assert.Equal(t, "localhost", c2.getEndpointHost())
  18. assert.Equal(t, "6831", c2.getEndpointPort())
  19. }