e0c1537e8e
--HG-- rename : README => README.md rename : src/gearman/client.go => gearman/client/client.go rename : src/gearman/client_test.go => gearman/client/client_test.go rename : src/gearman/clientjob.go => gearman/client/clientjob.go rename : src/gearman/gearman.go => gearman/gearman.go rename : src/gearman/jobagent.go => gearman/worker/jobagent.go rename : src/gearman/worker.go => gearman/worker/worker.go rename : src/gearman/worker_test.go => gearman/worker/worker_test.go rename : src/gearman/workerjob.go => gearman/worker/workerjob.go
42 lines
815 B
Go
42 lines
815 B
Go
package client
|
|
|
|
import (
|
|
"bitbucket.org/mikespook/gearman-go/gearman"
|
|
"testing"
|
|
)
|
|
|
|
var client *Client
|
|
|
|
func init() {
|
|
client = NewClient()
|
|
}
|
|
|
|
func TestClientAddServer(t *testing.T) {
|
|
t.Log("Add local server 127.0.0.1:4730")
|
|
if err := client.AddServer("127.0.0.1:4730"); err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|
|
|
|
func TestClientEcho(t *testing.T) {
|
|
if echo, err := client.Echo([]byte("Hello world")); err != nil {
|
|
t.Error(err)
|
|
} else {
|
|
t.Log(echo)
|
|
}
|
|
}
|
|
|
|
func TestClientDo(t *testing.T) {
|
|
if handle, err := client.Do("ToUpper", []byte("abcdef"), gearman.JOB_LOW|gearman.JOB_BG); err != nil {
|
|
t.Error(err)
|
|
} else {
|
|
t.Log(handle)
|
|
}
|
|
}
|
|
|
|
func TestClientClose(t *testing.T) {
|
|
if err := client.Close(); err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|