2011-05-16 17:26:32 +08:00
|
|
|
package gearman
|
2011-03-15 20:21:42 +08:00
|
|
|
|
|
|
|
import (
|
2011-05-16 17:26:32 +08:00
|
|
|
"testing"
|
2011-03-15 20:21:42 +08:00
|
|
|
)
|
|
|
|
|
2011-05-16 17:26:32 +08:00
|
|
|
func TestAddServer(t *testing.T) {
|
|
|
|
worker := NewWorker()
|
|
|
|
t.Log("Add local server 127.0.0.1:4730.")
|
|
|
|
if err := worker.AddServer("127.0.0.1:4730"); err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if l := len(worker.servers); l != 1 {
|
|
|
|
t.Log(worker.servers)
|
|
|
|
t.Error("The length of server list should be 1.")
|
|
|
|
}
|
2011-03-15 20:21:42 +08:00
|
|
|
}
|