Exemplo n.º 1
0
func TestSetup(t *testing.T) {

	//create/start zk server
	zkServer = zktest.NewZkTestServer(DefaultZkPort)
	if err := zkServer.Init(); err != nil {
		t.Fatalf("Could not start zk server")
	}

	tmpAddr, err := zkServer.Server.Addr()
	if err != nil {
		t.Fatalf("Could not get zk server addr")
	}
	//set connection to use one created by server instead of making new one
	zk.SetZkConn(zkServer.Zk.Conn, zkServer.ZkEventChan, tmpAddr)

	//configure and start the api
	err = api.Init(DefaultAPIAddr)
	if err != nil {
		t.Fatalf("failed")
	}

	go api.Listen()

	client.SetDefaults("http://0.0.0.0:"+DefaultAPIAddr, DefaultUser, DefaultSecret)
}
Exemplo n.º 2
0
func TestSetup(t *testing.T) {

	//create/start the zkserver and set the conn in the zk package
	zkServer = zktest.NewZkTestServer(DefaultZkPort)
	if err := zkServer.Init(); err != nil {
		t.Fatalf("could not start zkServer for testing")
	}

	tmpAddr, err := zkServer.Server.Addr()
	if err != nil {
		t.Fatalf("could not get zk server addr")
	}

	//set our connection in the zk package to use the one made by zkserver
	//instead of creating an entire new one with zk.Init
	zk.SetZkConn(zkServer.Zk.Conn, zkServer.ZkEventChan, tmpAddr)

	//configure and start the api
	err = api.Init(DefaultAPIAddr)
	if err != nil {
		t.Fatalf("failed")
	}

	go api.Listen()

	client.SetDefaults("http://0.0.0.0:"+DefaultAPIAddr, DefaultUser, DefaultSecret)
}
func TestSetup(t *testing.T) {

	//set defaults for client package
	client.SetDefaults(DefaultAPIAddr, DefaultUser, DefaultSecret)

}