Commit 54b72054 authored by Yann Garcia's avatar Yann Garcia
Browse files

Enhance meep-vis-traffic-mgr test script

parent c6c32447
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ const profiling = false
var profilingTimers map[string]time.Time

const (
	FieldId      = "id"
	FieldPoaName = "poaName"
	FieldTime1   = "time1"
	FieldTime2   = "time2"
	FieldTime3   = "time3"
+39 −4
Original line number Diff line number Diff line
@@ -14,6 +14,13 @@ const ( // FIXME To be update with correct values at the end
	amDBPwd     = "pwd"
	amDBHost    = "localhost"
	amDBPort    = "30432"

	poa1Id    = "poa1-Iid"
	poa1Name  = "poa1-name"
	poa1Time1 = 0
	poa1Time2 = 0
	poa1Time3 = 0
	poa1Time4 = 0
)

func TestNewTrafficMgr(t *testing.T) {
@@ -99,12 +106,40 @@ func TestTrafficMgrCreatePoa(t *testing.T) {

	// Add Invalid POA load
	fmt.Println("Create Invalid POA load")
	// TODO
	/*poaData := map[string]interface{}{
	poaData := map[string]interface{}{
		FieldId      : poa1Id,
		FieldPoaName : poa1Name,
		FieldTime1   : poa1Time1,
		FieldTime2   : poa1Time2,
		FieldTime3   : poa1Time3,
		FieldTime4   : poa1Time4,
	}
	err = tm.CreatePoaLoad("", poa1Name, poaData)
	if err == nil {
		t.Fatalf("POA load creation should have failed")
	}

	// Add POA load & Validate successfully added
	fmt.Println("Add POA load & Validate successfully added")
	poaData = map[string]interface{}{
		FieldId      : poa1Id,
		FieldPoaName : poa1Name,
		FieldTime1   : poa1Time1,
		FieldTime2   : poa1Time2,
		FieldTime3   : poa1Time3,
		FieldTime4   : poa1Time4,
	}
	err = tm.CreatePoaLoad(poa1Id, poa1Name, poaData)
	if err != nil {
		t.Fatalf("Failed to create asset: " + err.Error())
	}
	poaMap, err := tm.GetPoaLoad(poa1Name)
	if err != nil || poaMap == nil {
		t.Fatalf("Failed to get POA load")
	}
	err = tm.CreatePoaLoad("")*/
	// TODO Validate 
	// Delete all & validate updatespoaMap

	// Delete all & validate updates
	fmt.Println("Delete all & validate updates")
	// TODO
	/*err = tm.DeleteAllPoaLoad()