agent_test.go 488 B

1234567891011121314151617
  1. package log
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/assert"
  5. )
  6. func TestBatchSendSwitch(t *testing.T) {
  7. agent := NewAgent(nil)
  8. assert.Equal(t, true, agent.batchSend)
  9. agent = NewAgent(&AgentConfig{TaskID: "000161", Proto: "unixpacket", Addr: "/var/run/lancer/collector_tcp.sock"})
  10. assert.Equal(t, true, agent.batchSend)
  11. agent = NewAgent(&AgentConfig{TaskID: "000161", Proto: "unixgram", Addr: "/var/run/lancer/collector.sock"})
  12. assert.Equal(t, false, agent.batchSend)
  13. }