func TestTrapperCannotConnect(t *testing.T) { value, err := zabbix.Send( "localhost:10049", zabbix.TrapperData{Host: "localhost", Key: "foo", Value: "bar"}, timeout, ) if err == nil { t.Errorf("trapper is not runnig, but not error value:", value) } }
func TestTrapperSend(t *testing.T) { res, err := zabbix.Send( "localhost", zabbix.TrapperData{Host: "localhost", Key: "foo", Value: "bar"}, timeout, ) if err != nil { t.Errorf("send failed", err) } if res.Proceeded != 1 { t.Errorf("proceeded expected 1 got", res.Proceeded) } if res.Failed != 0 { t.Errorf("failed expected 0 got", res.Failed) } if res.Total != 1 { t.Errorf("total expected 1 got", res.Total) } }