bilibili-backup/library/log/agent_test.go

18 lines
488 B
Go
Raw Normal View History

2019-04-22 10:59:20 +08:00
package log
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestBatchSendSwitch(t *testing.T) {
agent := NewAgent(nil)
assert.Equal(t, true, agent.batchSend)
agent = NewAgent(&AgentConfig{TaskID: "000161", Proto: "unixpacket", Addr: "/var/run/lancer/collector_tcp.sock"})
assert.Equal(t, true, agent.batchSend)
agent = NewAgent(&AgentConfig{TaskID: "000161", Proto: "unixgram", Addr: "/var/run/lancer/collector.sock"})
assert.Equal(t, false, agent.batchSend)
}