// consolePodAcquire will verify acquisition of nodes by
// the requested console pod.
consolePodAcquire will verify acquisition of nodes by
the requested console pod.
// consolePodAcquire will verify acquisition of nodes by // the requested console pod .
func consolePodAcquire(testName string) {
	_, err := clearInventory()
	if err != nil {
		fail(testName, err)
		return
	}
	var ncis = []NodeConsoleInfo{}
	for i := 0; i < 25; i++ {
		name := fmt.Sprintf("x3000c0s%db0n0", i) 
		ncis = append(ncis, nci(name, name, name, "River", 100+i, "Compute", ""))
	}
	for i := 25; i < 50; i++ {
		name := fmt.Sprintf("x3000c0s%db0n0", i) 
		ncis = append(ncis, nci(name, name, name, "Mountain", 100+i, "Compute", ""))
	}
	aop := InventoryApiOp{}
	recordCount, statusCode, responseBodyMessage, err := aop.Put(ncis)
	log.Printf("inventoryCreateByCount returning %d , %d , %s , %s\n", recordCount, statusCode, responseBodyMessage, err)
	if err != nil {
		fail(testName, err)
		return
	}
	err = assertEqualInt(50, int(recordCount), "")
	if err != nil {
		fail(testName, err)
		return
	}
	caop := ConsoleApiOp{}
	statusCode, ncisAcquired, err := caop.Acquire("pod1", 5, 5)
	if err != nil {
		fail(testName, err)
		return
	}
	err = assertEqualInt(10, len(ncisAcquired), "")
	if err != nil {
		fail(testName, err)
	}
	err = assertEqualInt(http.StatusOK, statusCode, "")
	if err != nil {
		fail(testName, err)
	}
	pass(testName)
}
func consolePodAcquire ( testName string ) { _ , err := clearInventory ( ) if err != nil { fail ( testName , err ) return } var ncis = [ ] NodeConsoleInfo { } for i := 0 ; i < 25 ; i ++ { name := fmt . Sprintf ( " " , i ) ncis = append ( ncis , nci ( name , name , name , " " , 100 + i , " " , " " ) ) } for i := 25 ; i < 50 ; i ++ { name := fmt . Sprintf ( " " , i ) ncis = append ( ncis , nci ( name , name , name , " " , 100 + i , " " , " " ) ) } aop := InventoryApiOp { } recordCount , statusCode , responseBodyMessage , err := aop . Put ( ncis ) log . Printf ( " \n " , recordCount , statusCode , responseBodyMessage , err ) if err != nil { fail ( testName , err ) return } err = assertEqualInt ( 50 , int ( recordCount ) , " " ) if err != nil { fail ( testName , err ) return } caop := ConsoleApiOp { } statusCode , ncisAcquired , err := caop . Acquire ( " " , 5 , 5 ) if err != nil { fail ( testName , err ) return } err = assertEqualInt ( 10 , len ( ncisAcquired ) , " " ) if err != nil { fail ( testName , err ) } err = assertEqualInt ( http . StatusOK , statusCode , " " ) if err != nil { fail ( testName , err ) } pass ( testName ) }
consolePodAcquire will verify acquisition of nodes by
the requested console pod.
consolePodAcquire will verify acquisition of nodes by the requested console pod .
// Wipe any previous records // Create some mock inventory data // sure, this looks good ... // sure, this looks good ... // Create the records now // Prepare to acquire nodes