Beispiel #1
0
func TestInitTopo3MSbSl(t *testing.T) {
	log.SetLevel(log.DebugLevel)

	users := users()

	dataNode := datanode()

	mgmPost := structs.MgmPost{
		DbaasType: consts.Type_M_SB_SL,
		Users:     users,
		DataNode:  dataNode,
	}
	swarm, err := swarm.TestSwarm()
	if err != nil {
		t.Fatal(err)
	}

	topology, err, steps := InitTopo(mgmPost, swarm)
	if err != nil {
		t.Fatal(err)
	}
	fmt.Println(steps)
	btopology, _ := json.MarshalIndent(topology, "", "  ")
	fmt.Println(string(btopology))
}
Beispiel #2
0
func TestIsolate1(t *testing.T) {
	swarm, err := swarm.TestSwarm()
	if err != nil {
		t.Fatal(err)
	}
	rwMutex := new(sync.RWMutex)
	isolate_test(swarm, rwMutex, consts.Type_M, consts.Master, t)
}
Beispiel #3
0
func TestIsolate3Sl(t *testing.T) {
	swarm, err := swarm.TestSwarm()
	if err != nil {
		t.Fatal(err)
	}
	rwMutex := new(sync.RWMutex)
	isolate_test(swarm, rwMutex, consts.Type_M_SB_SL, consts.Slave, t)
}
Beispiel #4
0
func TestIsolate2Sb(t *testing.T) {
	swarm, err := swarm.TestSwarm()
	if err != nil {
		t.Fatal(err)
	}
	rwMutex := new(sync.RWMutex)
	isolate_test(swarm, rwMutex, consts.Type_M_SB, consts.StandBy, t)
}
Beispiel #5
0
func TestRecover1(t *testing.T) {
	swarm, err := swarm.TestSwarm()
	if err != nil {
		t.Fatal(err)
	}
	rwMutex := new(sync.RWMutex)
	topology := isolate_test(swarm, rwMutex, consts.Type_M, consts.Master, t)
	recover_test(swarm, rwMutex, topology, t)
}
Beispiel #6
0
func TestRecover3Sl(t *testing.T) {
	log.SetLevel(log.DebugLevel)
	swarm, err := swarm.TestSwarm()
	if err != nil {
		t.Fatal(err)
	}
	rwMutex := new(sync.RWMutex)
	topology := isolate_test(swarm, rwMutex, consts.Type_M_SB_SL, consts.Slave, t)
	recover_test(swarm, rwMutex, topology, t)
}
Beispiel #7
0
func TestResetDb(t *testing.T) {
	swarm, err := swarm.TestSwarm()
	if err != nil {
		t.Fatal(err)
	}
	dataNode := datanode()
	for k, _ := range dataNode {
		err := resetDb(k, swarm)
		if err != nil {
			t.Fatal(err)
		}
	}
}
Beispiel #8
0
func TestChangeMaster34100(t *testing.T) {
	swarm, err := swarm.TestSwarm()
	if err != nil {
		t.Fatal(err)
	}
	mDbInfo := &structs.DatabaseInfo{
		Ip:   "146.240.104.24",
		Port: 34100,
	}

	err = changeMaster(swarm, "03bd33a3f818", mDbInfo.Ip, mDbInfo.Port)
	if err != nil {
		t.Fatal(err)
	}
}