package zooKeeperMgr

import (
	"testing"
	"time"

	"github.com/samuel/go-zookeeper/zk"
)

func TestCascadeCreate(t *testing.T) {
	zkConfigObj := &ZooKeeperConfig {
		Servers: "172.27.0.4:2181,172.27.0.6:2181,172.27.0.9:2181",
		StartPath: "/Develop/GameServer",
		SessionTimeout: 10 * time.Second,
	}

	conn, _, err := zk.Connect(zkConfigObj.GetServerList(), zkConfigObj.SessionTimeout)
	if err != nil {
		panic(err)
	}
	defer conn.Close()

	err = CascadeCreate(conn, zkConfigObj.StartPath)
	if err != nil {
		t.Errorf("There should be no error, but now there is:%v", err)
	}
}