diff --git a/test/unittest/create_test.go b/test/unittest/create_test.go index 7a78105f..9651bf59 100644 --- a/test/unittest/create_test.go +++ b/test/unittest/create_test.go @@ -1155,176 +1155,4 @@ func printStatus(funcname string, params *mock.MockParams, err error) { "rcerr=", err) } -/********************************************************************* - * -- StatusCode (complete loop) - * This test will loop each SS (3 SS as unit) and defined status code. - * It can simulate all the status code combination get from SS - **********************************************************************/ -//func TestCreateLoopProtoStatusThreeSS(t *testing.T) { -// cvalue := []byte("Value to be stored for Create") -// key := testutil.GenerateRandomKey(32) -// params := mock.NewMockParams(5) -// -// for i := 0; i < 3; i++ { -// for a := 0; a < len(createStatusArray)-2; a++ { //loop through 6 status codes for first SS response -// params.MockInfoList[i].Status = createStatusArray[a] -// fmt.Println("len is ", len(createStatusArray), "a is", a, "i is", i, "status is", params.MockInfoList[i].Status) -// -// for j := i + 1; j < 4; j++ { -// for b := 0; b < len(createStatusArray)-2; b++ { //loop through 6 status codes for second SS response -// params.MockInfoList[j].Status = createStatusArray[b] -// -// for k := j + 1; k <= 4; k++ { //loop through 6 status codes for third SS response -// for c := 0; c < len(createStatusArray)-2; c++ { -// params.MockInfoList[k].Status = createStatusArray[c] -// _, err := Mockclient.Create(key, cvalue, 180, params) -// /*testutil.NEAssert(t, rc, 12, "create in TestCreateLoopProtoStatusThreeSS " + -// strconv.Itoa(i) + "{" + strconv.Itoa(int(createStatusArray[a])) + "}," + -// strconv.Itoa(j) + "{" + strconv.Itoa(int(createStatusArray[b])) + "}," + -// strconv.Itoa(k) + "{" + strconv.Itoa(int(createStatusArray[c])) + "}," + -// "should hit no storage server error, rc=" ) -// */ -// printStatus("Tcreate in TestCreateLoopProtoStatusThreeSS ", params, err) -// } -// } -// } -// } -// } -// } -// /**************************************************************************** -// * When simulate SS at position 1 timeout, above loop misses below iteration -// * First SS at position 0 loop through status code 0-6, second SS iterate -// * through position 2,3,4 and loop through status code 0-6 -// ****************************************************************************/ -// params.MockInfoList[1].Delay = 1000000 -// for j := 0; j <= 0; j++ { -// for a := 0; a < len(createStatusArray)-2; a++ { -// params.MockInfoList[j].Status = createStatusArray[a] -// -// for k := 2; k <= 4; k++ { -// for b := 0; b < 7; b++ { -// params.MockInfoList[k].Status = createStatusArray[b] -// -// _, err := Mockclient.Create(key, cvalue, 180, params) -// printTimeoutStatus("TestCreateOneTimeoutTwoStatus SS at p1 missing loop", params, err) -// } -// } -// } -// } -// params.MockInfoList[1].Delay = 0 -// -// /**************************************************************************** -// * When simulate SS at position 2 timeout, above loop misses below iteration -// * a> First SS at position 0 loop through status code 0-6, second SS iterate -// * through position 1,3,4 and loop through status code 0-6 -// * b> First SS at position 1 loop through status code 0-6, second SS iterate -// through position 3,4 and loop through status code 0-6 -// ****************************************************************************/ -// params.MockInfoList[2].Delay = 1000000 -// secondSS := [3]int{1, 3, 4} -// for j := 0; j <= 0; j++ { -// for a := 0; a < len(createStatusArray)-2; a++ { -// params.MockInfoList[j].Status = createStatusArray[a] -// -// for k := 0; k <= 2; k++ { -// for b := 0; b < 7; b++ { -// fmt.Println("one SS at position " + strconv.Itoa(j) + ", " + -// "one SS at position " + strconv.Itoa(secondSS[k])) -// params.MockInfoList[secondSS[k]].Status = createStatusArray[b] -// -// _, err := Mockclient.Create(key, cvalue, 180, params) -// printTimeoutStatus("TestCreateOneTimeoutTwoStatus SS at p2 missing loop1", params, err) -// } -// } -// } -// } -// secondSSP := [2]int{3, 4} -// for j := 1; j <= 1; j++ { -// for a := 0; a < len(createStatusArray)-2; a++ { -// params.MockInfoList[j].Status = createStatusArray[a] -// -// for k := 0; k <= 1; k++ { -// for b := 0; b < len(createStatusArray)-2; b++ { -// params.MockInfoList[secondSSP[k]].Status = createStatusArray[b] -// fmt.Println("one SS at position " + strconv.Itoa(j) + ", " + -// "one SS at position " + strconv.Itoa(secondSSP[k])) -// -// _, err := Mockclient.Create(key, cvalue, 180, params) -// printTimeoutStatus("TestCreateOneTimeoutTwoStatus SS at p2 missing loop2", params, err) -// } -// } -// } -// } -// params.MockInfoList[2].Delay = 0 -// -// /************************************************ -// * Timeout happens for SS in position 3 -// ************************************************/ -// params.MockInfoList[3].Delay = 1000000 -// for i := 0; i < 2; i++ { //Loop through SS at position 0,1 to simulate set SS status code -// for a := 0; a < len(createStatusArray)-2; a++ { -// params.MockInfoList[i].Status = createStatusArray[a] -// -// for j := i + 1; j <= 2; j++ { //Loop through SS at position 1,2 to simulate set SS status code -// for b := 0; b < len(createStatusArray)-2; b++ { -// params.MockInfoList[j].Status = createStatusArray[b] -// -// _, err := Mockclient.Create(key, cvalue, 180, params) -// /*testutil.NEAssert(t, rc, 12, "create in TestCreateOneTimeoutTwoStatus 2 " + -// strconv.Itoa(j) + "{" + strconv.Itoa(int(createStatusArray[a])) + "}," + -// strconv.Itoa(k) + "{" + strconv.Itoa(int(createStatusArray[b])) + "}," + -// "3{timeout}, should hit no storage server error, rc=" ) */ -// printTimeoutStatus("printTestCreateOneTimeoutTwoStatus 4th SS loop1 ", params, err) -// } -// } -// } -// } -// /**************************************************************************** -// * Add one more situation -- set status code for one SS at position 4. -// * First SS iterate through position 0,1,2 loop through status code 0-6, -// * second SS at position 4 loop through status code 0-6 -// ****************************************************************************/ -// for j := 0; j < 3; j++ { -// for a := 0; a < len(createStatusArray)-2; a++ { -// params.MockInfoList[j].Status = createStatusArray[a] -// -// for k := 4; k <= 4; k++ { -// for b := 0; b < len(createStatusArray)-2; b++ { -// params.MockInfoList[k].Status = createStatusArray[b] -// -// _, err := Mockclient.Create(key, cvalue, 180, params) -// /*testutil.NEAssert(t, rc, 12, "create in TestCreateOneTimeoutTwoStatus 3 " + -// strconv.Itoa(j) + "{" + strconv.Itoa(int(createStatusArray[a])) + "}," + " 3{timeout}," + -// strconv.Itoa(k) + "{" + strconv.Itoa(int(createStatusArray[b])) + "}," + -// "should hit no storage server error, rc=" ) */ -// printTimeoutStatus("printTestCreateOneTimeoutTwoStatus 4th SS loop2 ", params, err) -// } -// } -// } -// } -// params.MockInfoList[3].Delay = 0 //recover back to normal, no timeout -// -// /************************************************ -// * Timeout happens for SS in position 4 -// ************************************************/ -// params.MockInfoList[4].Delay = 1000000 -// for j := 0; j < 3; j++ { //Loop through SS at position 0,1,2 to simulate set SS status code -// for a := 0; a < len(createStatusArray)-2; a++ { -// params.MockInfoList[j].Status = createStatusArray[a] -// -// for k := j + 1; k < 4; k++ { //Loop through SS at position 1,2,3 to simulate set SS status code -// for b := 0; b < 7; b++ { -// params.MockInfoList[k].Status = createStatusArray[b] -// -// _, err := Mockclient.Create(key, cvalue, 180, params) -// /*testutil.NEAssert(t, rc, 12, "create in TestCreateOneTimeoutTwoStatus 4 " + -// strconv.Itoa(j) + "{" + strconv.Itoa(int(createStatusArray[a])) + "}," + -// strconv.Itoa(k) + "{" + strconv.Itoa(int(createStatusArray[b])) + "}," + -// "4{timeout},should hit no storage server error, rc=" ) */ -// printTimeoutStatus("printTestCreateOneTimeoutTwoStatus 5th SS ", params, err) -// } -// } -// } -// } -// params.MockInfoList[4].Delay = 0 //recover back to normal, no timeout -//} +