bilibili-backup/library/log/agent_test.go
2019-04-22 02:59:20 +00:00

18 lines
488 B
Go

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)
}